1

I would like something exactly like Categorical product in tikz?

but with the arrows turned in the opposite direction. I'm completely lost as I've never drawn a diagram like these before in LaTeX though I imagine the modifications needed are rather minor to flip the arrows.

Any help appreciated!

  • 1
    In the first solution in the question you link change -> to <- to reverse the direction of the arrow. – Andrew Feb 9 '18 at 6:52
2

As options of the \ar (alias of \arrow) macro, you find u = up, d = down, l = left and r =right.

To change the direction of an arrow, it is enough to invert those options and position the \ar macro at the new starting point.

With swap (which makes the label be placed on the right side of the arrow, relative to its direction, see the package documentation, p. 5), you can indicate where to put the labels.

\documentclass{article}
\usepackage{tikz-cd}

\begin{document}
    Original:   
    \[
    \begin{tikzcd}[row sep=huge]
        & S\ar[dl,"f_{x}",swap,sloped] \ar[dr,"f_{y}",sloped] \ar[d,dashed,"{(f_{x},f_{y})}" description] & \\
        X & X\times Y\ar[l,"\pi_{X}"] \ar[r,"\pi_{Y}",swap] & Y
    \end{tikzcd}
    \]

    With all arrows flipped:
    \[
    \begin{tikzcd}[row sep=huge]
        & S  & \\
        X\ar[ur,"f_{x}",sloped] \ar[r,"\pi_{X}", swap] & X\times Y \ar[u,dashed,"{(f_{x},f_{y})}" description] & Y \ar[ul,"f_{y}", swap,sloped] \ar[l,"\pi_{Y}"]
    \end{tikzcd}
    \]
\end{document}

enter image description here

  • @Squirtle See my edit for further details. – CarLaTeX Feb 9 '18 at 7:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.