latex-packages/src/math/mathfig.pysty

44 lines
1.3 KiB
Text

__HEADER__(Math figures with TikZ / pgfplots / xy)
% This is just a collection of the packages I use to typeset mathematical figures
% most commonly plots, commutative diagrams or geometry
\RequirePackage{pgfplots} % Plots
\pgfplotsset{compat=1.7}
\RequirePackage{tikz} % Plots / drawings
\usetikzlibrary{calc, intersections, through, quotes, angles, babel, positioning, snakes}
\RequirePackage{tikz-cd} %Commutative diagrams
\RequirePackage{xparse}
%%for small diagrams, similar to tikz-cd
\RequirePackage[all]{xy} % for small diagrams, e.g. arrows
%%% In older versions, you found
% \RequirePackage{xy}
% \xyoption{all}
% here, but this messes with the catcode of the @ sign (which no package should do!)
% so that further parts in this package would get broken
\newcommand\pushoutsymbol{\tikz[baseline=0.5,scale=0.2]{
\draw[-] (0,0) --(0,1) -- (1,1);
\draw (1,0) circle (1.5pt);}
}
\newcommand\pullbacksymbol{\tikz[baseline=0.5,scale=0.2]{
\draw[-] (0,0) --(1,0) -- (1,1);
\draw (0,1) circle (1.5pt);}
}
% This is used in a tikzcd
\NewDocumentCommand\pushout{ O{dr} }{
\arrow[phantom, pos=0.45]{#1}{\pushoutsymbol}
}
% This is used in a tikzcd
\NewDocumentCommand\pullback{ O{dr} }{
\arrow[phantom, pos=0.45]{#1}{\pullbacksymbol}
}