2
0
Fork 0
mirror of https://github.com/MartinThoma/LaTeX-examples.git synced 2025-04-19 11:38:05 +02:00
This commit is contained in:
Martin Thoma 2014-08-05 09:54:55 -04:00
parent cc72dbf03e
commit 43fb00b116
7 changed files with 170 additions and 0 deletions

View file

@ -0,0 +1,35 @@
SOURCE = vector-change-direction
DELAY = 80
DENSITY = 300
WIDTH = 512
make:
pdflatex $(SOURCE).tex -output-format=pdf
make clean
clean:
rm -rf $(TARGET) *.class *.html *.log *.aux *.data *.gnuplot
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:
make
#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
rsvg-convert -a -w $(WIDTH) -f svg $(SOURCE).svg -o $(SOURCE)2.svg
inkscape $(SOURCE)2.svg --export-plain-svg=$(SOURCE).svg
rm $(SOURCE)2.svg

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

View file

@ -0,0 +1,44 @@
\documentclass[varwidth=true, border=2pt]{standalone}
\usepackage{tkz-euclide}
\usepackage{tikz}
\usetikzlibrary{shapes, calc, shapes, arrows}
\usepackage{amsmath,amssymb}
\usepackage{xcolor}
\definecolor{xvectorcolor}{HTML}{77933C}
\begin{document}
\usetkzobj{all}
\begin{tikzpicture}[font=\boldmath]
\large
% Points
\coordinate (A) at (0,0) {};
\coordinate (B) at (2,2) {};
\coordinate (AB2) at (3,3) {};
\coordinate (C) at (5,0) {};
\node[below of=A,node distance=0.4cm] {$\scriptsize (0, 0)$};
\node[left of=B,node distance=0.9cm] {$\scriptsize (x_1, y_1)$};
\node[below of=C,node distance=0.4cm] {$\scriptsize (x_2, y_2)$};
% Draw the angles
% angle alpha
\draw[fill=green!30] (A) -- (0:0.75cm) arc (0:45:.75cm);
\draw (0.45cm,0.17cm) node {$\alpha$};
% angle beta
\tkzMarkAngle[arc=l,size=0.7cm,color=blue,fill=blue!20](A,B,C)
%\draw[fill=green!30] (B) -- ($(B)!0.2!(C)$) arc (-35:-132:.75cm);
\draw (2.0cm, 1.6cm) node {$\beta$};
% angle gamma
\tkzMarkAngle[arc=l,size=0.7cm,color=red,fill=red!20](C,B,AB2)
\draw (2.4cm, 2.0cm) node {$\gamma$};
% Draw the vectors
\draw[ultra thick, xvectorcolor, arrows={-latex}] (A) -- (B);
\draw[ultra thick, blue!80, arrows={-latex}] (B) -- (C);
\end{tikzpicture}
\end{document}

View file

@ -0,0 +1,31 @@
SOURCE = x-2-quadratic-function
DELAY = 80
DENSITY = 300
WIDTH = 512
make:
pdflatex $(SOURCE).tex -output-format=pdf
make clean
clean:
rm -rf $(TARGET) *.class *.html *.log *.aux *.data *.gnuplot
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](x-2-quadratic-function.png)

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

View file

@ -0,0 +1,57 @@
\documentclass[varwidth=true, border=2pt]{standalone}
\usepackage{pgfplots}
\usepackage{tikz}
\usetikzlibrary{patterns}
\tikzset{
hatch distance/.store in=\hatchdistance,
hatch distance=10pt,
hatch thickness/.store in=\hatchthickness,
hatch thickness=2pt
}
\makeatletter
\pgfdeclarepatternformonly[\hatchdistance,\hatchthickness]{flexible hatch}
{\pgfqpoint{0pt}{0pt}}
{\pgfqpoint{\hatchdistance}{\hatchdistance}}
{\pgfpoint{\hatchdistance-1pt}{\hatchdistance-1pt}}%
{
\pgfsetcolor{\tikz@pattern@color}
\pgfsetlinewidth{\hatchthickness}
\pgfpathmoveto{\pgfqpoint{0pt}{0pt}}
\pgfpathlineto{\pgfqpoint{\hatchdistance}{\hatchdistance}}
\pgfusepath{stroke}
}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
legend pos=north east,
axis x line=middle,
axis y line=middle,
grid = major,
width=8cm,
height=8cm,
grid style={dashed, gray!30},
xmin= 0, % start the diagram at this x-coordinate
xmax= 2, % end the diagram at this x-coordinate
ymin= 0, % start the diagram at this y-coordinate
ymax= 2, % end the diagram at this y-coordinate
xlabel=$x$,
ylabel=$y$,
%xticklabels={-2,-1.6,...,2},
%yticklabels={-8,-7,...,8},
tick align=outside,
enlargelimits=true,
tension=0.08]
% plot it
\addplot[domain=0:2, red, thick,samples=500] {x*x};
\addplot[pattern=flexible hatch,
area legend,
pattern color=blue, domain=0:1,samples=500] {x*x} \closedcycle;
\addlegendentry{$f(x)=x^2$}
\addlegendentry{$\int_0^1 x^2 \mathrm{d} x$}
\end{axis}
\end{tikzpicture}
\end{document}