Can anybody tell me how to draw a diagram from A to B with an uparrow and a downarrow? Thanks.
Asked
Active
Viewed 385 times
1 Answers
1
Here's an example:
\documentclass{article}
\usepackage{tikz-cd}
\begin{document}
\[
\begin{tikzcd}
A \arrow[shift right=.3em,swap]{d}{f} \\ % arrow down, labeled f
B \arrow[shift right=.3em,swap]{u}{g} % arrow up, labeled g
\end{tikzcd}
\]
\end{document}

Some points to notice:
Left and right are with respect to an imaginary travel from the source to the target of the arrow;
shift rightmeans move the arrow towards the right (as determined by the rule above;the label is placed by default on the left side, but
swaporders to change side.
The alternative format
\begin{tikzcd}
A \arrow[shift left=.3em]{d}{f} \\ % arrow down, labeled f
B \arrow[shift left=.3em]{u}{g} % arrow up, labeled g
\end{tikzcd}
which produces

should visually explain what is meant by the rules above.
The direction indicators are d, u, l and r and combinations thereof.
egreg
- 1,121,712
-
Thanks very much. But when I try to use the package{tikz-cd}, an error appears, saying there is no room for a new \dimen. – ksj03 May 27 '14 at 11:16
-
@ksj03 That can happen; add
\usepackage{etex}just after the\documentclassline. See No room for a new\dimen– egreg May 27 '14 at 11:24 -
-