| 1 |
% \iffalse meta-coment: |
| 2 |
% |
| 3 |
% The tikzpfeile package. |
| 4 |
% |
| 5 |
% \fi |
| 6 |
% |
| 7 |
% ^^A Driver stuff: |
| 8 |
% \iffalse not to be used in package .... |
| 9 |
%<*driver> |
| 10 |
\documentclass[a4paper]{ltxdoc} |
| 11 |
\usepackage{ifxetex} |
| 12 |
\usepackage{doc} |
| 13 |
\ifxetex |
| 14 |
\usepackage[no-math]{fontspec} |
| 15 |
\usepackage{polyglossia} |
| 16 |
\setmainfont[Mapping=tex-text,Numbers=OldStyle,Ligatures=Rare]{Linux Libertine O} |
| 17 |
\setsansfont[Mapping=tex-text,Numbers=OldStyle,Ligatures=Rare]{Linux Biolinum O} |
| 18 |
\setdefaultlanguage{english} |
| 19 |
\else |
| 20 |
\usepackage[utf8]{inputenc} |
| 21 |
\usepackage[T1]{fontenc} |
| 22 |
\usepackage[english]{babel} |
| 23 |
\fi |
| 24 |
\EnableCrossrefs |
| 25 |
\CodelineIndex |
| 26 |
\RecordChanges |
| 27 |
\usepackage{hyperref} |
| 28 |
\usepackage{tikzpfeile} |
| 29 |
\begin{document} |
| 30 |
\DocInput{tikzpfeile.dtx} |
| 31 |
\end{document} |
| 32 |
%</driver> |
| 33 |
% \fi |
| 34 |
% |
| 35 |
% \iffalse package preamble |
| 36 |
\NeedsTeXFormat{LaTeX2e} |
| 37 |
\ProvidesPackage{tikzpfeile}[2012/03/28 v1.0 A LaTeX package for drawing arrows using PGF/TikZ] |
| 38 |
% \fi |
| 39 |
% |
| 40 |
% \MakeShortVerb{\"} |
| 41 |
% |
| 42 |
% \newcommand{\tpf}{\texttt{tikzpfeile}} |
| 43 |
% \newcommand{\pgftikz}{\texttt{PGF/TikZ}} |
| 44 |
% \newenvironment{syntax}{\medskip\hspace*{1em}}{\par\medskip} |
| 45 |
% |
| 46 |
% \GetFileInfo{tikzpfeile.sty} |
| 47 |
% |
| 48 |
% \title{The \tpf{} Package} |
| 49 |
% \author{Jonathan Zachhuber\thanks{\url{[email protected]}} \and Michael Fütterer\thanks{\url{[email protected]}}} |
| 50 |
% \date{Version \fileversion, \filedate} |
| 51 |
% |
| 52 |
% \maketitle |
| 53 |
% |
| 54 |
% \begin{abstract} |
| 55 |
% This package defines commands for drawing arrows using \pgftikz{} which should be used instead of the regular \LaTeX{} arrows. |
| 56 |
% \end{abstract} |
| 57 |
% |
| 58 |
% \section{Introduction} |
| 59 |
% |
| 60 |
% In mathematical texts that contain commutative diagrams created with \pgftikz{}, it might be disturbing that regular arrows (such as "\rightarrow": $\rightarrow$) and the \pgftikz{} arrows in the diagrams have different heads. This package defines commands that draw arrows using \pgftikz{}. Using these instead of the regular arrows makes your document look more consistent. Moreover, using \pgftikz{}, a lot more different arrow types can be drawn. |
| 61 |
% |
| 62 |
% \section{Arrow commands} |
| 63 |
% |
| 64 |
% This package provides the following commands for drawing arrows: |
| 65 |
% |
| 66 |
% \medskip |
| 67 |
% |
| 68 |
% \begin{tabular}{l l} |
| 69 |
% "\ra"&\ra\\ |
| 70 |
% "\la"&\la\\ |
| 71 |
% "\mapsto"&\mapsto\\ |
| 72 |
% "\lmapsto"&\lmapsto\\ |
| 73 |
% "\inj"&\inj\\ |
| 74 |
% "\linj"&\linj\\ |
| 75 |
% "\surj"&\surj\\ |
| 76 |
% "\lsurj"&\lsurj\\ |
| 77 |
% "\isom"&\isom\\ |
| 78 |
% "\lisom"&\lisom\\ |
| 79 |
% "\lra"&\lra\\ |
| 80 |
% "\ppf"&\ppf\\ |
| 81 |
% "\lppf"&\lppf\\ |
| 82 |
% "\smapsto"&\smapsto\\ |
| 83 |
% "\lsmapsto"&\lsmapsto\\ |
| 84 |
% "\oldmapsto"&$\oldmapsto$ |
| 85 |
% \end{tabular} |
| 86 |
% |
| 87 |
% \medskip |
| 88 |
% |
| 89 |
% \noindent By giving an optional argument, the arrows can be labeled. This does not work for the "\isom" and "\lisom" arrows. |
| 90 |
% |
| 91 |
% \medskip |
| 92 |
% |
| 93 |
% \begin{tabular}{l l} |
| 94 |
% "\ra[$\psi$]"&\ra[$\psi$]\\ |
| 95 |
% "\inj[$\iota$]"&\inj[$\iota$]\\ |
| 96 |
% "\surj[$\pi$]"&\surj[$\pi$]\\ |
| 97 |
% "\lra[$\tau$]"&\lra[$\tau$]\\ |
| 98 |
% "\ppf[$f$]"&\ppf[$f$]\\ |
| 99 |
% \end{tabular} |
| 100 |
% |
| 101 |
% \section{Package options} |
| 102 |
% |
| 103 |
% The package recognizes one option, "length". Usually, the arrows are $1\mathrm{cm}$ long. This length is scaled by the value given by the "length" option. Its default value is, of course, $1$. |
| 104 |
% |
| 105 |
% \section{Implementation} |
| 106 |
% |
| 107 |
% Of course, we need the "tikz" package with the "arrows" library. For the length option we need "kvoptions". |
| 108 |
% \begin{macrocode} |
| 109 |
\RequirePackage{tikz} |
| 110 |
\usetikzlibrary{arrows} |
| 111 |
\RequirePackage{kvoptions} |
| 112 |
% \end{macrocode} |
| 113 |
% Define the length option: |
| 114 |
% \begin{macrocode} |
| 115 |
\DeclareStringOption[1]{length} |
| 116 |
\DeclareLocalOptions{length} |
| 117 |
\ProcessKeyvalOptions* |
| 118 |
% \end{macrocode} |
| 119 |
% Now define the arrow commands using \pgftikz{}. |
| 120 |
% \begin{macro}{\smapsto} |
| 121 |
% \begin{macrocode} |
| 122 |
\newcommand*{\smapsto}{\raisebox{-1pt}{\tikz{% |
| 123 |
\draw[xscale=\tikzpfeile@length,thin,shorten >=3pt, |->] (0,0)% |
| 124 |
node{\hspace*{0pt}}% |
| 125 |
-- node{} (0.7,0);}}\penalty1000\relax} |
| 126 |
% \end{macrocode} |
| 127 |
% \end{macro}\begin{macro}{\lsmapsto} |
| 128 |
% \begin{macrocode} |
| 129 |
\newcommand*{\lsmapsto}{\raisebox{-1pt}{\tikz{% |
| 130 |
\draw[xscale=\tikzpfeile@length,thin,shorten >=3pt, <-|] (0,0)% |
| 131 |
node{\hspace*{0pt}}% |
| 132 |
-- node{} (0.7,0);}}\penalty1000\relax} |
| 133 |
% \end{macrocode} |
| 134 |
% \end{macro}\begin{macro}{\ra} |
| 135 |
% \begin{macrocode} |
| 136 |
\newcommand*{\ra}[1][]{\raisebox{-1pt}{\tikz{% |
| 137 |
\draw[xscale=\tikzpfeile@length,thin,shorten >=3pt, ->,font=\scriptsize] (0,0)% |
| 138 |
node{\hspace*{-2pt}} -- (0.5,0) node[above] {#1}% |
| 139 |
-- node{} (1,0);}}\penalty1000\relax} |
| 140 |
% \end{macrocode} |
| 141 |
% \end{macro}\begin{macro}{\la} |
| 142 |
% \begin{macrocode} |
| 143 |
\newcommand*{\la}[1][]{\raisebox{-1pt}{\tikz{% |
| 144 |
\draw[xscale=\tikzpfeile@length,thin,shorten >=3pt, <-,font=\scriptsize] (0,0)% |
| 145 |
node{\hspace*{-2pt}} -- (0.5,0) node[above] {#1}% |
| 146 |
-- node{} (1,0);}}\penalty1000\relax} |
| 147 |
% \end{macrocode} |
| 148 |
% \end{macro}\begin{macro}{\mapsto} |
| 149 |
% \end{macro}\begin{macro}{\oldmapsto} |
| 150 |
% We save the old "\mapsto" arrow in "\oldmapsto". |
| 151 |
% \begin{macrocode} |
| 152 |
\let\oldmapsto\mapsto |
| 153 |
\renewcommand*{\mapsto}{\raisebox{-1pt}{\tikz{% |
| 154 |
\draw[xscale=\tikzpfeile@length,thin,shorten >=3pt, |->] (0,0)% |
| 155 |
node{\hspace*{0pt}}% |
| 156 |
-- node{} (1,0);}}\penalty1000\relax} |
| 157 |
% \end{macrocode} |
| 158 |
% \end{macro}\begin{macro}{\lmapsto} |
| 159 |
% \begin{macrocode} |
| 160 |
\newcommand*{\lmapsto}{\raisebox{-1pt}{\tikz{% |
| 161 |
\draw[xscale=\tikzpfeile@length,thin,shorten >=3pt, <-|] (0,0)% |
| 162 |
node{\hspace*{0pt}}% |
| 163 |
-- node{} (1,0);}}\penalty1000\relax} |
| 164 |
% \end{macrocode} |
| 165 |
% \end{macro}\begin{macro}{\inj} |
| 166 |
% \begin{macrocode} |
| 167 |
\newcommand*{\inj}[1][]{\raisebox{-1pt}{\tikz{% |
| 168 |
\draw[xscale=\tikzpfeile@length,thin,shorten >=3pt, right hook->,% |
| 169 |
font=\scriptsize] (0,0)% |
| 170 |
node{\hspace*{0pt}} -- (0.5,0) node[above] {#1} --% |
| 171 |
node{} (1,0);}}\penalty1000\relax} |
| 172 |
% \end{macrocode} |
| 173 |
% \end{macro}\begin{macro}{\linj} |
| 174 |
% \begin{macrocode} |
| 175 |
\newcommand*{\linj}[1][]{\raisebox{-1pt}{\tikz{% |
| 176 |
\draw[xscale=\tikzpfeile@length,thin,shorten >=3pt, <-left hook,% |
| 177 |
font=\scriptsize] (0,0)% |
| 178 |
node{\hspace*{0pt}} -- (0.5,0) node[above] {#1} --% |
| 179 |
node{} (1,0);}}\penalty1000\relax} |
| 180 |
% \end{macrocode} |
| 181 |
% \end{macro}\begin{macro}{\surj} |
| 182 |
% \begin{macrocode} |
| 183 |
\newcommand*{\surj}[1][]{\raisebox{-1pt}{\tikz{% |
| 184 |
\draw[xscale=\tikzpfeile@length,thin,shorten >=3pt, ->>,font=\scriptsize] (0,0)% |
| 185 |
node{\hspace*{0pt}} -- (0.5,0) node[above] {#1}% |
| 186 |
-- node{} (1,0);}}\penalty1000\relax} |
| 187 |
% \end{macrocode} |
| 188 |
% \end{macro}\begin{macro}{\lsurj} |
| 189 |
% \begin{macrocode} |
| 190 |
\newcommand*{\lsurj}[1][]{\raisebox{-1pt}{\tikz{% |
| 191 |
\draw[xscale=\tikzpfeile@length,thin,shorten >=3pt, <<-,font=\scriptsize] (0,0)% |
| 192 |
node{\hspace*{0pt}} -- (0.5,0) node[above] {#1}% |
| 193 |
-- node{} (1,0);}}\penalty1000\relax} |
| 194 |
% \end{macrocode} |
| 195 |
% \end{macro}\begin{macro}{\isom} |
| 196 |
% \begin{macrocode} |
| 197 |
\newcommand*{\isom}{\raisebox{-1pt}{\tikz{% |
| 198 |
\draw[xscale=\tikzpfeile@length,thin,shorten >=3pt, ->] % |
| 199 |
(0,0) node{\hspace*{0pt}} -- node{} (1,0);% |
| 200 |
\draw[xscale=\tikzpfeile@length] (0.4,0.1) node {$\sim$};}}% |
| 201 |
\penalty1000\relax} |
| 202 |
% \end{macrocode} |
| 203 |
% \end{macro}\begin{macro}{\lisom} |
| 204 |
% \begin{macrocode} |
| 205 |
\newcommand*{\lisom}{\raisebox{-1pt}{\tikz{% |
| 206 |
\draw[xscale=\tikzpfeile@length,thin,shorten >=3pt, <-] % |
| 207 |
(0,0) node{\hspace*{0pt}} -- node{} (1,0);% |
| 208 |
\draw[xscale=\tikzpfeile@length] (0.4,0.1) node {$\sim$};}}% |
| 209 |
\penalty1000\relax} |
| 210 |
% \end{macrocode} |
| 211 |
% \end{macro}\begin{macro}{\lra} |
| 212 |
% \begin{macrocode} |
| 213 |
\newcommand*{\lra}[1][]{\raisebox{-1pt}{\tikz{% |
| 214 |
\draw[xscale=\tikzpfeile@length,thin,shorten >=3pt, <->,font=\scriptsize] (0,0) % |
| 215 |
node{\hspace*{-2pt}} -- (0.5,0) node[above] {#1} --% |
| 216 |
node{} (1,0);}}\penalty1000\relax} |
| 217 |
% \end{macrocode} |
| 218 |
% \end{macro}\begin{macro}{\ppf} |
| 219 |
% \begin{macrocode} |
| 220 |
\newcommand*{\ppf}[1][]{\raisebox{-1pt}{\tikz{% |
| 221 |
\draw[xscale=\tikzpfeile@length,densely dashed,thin,shorten >=3pt,% |
| 222 |
->,font=\scriptsize] (0,0) % |
| 223 |
node{\hspace*{0pt}} -- (0.5,0) node[above] {#1}% |
| 224 |
-- node{} (1,0);}}\penalty1000\relax} |
| 225 |
% \end{macrocode} |
| 226 |
% \end{macro}\begin{macro}{\lppf} |
| 227 |
% \begin{macrocode} |
| 228 |
\newcommand*{\lppf}[1][]{\raisebox{-1pt}{\tikz{% |
| 229 |
\draw[xscale=\tikzpfeile@length,densely dashed,thin,shorten >=3pt,% |
| 230 |
<-,font=\scriptsize] (0,0) % |
| 231 |
node{\hspace*{0pt}} -- (0.5,0) node[above] {#1}% |
| 232 |
-- node{} (1,0);}}\penalty1000\relax} |
| 233 |
|
| 234 |
\endinput |
| 235 |
% \end{macrocode} |
| 236 |
% \end{macro} |
| 237 |
% \changes{v0.1}{2011/08/03}{Started project} |
| 238 |
% \changes{v1.0}{2012/03/28}{First public version} |
| 239 |
% \PrintChanges |
| 240 |
% \PrintIndex |