2
0
Fork 0
mirror of https://github.com/MartinThoma/LaTeX-examples.git synced 2025-04-19 11:38:05 +02:00

Add tikz/cos-fixpoint

This commit is contained in:
Martin Thoma 2015-11-07 15:59:43 +01:00
parent f8f167631c
commit afaf9d4d90
4 changed files with 72 additions and 0 deletions

View file

@ -0,0 +1,31 @@
SOURCE = cos-fixpoint
DELAY = 80
DENSITY = 300
WIDTH = 500
make:
pdflatex -shell-escape $(SOURCE).tex -output-format=pdf
make clean
clean:
rm -rf $(TARGET) *.class *.html *.log *.aux *.data *.gnuplot *.table
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

View file

@ -0,0 +1,3 @@
Compiled example
----------------
![Example](cos-fixpoint.png)

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

View file

@ -0,0 +1,38 @@
\documentclass{article}
\usepackage[pdftex,active,tightpage]{preview}
\setlength\PreviewBorder{0mm}
\usepackage{pgfplots}
\pgfplotsset{compat=1.9}
\begin{document}
\begin{preview}
\begin{tikzpicture}
\begin{axis}[
axis x line=middle,
axis y line=middle,
enlarge y limits=true,
enlarge x limits=true,
xmin=0, xmax=pi, % x domain
width=12cm, height=8cm, % size of the image
grid = major,
grid style={dashed, gray!30},
ymin=-1, % start the diagram at this y-coordinate
ymax= 1, % end the diagram at this y-coordinate
% axis background/.style={fill=white},
ylabel=$y$,
xlabel=$x$,
xtick={0,1.5708,3.14159},
xticklabels={$0$,$\frac{\pi}{2}$,$\pi$},
legend style={at={(0.2,0.37)}, anchor=north, fill=none}
]
\addplot[domain=-8:8,very thick,samples=200,blue] {cos(deg(x))};
\addplot[domain=-8:8,very thick,samples=200,red] {x};
\coordinate (a) at (axis cs:0.739085,0.739085);
\fill[red] (a) circle (3pt);
\node[label={[label distance=0.1cm]0:$x = y \approx 0.739085$}] at (a) {};
\legend{$\cos x$, $x$}
\end{axis}
\end{tikzpicture}
\end{preview}
\end{document}