2

With this code

\begin{tabular}{cc}
            \begin{tikzcd}
                & B \arrow{dr}{g} \\
                A \arrow{ur}{f} \arrow{rr}{h} && C
            \end{tikzcd} &
            \begin{tikzcd}
                & \text{Hom}(B,G) \arrow{dl}{\widetilde f}\\
                \text{Hom}(A,G) && \text{Hom}(C,G) \arrow{ll}{\widetilde h} \arrow{ul}{\widetilde g} 
            \end{tikzcd}
        \end{tabular}

I obtain the following diagrams

enter image description here

As you can find, the labels of the second diagram have been "reflected" with respect to the given arrows. I would like to remedy this, however, I don't know how to do so.

Thanks in advance for your help.

PS: I would like to give a working sample of code, but I don't know which packages are required for this to compile.

0

1 Answer 1

1

There are many ways you can swap labels. Here are three of them:

  1. You can swap the labels with every arrow/.append style={swap}.
  2. You can swap individual labels by adding [swap] to the arrows.
  3. If you use the quotes syntax, swapping the labels is as simple as adding a prime.

Example codes:

\documentclass{article}
\usepackage{tikz-cd}
\usepackage{amsmath}
\begin{document}
%
\begin{figure}[htb]
\centering\begin{tabular}{cc}
            \begin{tikzcd}
                & B \arrow{dr}{g} \\
                A \arrow{ur}{f} \arrow{rr}{h} && C
            \end{tikzcd} &
            \begin{tikzcd}[every arrow/.append style={swap}]
                & \text{Hom}(B,G) \arrow{dl}{\widetilde f}\\
                \text{Hom}(A,G) && \text{Hom}(C,G) \arrow{ll}{\widetilde h} \arrow{ul}{\widetilde g} 
            \end{tikzcd}
        \end{tabular}
\caption{All labels swapped at once with the key \texttt{every arrow/.append
style=\{swap\}}.}       
\end{figure}
%
\begin{figure}[htb]
\centering\begin{tabular}{cc}
            \begin{tikzcd}
                & B \arrow{dr}{g} \\
                A \arrow{ur}{f} \arrow{rr}{h} && C
            \end{tikzcd} &
            \begin{tikzcd}
                & \text{Hom}(B,G) \arrow[swap]{dl}{\widetilde f}\\
                \text{Hom}(A,G) && \text{Hom}(C,G) \arrow[swap]{ll}{\widetilde h} \arrow[swap]{ul}{\widetilde g} 
            \end{tikzcd}
        \end{tabular}
\caption{Individual labels swapped by adding \texttt{[swap]} to the arrows.}       
\end{figure}
%
\begin{figure}[htb]
\centering\begin{tabular}{cc}
            \begin{tikzcd}
                & B \arrow{dr}{g} \\
                A \arrow{ur}{f} \arrow{rr}{h} && C
            \end{tikzcd} &
            \begin{tikzcd}
                & \text{Hom}(B,G) \arrow[dl,"\widetilde f"']\\
                \text{Hom}(A,G) && \text{Hom}(C,G) 
                \arrow[ll,"\widetilde h"'] 
                \arrow[ul,"\widetilde g"']
            \end{tikzcd}
        \end{tabular}
\caption{Labels can be swapped with the \texttt{quotes} syntax by adding a
prime.}       
\end{figure}
\end{document}

enter image description here

3
  • Sorry, I didn't notice that you edited your answer a quite ago. This answer is satisfactory, thanks.
    – Akerbeltz
    Nov 9, 2019 at 23:36
  • @Akerbeltz Yes, I first misread the question, sorry.
    – user194703
    Nov 9, 2019 at 23:37
  • Actually no, your answer was good enough, but afterwards I had the need to do the reflections manually. Good that you actually saw that possibility coming.
    – Akerbeltz
    Nov 10, 2019 at 0:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .