TeX - LaTeX Asked by jaia on September 28, 2021
I’ve just started using TikZ and need to create a simple triangle commutative diagram like this one.
The closest I’ve been able to get is this.
How do I get the h arrow to go from A2 to A3? Everything I’ve tried just causes errors.
Here’s my current code:
begin{tikzcd}[column sep=small]
A arrow{r}{i} arrow{rd}{g}
& A3 arrow{d}{h}
& A2
end{tikzcd}
A better syntax has evolved with time, which has several advantages due to improvements in TikZ and is now recommended.
documentclass{article}
usepackage{tikz-cd}
begin{document}
[
begin{tikzcd}
& A arrow[dr,"g"]
B arrow[ur,"f"] arrow[rr,"h"] && C
end{tikzcd}
]
[
begin{tikzcd}[row sep=2.5em]
& A arrow[dr,"g"]
B arrow[ur,"f"] arrow[rr,"h"] && C
end{tikzcd}
]
[
begin{tikzcd}[column sep=1.5em]
& A arrow[dr,"g"]
B arrow[ur,"f"] arrow[rr,"h"] && C
end{tikzcd}
]
end{document}
The basic idea for triangular diagrams is to consider more columns, in this case three; you may want to play with column sep
or row sep
in order to get better distances, as shown.
documentclass{article}
usepackage{tikz-cd}
begin{document}
[
begin{tikzcd}
& A arrow{dr}{g}
B arrow{ur}{f} arrow{rr}{h} && C
end{tikzcd}
]
[
begin{tikzcd}[row sep=2.5em]
& A arrow{dr}{g}
B arrow{ur}{f} arrow{rr}{h} && C
end{tikzcd}
]
[
begin{tikzcd}[column sep=1.5em]
& A arrow{dr}{g}
B arrow{ur}{f} arrow{rr}{h} && C
end{tikzcd}
]
end{document}
If you want to try this with QTikZ, you need a suitable template; create the text file tikz-cd-template.pgs
with
documentclass{article}
usepackage{tikz-cd}
begin{document}
<>
end{document}
Choose the template and then paste the part of the above code which is between begin{document}
and end{document}
in the input window for QTikZ. Here's a picture of the result.
If you have an old version of tikz-cd
(which might be the case on Ubuntu or other GNU/Linux boxes) it may be necessary to start the diagram with {}
:
[
begin{tikzcd}
{} & A arrow{dr}{g}
B arrow{ur}{f} arrow{rr}{h} && C
end{tikzcd}
]
Correct answer by egreg on September 28, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP