From e150068faf284b1ccb85bcbdc52c37e40a7179ea Mon Sep 17 00:00:00 2001 From: Martin Thoma Date: Fri, 10 Aug 2012 10:56:38 +0200 Subject: [PATCH] added 5 LaTeX examples --- .../analysis/Analysis_Wichtige_Formeln.tex | 86 +++++++++++++++++++ cheat-sheets/analysis/Makefile | 16 ++++ documents/semesterplan/Makefile | 16 ++++ documents/semesterplan/semesterplan.tex | 50 +++++++++++ source-code/AbstractClass.java | 13 +++ source-code/ConcreteClass.java | 17 ++++ source-code/Documentation.tex | 29 +++++++ source-code/Makefile | 6 ++ tikz/countable-sets/Makefile | 31 +++++++ tikz/countable-sets/countable-sets.tex | 62 +++++++++++++ tikz/pairing-function/Makefile | 31 +++++++ tikz/pairing-function/pairing-function.tex | 63 ++++++++++++++ 12 files changed, 420 insertions(+) create mode 100644 cheat-sheets/analysis/Analysis_Wichtige_Formeln.tex create mode 100644 cheat-sheets/analysis/Makefile create mode 100644 documents/semesterplan/Makefile create mode 100644 documents/semesterplan/semesterplan.tex create mode 100644 source-code/AbstractClass.java create mode 100644 source-code/ConcreteClass.java create mode 100644 source-code/Documentation.tex create mode 100644 source-code/Makefile create mode 100644 tikz/countable-sets/Makefile create mode 100644 tikz/countable-sets/countable-sets.tex create mode 100644 tikz/pairing-function/Makefile create mode 100644 tikz/pairing-function/pairing-function.tex diff --git a/cheat-sheets/analysis/Analysis_Wichtige_Formeln.tex b/cheat-sheets/analysis/Analysis_Wichtige_Formeln.tex new file mode 100644 index 0000000..af30c62 --- /dev/null +++ b/cheat-sheets/analysis/Analysis_Wichtige_Formeln.tex @@ -0,0 +1,86 @@ +\documentclass[a4paper,10pt]{article} +\usepackage{amssymb} +\usepackage{amsmath} +\usepackage[utf8]{inputenc} % this is needed for umlauts +\usepackage[ngerman]{babel} % this is needed for umlauts +\usepackage[T1]{fontenc} % this is needed for correct output of umlauts in pdf +%layout +\usepackage[margin=2.5cm]{geometry} +\usepackage{parskip} + +\pdfinfo{ + /Author (Peter Merkert, Martin Thoma) + /Title (Wichtige Formeln der Analysis I) + /CreationDate (D:20120221095400) + /Subject (Analysis I) + /Keywords (Analysis I; Formeln) +} + +\everymath={\displaystyle} + +\begin{document} + +\title{Analysis Formelsammlung} +\author{Peter Merkert, Martin Thoma} +\date{21. Februar 2012} + +\section{Grenzwerte} +\begin{table}[ht] +\begin{minipage}[b]{0.5\linewidth}\centering + +\begin{align*} +\lim_{x \to 0} \frac {\sin x}{x} &= 1 \\ +\lim_{x \to 0} \frac {e^x - 1}{x} &= 1 \\ +\lim_{h \to 0} \frac {e^{{x_0} + h} - e^{x_0}}{h} &= e^{x_0} \\ +\sum_{n = 0}^{\infty} (-1)^n \frac {(-1)^{n + 1}}{n} &= \log 2 \\ +\cos x &= \sum_{n = 0}^{\infty} (-1)^n \frac {x^{2n}}{(2n)!} \\ +\sin x &= \sum_{n = 0}^{\infty} (-1)^n \frac {x^{2n + 1}}{(2n + 1)!} +\end{align*} + +\end{minipage} +\hspace{0.5cm} +\begin{minipage}[b]{0.5\linewidth} +\centering + +\begin{align*} +\cosh x = \frac {1}{2} (e^x + e^{-x}) &= \scriptstyle \sum_{n = 0}^{\infty} \frac {x^{2n}}{(2n)!} \\ +\sinh x = \frac {1}{2} (e^x - e^{-x}) &= \sum_{n = 0}^{\infty} \frac {x^{2n + 1}}{(2n + 1)!} \\ +e^x &= \sum_{n = 0}^{\infty} \frac {x^n}{n!} \\ +\sum_{n = 0}^{\infty} (-1)^n \frac {x^{n + 1}}{n + 1} &= \log (1+x) (x \in (-1,1)) \\ +\sum_{n = 0}^{\infty} x^n &= \frac {1}{1 - x} (x \in (-1,1)) \\ +0,\bar{3} &= \sum_{n = 1}^{\infty} \frac {3}{(10)^n} +\end{align*} + +\end{minipage} +\end{table} + + + + + + +\section{Zusammenhänge} +\begin{align*} + (\cos x)^2 + (\sin x)^2 &= 1 \\ + (\cosh x)^2 - (\sinh x)^2 &= 1 \\ + \tan x &= \frac {\sin x}{\cos x} \\ + \tanh x &= \frac {\sinh x}{\cosh x} \\ + (x + y)^n &= \sum_{k=0}^{n} \binom{n}{k} x^{n-k} y^k +\end{align*} + +\section{Ableitungen} +\begin{align*} + (\arctan x)' &= \frac {1}{1 + x^2} \\ + (\sin x)' &= \cos x \\ + (\cos x)' &= -\sin x \\ + (\text{arctanh} x)' &= \frac {1}{\sqrt {1 + x^2}} +\end{align*} + + +\section{Potenzreihen} +Zuerst den Potenzradius r berechnen: +\( + r = \frac {1}{\lim \text{sup} \sqrt[n]{|a_n|}} +\) + +\end{document} diff --git a/cheat-sheets/analysis/Makefile b/cheat-sheets/analysis/Makefile new file mode 100644 index 0000000..8b4242d --- /dev/null +++ b/cheat-sheets/analysis/Makefile @@ -0,0 +1,16 @@ +# CHANGELOG +# Version 1.0: Erstellung des Makefile + +# Version des Makefile +fileinfo := LaTeX Makefile +author := Martin Thoma +version := 1.0 + +DATE=$(shell date +%Y-%m-%d) + +make: + pdflatex Analysis_Wichtige_Formeln.tex -output-format=pdf + make clean + +clean: + rm -rf $(TARGET) *.class *.html *.log *.aux diff --git a/documents/semesterplan/Makefile b/documents/semesterplan/Makefile new file mode 100644 index 0000000..3215b3a --- /dev/null +++ b/documents/semesterplan/Makefile @@ -0,0 +1,16 @@ +# CHANGELOG +# Version 1.0: Erstellung des Makefile + +# Version des Makefile +fileinfo := LaTeX Makefile +author := Martin Thoma +version := 1.0 + +DATE=$(shell date +%Y-%m-%d) + +make: + pdflatex semesterplan.tex -output-format=pdf + make clean + +clean: + rm -rf $(TARGET) *.class *.html *.log *.aux diff --git a/documents/semesterplan/semesterplan.tex b/documents/semesterplan/semesterplan.tex new file mode 100644 index 0000000..3b4b86d --- /dev/null +++ b/documents/semesterplan/semesterplan.tex @@ -0,0 +1,50 @@ +\documentclass[a4paper,10pt]{article} +\usepackage{amssymb} % needed for math +\usepackage{amsmath} % needed for math +\usepackage{amsthm} % needed for proof environment +\usepackage[utf8]{inputenc} % this is needed for umlauts +\usepackage[ngerman]{babel} % this is needed for umlauts +\usepackage[T1]{fontenc} % this is needed for correct output of umlauts in pdf +\usepackage{wasysym} % checkbox +\usepackage{array} % row height +\usepackage[landscape]{geometry} +\geometry{top=1.5cm,left=1cm,right=1cm,bottom=2cm} + +\pdfinfo{ + /Author (Martin Thoma) + /Title (Semesterplan) + /Subject (Semesterplan) + /Keywords (Semesterplan) +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Variables % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\newcommand{\semester}{Wintersemester} +\newcommand{\jahr}{2012} +\newcommand{\student}{Martin Thoma} + +\begin{document} +\section*{Semesterplan für das \semester~\jahr~von~\student} + +\begin{table}[h] + \setlength{\extrarowheight}{4.5pt} + \begin{tabular}{ |l|p {1.9 cm}|p {1.9 cm}|p {1.9 cm}|p {1.9 cm}|p {1.9 cm}|p {1.9 cm}|p {1.9 cm}|p {1.9 cm}|p {1.9 cm}|p {1.9 cm}|p {1.9 cm}|} + \hline + ~ & \textbf{Ü1} & \textbf{Ü2} & \textbf{Ü3} & \textbf{Ü4} & \textbf{Ü5} & \textbf{Ü6} & \textbf{Ü7} & \textbf{Ü8} & \textbf{Ü9} & \textbf{Ü10} & $\sum$ \\ + \hline + \hline + LA II & 144 & ~ & ~ & ~ & ~ & ~ & ~ & ~ & ~ & ~ & ~ \\ + \hline + Analysis II & ~ & ~ & ~ & ~ & ~ & ~ & ~ & ~ & ~ & ~ & ~ \\ + \hline + Algo & ~ & ~ & ~ & ~ & ~ & ~ & ~ & ~ & ~ & ~ & ~ \\ + \hline + SWT & ~ & ~ & ~ & ~ & ~ & ~ & ~ & ~ & ~ & ~ & ~ \\ + \hline + Rechner & ~ & ~ & ~ & ~ & ~ & ~ & ~ & ~ & ~ & ~ & ~ \\ + \hline + \end{tabular} +\end{table} + +\end{document} diff --git a/source-code/AbstractClass.java b/source-code/AbstractClass.java new file mode 100644 index 0000000..0a17170 --- /dev/null +++ b/source-code/AbstractClass.java @@ -0,0 +1,13 @@ +public class AbstractClass { + int templateMethod() { + return simpleOperation1() * simpleOperation2(); + } + + int simpleOperation1() { + return 2; + } + + int simpleOperation2() { + return 3; + } +} diff --git a/source-code/ConcreteClass.java b/source-code/ConcreteClass.java new file mode 100644 index 0000000..65743e8 --- /dev/null +++ b/source-code/ConcreteClass.java @@ -0,0 +1,17 @@ +import java.util.LinkedList; + +public class ConcreteClass extends AbstractClass { + @Override + int simpleOperation1() { + return 5; + } + + @Override + int simpleOperation2() { + return 7; + } + + public void testMe(int aVariable, double bT, LinkedList c) { + System.out.println("Test!" + aVariable + bT + c); + } +} diff --git a/source-code/Documentation.tex b/source-code/Documentation.tex new file mode 100644 index 0000000..ff89cda --- /dev/null +++ b/source-code/Documentation.tex @@ -0,0 +1,29 @@ +\documentclass[a4paper,12pt]{article} +\usepackage{amssymb} % needed for math +\usepackage{amsmath} % needed for math +\usepackage[utf8]{inputenc} % this is needed for german umlauts +\usepackage[ngerman]{babel} % this is needed for german umlauts +\usepackage[T1]{fontenc} % this is needed for correct output of umlauts in pdf +\usepackage[margin=2cm]{geometry} %layout +\usepackage{minted} % needed for the inclusion of source code + +\begin{document} +\renewcommand{\theFancyVerbLine}{ + \sffamily\textcolor[rgb]{0.5,0.5,0.5}{\scriptsize\arabic{FancyVerbLine}}} +\inputminted[linenos, + numbersep=7pt, + gobble=0, + frame=lines, + framesep=2mm, + label=AbstractClass.java, + fontsize=\footnotesize, tabsize=4]{java}{AbstractClass.java} +\clearpage +\inputminted[linenos, + numbersep=7pt, + gobble=0, + frame=lines, + framesep=2mm, + label=ConcreteClass.java, + fontsize=\footnotesize, tabsize=4]{java}{ConcreteClass.java} + +\end{document} diff --git a/source-code/Makefile b/source-code/Makefile new file mode 100644 index 0000000..547f089 --- /dev/null +++ b/source-code/Makefile @@ -0,0 +1,6 @@ +make: + pdflatex -shell-escape Documentation.tex -output-format=pdf + make clean + +clean: + rm -rf $(TARGET) *.class *.html *.log *.aux *.out *.glo *.glg *.gls *.ist *.xdy *.1 *.pyg diff --git a/tikz/countable-sets/Makefile b/tikz/countable-sets/Makefile new file mode 100644 index 0000000..996c40e --- /dev/null +++ b/tikz/countable-sets/Makefile @@ -0,0 +1,31 @@ +SOURCE = countable-sets +DELAY = 80 +DENSITY = 300 +WIDTH = 500 + +make: + pdflatex $(SOURCE).tex -output-format=pdf + make clean + +clean: + rm -rf $(TARGET) *.class *.html *.log *.aux *.data + +gif: + pdfcrop $(SOURCE).pdf + convert -verbose -delay $(DELAY) -loop 0 -density $(DENSITY) $(SOURCE)-crop.pdf $(SOURCE).gif + make clean + +png: + make + make svg + inkscape $(SOURCE).svg -w $(WIDTH) --export-png=$(SOURCE).png + +transparentGif: + convert $(SOURCE).pdf -transparent white result.gif + make clean + +svg: + #inkscape $(SOURCE).pdf --export-plain-svg=$(SOURCE).svg + pdf2svg $(SOURCE).pdf $(SOURCE).svg + # Necessary, as pdf2svg does not always create valid svgs: + inkscape $(SOURCE).svg --export-plain-svg=$(SOURCE).svg diff --git a/tikz/countable-sets/countable-sets.tex b/tikz/countable-sets/countable-sets.tex new file mode 100644 index 0000000..7f173c1 --- /dev/null +++ b/tikz/countable-sets/countable-sets.tex @@ -0,0 +1,62 @@ +\documentclass{standalone} +\usepackage{pgfplots} +\usepackage{sansmath} % for sans serif math + +%%%< +% The data files, written on the first run. +\begin{filecontents}{function.data} +# n m +1 1 +1 2 +2 1 +1 3 +2 2 +3 1 +1 4 +2 3 +3 2 +4 1 +1 5 +2 4 +3 3 +4 2 +5 1 +\end{filecontents} + +\begin{document} + +\begin{tikzpicture} +\begin{axis}[ + compat=newest, % for better label placement + font=\sansmath\sffamily, % math and normal text in sans serif + xlabel=n, ylabel=m, % the label texts + xmin=0, ymin=0, % axis origin + enlarge y limits=false, % don't enlarge the y axis beyond the data range + enlarge x limits={upper,abs=0.02}, % enlarge x axis slightly to make sure the last tick mark is drawn completely + axis lines*=left, % only draw the left axis lines, not a box + unit vector ratio*={1 1 1}, % equal axis scaling. "*" to make sure the axes can only be reduced in size, not enlarged + width=6cm, % set the overall width of the plot + try min ticks=5, % adjusts how many ticks are printed + tick align=center, % tick marks centered on the axes + legend style={ + draw=none, % no frame around axes + at={(1,1)}, % place at upper right of plot + anchor=north % use upper middle edge of legend for alignment + }, +] +\addplot [ + mark=square*, mark size=0.5em, % square, filled ("*"), radius of 0.5em + nodes near coords={ + \pgfmathparse{int(\coordindex+1)} + \pgfmathresult + }, % print labels on each data point, using `\coordindex` (the data point counter) increased by 1 + every node near coord/.style={ + font=\scriptsize\sffamily\bfseries, % smaller text size, bold for the data point labels + text=white, + anchor=center % center the labels on the plot marks + } + ] table {function.data}; +\addlegendentry{f(m,n)} +\end{axis} +\end{tikzpicture} +\end{document} diff --git a/tikz/pairing-function/Makefile b/tikz/pairing-function/Makefile new file mode 100644 index 0000000..8b333b4 --- /dev/null +++ b/tikz/pairing-function/Makefile @@ -0,0 +1,31 @@ +SOURCE = pairing-function +DELAY = 80 +DENSITY = 300 +WIDTH = 500 + +make: + pdflatex $(SOURCE).tex -output-format=pdf + make clean + +clean: + rm -rf $(TARGET) *.class *.html *.log *.aux *.data + +gif: + pdfcrop $(SOURCE).pdf + convert -verbose -delay $(DELAY) -loop 0 -density $(DENSITY) $(SOURCE)-crop.pdf $(SOURCE).gif + make clean + +png: + make + make svg + inkscape $(SOURCE).svg -w $(WIDTH) --export-png=$(SOURCE).png + +transparentGif: + convert $(SOURCE).pdf -transparent white result.gif + make clean + +svg: + #inkscape $(SOURCE).pdf --export-plain-svg=$(SOURCE).svg + pdf2svg $(SOURCE).pdf $(SOURCE).svg + # Necessary, as pdf2svg does not always create valid svgs: + inkscape $(SOURCE).svg --export-plain-svg=$(SOURCE).svg diff --git a/tikz/pairing-function/pairing-function.tex b/tikz/pairing-function/pairing-function.tex new file mode 100644 index 0000000..33589d4 --- /dev/null +++ b/tikz/pairing-function/pairing-function.tex @@ -0,0 +1,63 @@ +\documentclass{standalone} +\usepackage{pgfplots} +\usepackage{sansmath} % for sans serif math + +%%%< +% The data files, written on the first run. +\begin{filecontents}{function.data} +# x y +0 0 +0 1 +1 0 +0 2 +1 1 +2 0 +0 3 +1 2 +2 1 +3 0 +0 4 +1 3 +2 2 +3 1 +4 0 +\end{filecontents} + +\begin{document} + +\begin{tikzpicture} +\begin{axis}[ + compat=newest, % for better label placement + font=\sansmath\sffamily, % math and normal text in sans serif + xlabel=$y$, ylabel=$x$, % the label texts + xmin=0, ymin=0, % axis origin + enlarge y limits=false, % don't enlarge the y axis beyond the data range + enlarge x limits={upper,abs=0.02}, % enlarge x axis slightly to make sure the last tick mark is drawn completely + axis lines*=left, % only draw the left axis lines, not a box + unit vector ratio*={1 1 1}, % equal axis scaling. "*" to make sure the axes can only be reduced in size, not enlarged + width=6cm, % set the overall width of the plot + try min ticks=5, % adjusts how many ticks are printed + tick align=center, % tick marks centered on the axes + legend style={ + draw=none, % no frame around axes + at={(1,1)}, % place at upper right of plot + anchor=north, % use upper middle edge of legend for alignment + fill=none + }, +] +\addplot [ + mark=square*, mark size=0.5em, % square, filled ("*"), radius of 0.5em + nodes near coords={ + \pgfmathparse{int(\coordindex)} + \pgfmathresult + }, % print labels on each data point, using `\coordindex` (the data point counter) increased by 1 + every node near coord/.style={ + font=\scriptsize\sffamily\bfseries, % smaller text size, bold for the data point labels + text=white, + anchor=center % center the labels on the plot marks + } + ] table {function.data}; +\addlegendentry{$\displaystyle\pi(x, y) = y + \sum_{i=0}^{x+y} i$} +\end{axis} +\end{tikzpicture} +\end{document}