Commit 34ec4ed9 authored by Niles Johnson's avatar Niles Johnson

tikz demos

parent 28a1ce31
\documentclass[10pt]{article}
\usepackage{demo}
\begin{document}
Examples bending arrows
\begin{LTXexample}[pos=t,preset=\centering,width=\textwidth]
\begin{tikzpicture}[x=30mm,y=25mm]
\draw[tikzob,mm] %objects
(0,3) node (pgm) {.}
(0,2) node (wsbo) {.}
(-2,2) node (o) {.}
(2,2) node (wsc) {.}
(-1.2,1) node (wno) {.}
(1.2,1) node (wsd) {.}
(0,0) node (sm2) {.}
;
\path[->,auto,mm] %arrows; have to use this instead of tikzar,
% for some reason
(pgm) edge[swap, bend right=15] node {} (o)
(pgm) edge[swap, bend right=25] node {} (wno)
(pgm) edge node {} (wsbo)
(pgm) edge[bend left=25] node {} (wsd)
(pgm) edge[bend left=15] node {WS(LB-)} (wsc)
(o.240) edge[swap, bend right=35, in=210, looseness=1.4] node {\kappa^*} (sm2)
(o) edge[swap] node {\varepsilon^*} (wno)
(wsbo) edge node {h^*} (wno)
(wsbo) edge[swap] node {p_1^*} (wsd)
(wsc) edge node {p_2^*} (wsd)
(wsc.300) edge[bend left=35, in=150, looseness=1.4] node {\nu^*} (sm2)
(wno) edge node {} (sm2)
(wsd) edge[swap] node {} (sm2)
;
\draw[tikzob,mm]
(-1.25,2.15) node[rotate=200,font={\Large}] {\Rightarrow} node[above]
{\varepsilon}
(-0.55,2.1) node[rotate=-20,font={\Large}] {\Rightarrow} node[above]
{h}
(0.55,2.1) node[rotate=200,font={\Large}] {\Rightarrow} node[above]
{WS(\xi)}
(1.25,2.15) node[rotate=-20,font={\Large}] {\Rightarrow} node[above]
{WS(\alpha)}
(0,1) node[font={\Large}] {=}
(-1.2,.5) node[rotate=45,font={\Large}] {=}
(1.2,.5) node[rotate=-45,font={\Large}] {=}
;
\end{tikzpicture}
\end{LTXexample}
\end{document}
\begin{tikzpicture}[x=30mm,y=25mm]
\draw[tikzob,mm] %objects
(0,3) node (pgm) {.}
(0,2) node (wsbo) {.}
(-2,2) node (o) {.}
(2,2) node (wsc) {.}
(-1.2,1) node (wno) {.}
(1.2,1) node (wsd) {.}
(0,0) node (sm2) {.}
;
\path[->,auto,mm] %arrows; have to use this instead of tikzar,
% for some reason
(pgm) edge[swap, bend right=15] node {} (o)
(pgm) edge[swap, bend right=25] node {} (wno)
(pgm) edge node {} (wsbo)
(pgm) edge[bend left=25] node {} (wsd)
(pgm) edge[bend left=15] node {WS(LB-)} (wsc)
(o.240) edge[swap, bend right=35, in=210, looseness=1.4] node {\kappa^*} (sm2)
(o) edge[swap] node {\varepsilon^*} (wno)
(wsbo) edge node {h^*} (wno)
(wsbo) edge[swap] node {p_1^*} (wsd)
(wsc) edge node {p_2^*} (wsd)
(wsc.300) edge[bend left=35, in=150, looseness=1.4] node {\nu^*} (sm2)
(wno) edge node {} (sm2)
(wsd) edge[swap] node {} (sm2)
;
\draw[tikzob,mm]
(-1.25,2.15) node[rotate=200,font={\Large}] {\Rightarrow} node[above]
{\varepsilon}
(-0.55,2.1) node[rotate=-20,font={\Large}] {\Rightarrow} node[above]
{h}
(0.55,2.1) node[rotate=200,font={\Large}] {\Rightarrow} node[above]
{WS(\xi)}
(1.25,2.15) node[rotate=-20,font={\Large}] {\Rightarrow} node[above]
{WS(\alpha)}
(0,1) node[font={\Large}] {=}
(-1.2,.5) node[rotate=45,font={\Large}] {=}
(1.2,.5) node[rotate=-45,font={\Large}] {=}
;
\end{tikzpicture}
\documentclass[10pt]{article}
\usepackage{demo}
\begin{document}
A cube.
\begin{LTXexample}[pos=t,preset=\centering,width=\textwidth]
\begin{tikzpicture}[x=20mm,y=20mm,z={(.707,-.707)}]
\draw[tikzob,mm] %objects
(0,0,0) node (a) {a}
(0,-1,0) node (b) {b}
(1,0,0) node (c) {c}
(1,-1,0) node (d) {d}
%(0,0,1) node (e) {e}
(0,-1,1) node (f) {f}
(1,0,1) node (g) {g}
(1,-1,1) node (h) {h}
;
\path[tikzar,mm] %arrows
(a) edge[swap] node {.} (b)
(a) edge node {.} (c)
(b) edge node {.} (d)
(c) edge[swap] node {.} (d)
%%
%%
%(e) edge node {.} (f)
%(e) edge[swap] node {.} (g)
(f) edge[swap] node {.} (h)
(g) edge node {.} (h)
%%
%%
%(a) edge node {.} (e)
(b) edge[swap] node {.} (f)
(c) edge node {.} (g)
(d) edge node {.} (h)
;
\draw (2.25,-.75) node {=};
\begin{scope}[shift={(3,0)}]
\draw[tikzob,mm] %objects
(0,0,0) node (a) {a}
(0,-1,0) node (b) {b}
(1,0,0) node (c) {c}
% (1,-1,0) node (d) {d}
(0,0,1) node (e) {e}
(0,-1,1) node (f) {f}
(1,0,1) node (g) {g}
(1,-1,1) node (h) {h}
;
\path[tikzar,mm] %arrows
(a) edge[swap] node {.} (b)
(a) edge node {.} (c)
% (b) edge node {.} (d)
% (c) edge[swap] node {.} (d)
%%
%%
(e) edge node {.} (f)
(e) edge[swap] node {.} (g)
(f) edge[swap] node {.} (h)
(g) edge node {.} (h)
%%
%%
(a) edge node {.} (e)
(b) edge[swap] node {.} (f)
(c) edge node {.} (g)
% (d) edge node {.} (h)
;
\end{scope}
\end{tikzpicture}
\end{LTXexample}
\end{document}
\begin{tikzpicture}[x=20mm,y=20mm,z={(.707,-.707)}]
\draw[tikzob,mm] %objects
(0,0,0) node (a) {a}
(0,-1,0) node (b) {b}
(1,0,0) node (c) {c}
(1,-1,0) node (d) {d}
%(0,0,1) node (e) {e}
(0,-1,1) node (f) {f}
(1,0,1) node (g) {g}
(1,-1,1) node (h) {h}
;
\path[tikzar,mm] %arrows
(a) edge[swap] node {.} (b)
(a) edge node {.} (c)
(b) edge node {.} (d)
(c) edge[swap] node {.} (d)
%%
%%
%(e) edge node {.} (f)
%(e) edge[swap] node {.} (g)
(f) edge[swap] node {.} (h)
(g) edge node {.} (h)
%%
%%
%(a) edge node {.} (e)
(b) edge[swap] node {.} (f)
(c) edge node {.} (g)
(d) edge node {.} (h)
;
\draw (2.25,-.75) node {=};
\begin{scope}[shift={(3,0)}]
\draw[tikzob,mm] %objects
(0,0,0) node (a) {a}
(0,-1,0) node (b) {b}
(1,0,0) node (c) {c}
% (1,-1,0) node (d) {d}
(0,0,1) node (e) {e}
(0,-1,1) node (f) {f}
(1,0,1) node (g) {g}
(1,-1,1) node (h) {h}
;
\path[tikzar,mm] %arrows
(a) edge[swap] node {.} (b)
(a) edge node {.} (c)
% (b) edge node {.} (d)
% (c) edge[swap] node {.} (d)
%%
%%
(e) edge node {.} (f)
(e) edge[swap] node {.} (g)
(f) edge[swap] node {.} (h)
(g) edge node {.} (h)
%%
%%
(a) edge node {.} (e)
(b) edge[swap] node {.} (f)
(c) edge node {.} (g)
% (d) edge node {.} (h)
;
\end{scope}
\end{tikzpicture}
\documentclass[10pt]{article}
\usepackage{demo}
\begin{document}
Another cube. Uses a macro to draw boundary without duplicating code,
and shift to draw second copy.
\begin{LTXexample}[pos=t,preset=\centering,width=\textwidth]
\[
\begin{tikzpicture}[x=.79mm,y=.9mm]
% define macro for boundary
\def\boundary{
\draw[tikzob,mm] %objects
(0,0) node (LL) {.}
(20,20) node (TL) {.}
(20,-20) node (BL) {.}
(50,20) node (TR) {.}
(50,-20) node (BR) {.}
(70,0) node (RR) {.}
%(30,0) node (CC) {.}
%(40,0) node (CC) {.}
;
\path[tikzar,mm] %arrows
(LL) edge node {a} (TL)
(TL) edge node {b} (TR)
(TR) edge node {c} (RR)
(LL) edge[swap] node {a'} (BL)
(BL) edge[swap] node {b'} (BR)
(BR) edge[swap] node {c'} (RR)
;
}
% draw first copy of boundary
\boundary
% add extra stuff
\draw[tikzob,mm]
(30,0) node (CC) {.}
;
\path[tikzar,mm] %arrows
(LL) edge node {w} (CC)
(CC) edge[swap] node {x} (TR)
(CC) edge node {y} (BR)
;
\draw (80,0) node {=};
% shift subdiagram
\begin{scope}[shift={(90,0)}]
% second copy of boundary
\boundary
% other stuff
\draw[tikzob,mm]
(40,0) node (CC) {.}
;
\path[tikzar,mm] %arrows
(TL) edge[swap] node {x'} (CC)
(BL) edge node {y'} (CC)
(CC) edge node {w'} (RR)
;
\end{scope}
\end{tikzpicture}
\]
\end{LTXexample}
\end{document}
\[
\begin{tikzpicture}[x=.79mm,y=.9mm]
% define macro for boundary
\def\boundary{
\draw[tikzob,mm] %objects
(0,0) node (LL) {.}
(20,20) node (TL) {.}
(20,-20) node (BL) {.}
(50,20) node (TR) {.}
(50,-20) node (BR) {.}
(70,0) node (RR) {.}
%(30,0) node (CC) {.}
%(40,0) node (CC) {.}
;
\path[tikzar,mm] %arrows
(LL) edge node {a} (TL)
(TL) edge node {b} (TR)
(TR) edge node {c} (RR)
(LL) edge[swap] node {a'} (BL)
(BL) edge[swap] node {b'} (BR)
(BR) edge[swap] node {c'} (RR)
;
}
% draw first copy of boundary
\boundary
% add extra stuff
\draw[tikzob,mm]
(30,0) node (CC) {.}
;
\path[tikzar,mm] %arrows
(LL) edge node {w} (CC)
(CC) edge[swap] node {x} (TR)
(CC) edge node {y} (BR)
;
\draw (80,0) node {=};
% shift subdiagram
\begin{scope}[shift={(90,0)}]
% second copy of boundary
\boundary
% other stuff
\draw[tikzob,mm]
(40,0) node (CC) {.}
;
\path[tikzar,mm] %arrows
(TL) edge[swap] node {x'} (CC)
(BL) edge node {y'} (CC)
(CC) edge node {w'} (RR)
;
\end{scope}
\end{tikzpicture}
\]
%%
%% the block below is what you need to draw the diagrams
%% (and maybe you don't even need that much)
%% (it is already included in our gjotex files)
%%
%%
%% commutative diagrams with tikz
%%
\usepackage{tikz}
\usetikzlibrary{calc}
\usetikzlibrary{decorations.markings,decorations.pathmorphing}
\usetikzlibrary{arrows}
\usepackage{tikz-cd}
%\tikzset{/tikz/commutative diagrams/arrow style=math font} % matching arrowheads
\tikzset{/tikz/commutative diagrams/arrow style=tikz,>=stealth} %almost matching arrowheads; look better in pdf
\tikzset{mm/.style={execute at begin node=$\displaystyle, execute at end node=$}}
\tikzset{tikzob/.style={commutative diagrams/every diagram, every cell}}
\tikzset{tikzar/.style={commutative diagrams/.cd, every arrow, every label, font={\small}}}
\tikzset{tikzsquiggle/.style={decorate, decoration={
snake,
segment length=8pt,
amplitude=.9pt,post=lineto,
post length=2pt}}}
\tikzset{cross line/.style={preaction={draw=white, -, line width=6pt}}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%% the stuff below is just for setting up the demo files
%%
%%
%% latex code with syntax highlight
%%
\usepackage{xcolor}
\usepackage{showexpl}
\lstset{
language=[LaTeX]TeX,
breaklines=true,
basicstyle=\tt\scriptsize,
keywordstyle=\color{blue},
identifierstyle=\color{magenta},
commentstyle = \color{green!50!black}, % comment color
stringstyle = \color{DarkRed}, % string color
% backgroundcolor = \color{WhiteSmoke}, % backgroundcolor color
}
%%
%%
%%
%\newcounter{diagram}
%\newcommand{\info}[1]{\refstepcounter{diagram}\noindent\thediagram.\ #1}
%\newcommand{\showcode}[1]{#1\begin{lstlisting}#1\end{lstlisting}}
\usepackage{fouriernc} % Fourier fonts instead of Computer Modern
\usepackage[margin=1cm]{geometry}
\usepackage{multicol}
\pagestyle{empty}
\documentclass[10pt]{article}
\usepackage{demo}
\begin{document}
A demo.
\begin{LTXexample}[pos=t,preset=\centering,width=\textwidth]
% tikz code goes here
\end{LTXexample}
\end{document}
% tikz code goes here
\documentclass[10pt]{article}
\usepackage{demo}
\begin{document}
This example uses fancy squiggly arrows, and shows one arrow passing
over another.
\begin{LTXexample}[pos=t,preset=\centering,width=\textwidth]
\begin{tikzpicture}[x=20mm,y=18mm]
\draw[tikzob,mm]
(0,1) node (q) {[q]}
(0,-1) node (p) {[p]}
(1,0) node (qp) {[q]*[p]}
(2,1) node (C) {\mathcal{C}}
(2,-1) node (D) {\mathcal{D}}
(-1,0) node (x) {[0]} % extra vertex
;
\path[tikzar,mm]
(x) edge[bend right=10] (C)
(x) edge (q)
(x) edge (p)
(q) edge[tikzsquiggle] node[above=.8mm] {\omega} (C)
(p) edge[tikzsquiggle] node[below=.8mm] {\sigma} (D)
(qp) edge[tikzsquiggle] node {\delta} (D)
(q) edge[cross line] (qp)
(p) edge (qp)
(C) edge node {F} (D)
;
\end{tikzpicture}
\end{LTXexample}
\end{document}
\begin{tikzpicture}[x=20mm,y=18mm]
\draw[tikzob,mm]
(0,1) node (q) {[q]}
(0,-1) node (p) {[p]}
(1,0) node (qp) {[q]*[p]}
(2,1) node (C) {\mathcal{C}}
(2,-1) node (D) {\mathcal{D}}
(-1,0) node (x) {[0]} % extra vertex
;
\path[tikzar,mm]
(x) edge[bend right=10] (C)
(x) edge (q)
(x) edge (p)
(q) edge[tikzsquiggle] node[above=.8mm] {\omega} (C)
(p) edge[tikzsquiggle] node[below=.8mm] {\sigma} (D)
(qp) edge[tikzsquiggle] node {\delta} (D)
(q) edge[cross line] (qp)
(p) edge (qp)
(C) edge node {F} (D)
;
\end{tikzpicture}
\documentclass[10pt]{article}
\usepackage{demo}
\begin{document}
Ice cream cone condition.
\begin{LTXexample}[pos=t,preset=\centering,width=\textwidth]
\begin{tikzpicture}[x=35mm,y=25mm,baseline={(0,16mm)}]
\draw[tikzob,mm] %objects
(0,1) node (sax) {s.(a,x)}
(1,1) node (tax) {t.(a,x)}
(.5,0) node (by) {(b,y)};
\path[tikzar,mm] %arrows
(sax) edge[bend left=25] node {q.1} (tax)
(sax) edge[bend right=25,swap] node {p.1} (tax)
(sax) edge[swap] node {(\alpha,\phi)} (by)
(tax) edge node {(\beta,\psi)} (by);
\draw[tikzob,mm]
(.5,.5) node[rotate=35,font=\Large] {\Rightarrow}
(.5,1) node[rotate=90,font=\Large] {\Rightarrow}
node[right] {\Theta};
\end{tikzpicture}
\ =\
\begin{tikzpicture}[x=35mm,y=25mm,baseline={(0,16mm)}]
\draw[tikzob,mm] %objects
(0,1) node (sax) {s.(a,x)}
(1,1) node (tax) {t.(a,x)}
(.5,0) node (by) {(b,y)};
\path[tikzar,mm] %arrows
(sax) edge[bend left=25] node {q.1} (tax)
(sax) edge[swap] node {(\alpha,\phi)} (by)
(tax) edge node {(\beta,\psi)} (by);
\draw[tikzob,mm]
(.5,.65) node[rotate=35,font=\Large] {\Rightarrow};
\end{tikzpicture}
\end{LTXexample}
\end{document}
\begin{tikzpicture}[x=35mm,y=25mm,baseline={(0,16mm)}]
\draw[tikzob,mm] %objects
(0,1) node (sax) {s.(a,x)}
(1,1) node (tax) {t.(a,x)}
(.5,0) node (by) {(b,y)};
\path[tikzar,mm] %arrows
(sax) edge[bend left=25] node {q.1} (tax)
(sax) edge[bend right=25,swap] node {p.1} (tax)
(sax) edge[swap] node {(\alpha,\phi)} (by)
(tax) edge node {(\beta,\psi)} (by);
\draw[tikzob,mm]
(.5,.5) node[rotate=35,font=\Large] {\Rightarrow}
(.5,1) node[rotate=90,font=\Large] {\Rightarrow}
node[right] {\Theta};
\end{tikzpicture}
\ =\
\begin{tikzpicture}[x=35mm,y=25mm,baseline={(0,16mm)}]
\draw[tikzob,mm] %objects
(0,1) node (sax) {s.(a,x)}
(1,1) node (tax) {t.(a,x)}
(.5,0) node (by) {(b,y)};
\path[tikzar,mm] %arrows
(sax) edge[bend left=25] node {q.1} (tax)
(sax) edge[swap] node {(\alpha,\phi)} (by)
(tax) edge node {(\beta,\psi)} (by);
\draw[tikzob,mm]
(.5,.65) node[rotate=35,font=\Large] {\Rightarrow};
\end{tikzpicture}
\documentclass[10pt,legalpaper]{article}
\usepackage{demo}
\begin{document}
\newcommand{\cC}{\mathcal{C}}
\newcommand{\id}{\mathrm{id}}
\begin{LTXexample}[pos=t,preset=\centering,width=\textwidth]
A \textit{permutative Gray-monoid} $\cC$ consists of a Gray-monoid
$(\cC, \oplus, e)$ together with a 2-natural isomorphism,
\[
\begin{tikzpicture}[x=1mm,y=1mm]
\draw[tikzob,mm] %objects
(0,0) node (00) {\cC \otimes \cC}
(25,0) node (10) {\cC \otimes \cC}
(12.5,-10) node (01) {\cC}
;
\path[tikzar,mm] %arrows
(00) edge node {\tau} (10)
(10) edge node {\oplus} (01)
(00) edge[swap] node {\oplus} (01)
;
\draw[tikzob,mm]
(12.5,-4) node[rotate=40] {\Rightarrow} node[right] {\beta}
;
\end{tikzpicture}
\]
where $\tau \colon \cC \otimes \cC \to \cC \otimes \cC$ is the symmetry
isomorphism in $2Cat$ for the Gray tensor product, such that the
following axioms hold.
\end{LTXexample}
\ \\
\noindent Axioms on the next page.
\begin{LTXexample}[pos=t,preset=\centering,width=\textwidth]
\begin{itemize}
\item The following pasting diagram is equal to the identity
2-natural transformation for the 2-functor $\oplus$.
\[
\begin{tikzpicture}[x=1mm,y=1mm]
\draw[tikzob,mm] %objects
(0,0) node (00) {\cC \otimes \cC}
(25,0) node (10) {\cC \otimes \cC}
(50,0) node (20) {\cC \otimes \cC}
(25,-15) node (11) {\cC}
;
\path[tikzar,mm] %arrows
(00) edge node{\tau} (10)
(10) edge node{\tau} (20)
(00) edge[swap] node{\oplus} (11)
(10) edge[swap] node{\oplus} (11)
(20) edge node{\oplus} (11)
(00) edge[bend left] node{\id} (20)
;
\draw[tikzob,mm,font=\small] %objects
(14.5,-4) node[rotate=40] {\Rightarrow} node[right] { \beta}
(35.5,-4) node {\Rightarrow} node[right] { \beta}
;
\end{tikzpicture}
\]
\item The following equality of pasting diagrams holds where we have
abbreviated the tensor product to concatenation when labeling 1-
or 2-cells.
\[
\begin{tikzpicture}[x=.95mm,y=1mm]
\draw[tikzob,mm] %objects
(3,-10) node (00) {\cC^{\otimes 3}}
(18,0) node (10) {\cC^{\otimes 3}}
(36,0) node (20) {\cC^{\otimes 3}}
(51,-10) node (30) {\cC^{\otimes 2}}