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

added first asymptote example

This commit is contained in:
Martin Thoma 2013-12-13 13:46:48 +01:00
parent 26d9e9cd67
commit 0ec4968e53
8 changed files with 162 additions and 0 deletions

View file

@ -0,0 +1,34 @@
SOURCE = topology-r-spiral-covering-s
DELAY = 80
DENSITY = 300
WIDTH = 512
make:
pdflatex $(SOURCE).tex -output-format=pdf
asy $(SOURCE)-*.asy
asy $(SOURCE)-*.asy
pdflatex $(SOURCE).tex -output-format=pdf
make clean
clean:
rm -rf $(TARGET) *.class *.html *.log *.aux *.data *.gnuplot *.out *.prc *.pre *.asy
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,8 @@
Compiled example
----------------
![Example](topology-r-spiral-covering-s.png)
Credits
-------
This graph was created by [Alex](http://tex.stackexchange.com/users/22467/alex) ([source](http://tex.stackexchange.com/a/149706/5645))

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

View file

@ -0,0 +1,61 @@
\documentclass{standalone}
\usepackage{asymptote}
\begin{document}
\begin{asy}[width=10cm,height=10cm]
import graph3;
usepackage("amsfonts");
size3(200);
currentprojection=orthographic(4,6,3);
// parametrization
real x(real t) {return cos(2pi*t);}
real y(real t) {return sin(2pi*t);}
real z(real t) {return 0.5*t;}
real z0(real t) {return 0;}
scale(true);
// some parameters
real delta = 0.01;
real phix = 0.1;
real phim = 6.7;
// spiral
path3 spiral = graph(x,y,z,1,phim,operator ..);
draw(spiral,Arrow3);
// blue circle
draw(unitcircle3, blue);
// orange segments
pen sp = orange+1;
draw(graph(x,y,z0,phix-delta,phix+delta,operator ..),sp);
for(real i=1; i<phim; ++i) {
draw(graph(x,y,z,i+phix-delta,i+phix+delta,operator ..),sp);
}
// the dot x
triple px = (x(phix),y(phix),0);
dot(px);
label("$x$",px,S);
// axes and labels
xaxis3("",red);
yaxis3("",red);
zaxis3("",red);
label("$\mathbb{R}$",(1,-1,4));
draw((-1,1,4)--(-1,1,1),Arrow3);
label("$p$",(-1,1,2.5),E);
label("$S^1$",(-1,1,0),W,blue);
\end{asy}
\end{document}

View file

@ -0,0 +1,32 @@
SOURCE = commutative-diagram-2
DELAY = 80
DENSITY = 300
WIDTH = 500
make:
pdflatex $(SOURCE).tex -output-format=pdf
pdflatex $(SOURCE).tex -output-format=pdf
make clean
clean:
rm -rf $(TARGET) *.class *.html *.log *.aux
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](commutative-diagram-2.png)

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

View file

@ -0,0 +1,24 @@
\documentclass{article}
\usepackage[pdftex,active,tightpage]{preview}
\setlength\PreviewBorder{2mm}
\usepackage{tikz}
\usetikzlibrary{arrows,positioning,fit,shapes}
\begin{document}
\begin{preview}
\begin{tikzpicture}[scale=1,node distance=2.0cm]
\node (Z) at (0,0) {$Z$};
\node (Y) at (3,0) {$Y$};
\node (X) at (1.5,-1.5) {$X$};
\draw[->, above, dashed] (Z) to node {$\tilde{f}$} (Y);
\draw[->, below] (Z) to node {$f$} (X);
\draw[->, right] (Y) to node {$p$} (X);
\begin{scope}[xshift=1.3cm,yshift=-0.6cm]
\draw (0,0) -- (0.3,0.3);
\draw (0.1,0) -- (0.4,0.3);
\draw (0.2,0) -- (0.5,0.3);
\end{scope}
\end{tikzpicture}
\end{preview}
\end{document}