2

Can anybody tell me how to draw a diagram from A to B with an uparrow and a downarrow? Thanks.

ksj03
  • 245

1 Answers1

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}

enter image description here

Some points to notice:

  1. Left and right are with respect to an imaginary travel from the source to the target of the arrow;

  2. shift right means move the arrow towards the right (as determined by the rule above;

  3. the label is placed by default on the left side, but swap orders 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

enter image description here

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