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

\endinput
%    \end{macrocode}
% \end{macro}
% \changes{v0.1}{2011/08/03}{Started project}
% \changes{v1.0}{2012/03/28}{First public version}
% \PrintChanges
% \PrintIndex