TeX - LaTeX Asked on November 1, 2021
I am using to path
in order to have a better control of an arrow in a tikzcd
diagram. However, I am having trouble to placement the label.
With this code
documentclass{article}
usepackage{tikz-cd}
begin{document}
begin{tikzcd}[labels=description, column sep=3cm]
Aarrow["a+b",sloped,rounded corners,
to path={
-| ([yshift=-1.5cm,xshift=-.7cm]tikztostart.west)
-| ([xshift=.7cm]tikztotarget.east)tikztonodes
-- (tikztotarget)} ]{r}
& B \ C & D
end{tikzcd}
end{document}
Moving the tikztonode
instruction to the first segment:
documentclass{article}
usepackage{tikz-cd}
begin{document}
begin{tikzcd}[labels=description, column sep=3cm]
Aarrow["a+b",sloped,rounded corners,
to path={
-| ([yshift=-1.5cm,xshift=-.7cm]tikztostart.west)tikztonodes
-| ([xshift=.7cm]tikztotarget.east)
-- (tikztotarget)} ]{r}
& B \ C & D
end{tikzcd}
end{document}
I get this
Finally, in the last segment:
documentclass{article}
usepackage{tikz-cd}
begin{document}
begin{tikzcd}[labels=description, column sep=3cm]
Aarrow["a+b",sloped,rounded corners,
to path={
-| ([yshift=-1.5cm,xshift=-.7cm]tikztostart.west)
-| ([xshift=.7cm]tikztotarget.east)
-- (tikztotarget)tikztonodes} ]{r}
& B \ C & D
end{tikzcd}
end{document}
I get this
How do I make it appear in the long horizontal segment at the bottom?
By default, nodes have the option pos
initialized implicitly. It is enough here to initialize to [pos=0.25]
.
documentclass{article}
usepackage{tikz-cd}
begin{document}
begin{tikzcd}[labels=description, column sep=3cm]
Aarrow["a+b",rounded corners,
to path={[pos=0.25]
-| ([yshift=-1.5cm,xshift=-.7cm]tikztostart.west)
-| ([xshift=.7cm]tikztotarget.east)tikztonodes
-- (tikztotarget)} ]{r}
& B \ C & D
end{tikzcd}
end{document}
documentclass[border=5mm]{standalone}
usepackage{tikz-cd}
begin{document}
begin{tikzcd}[labels=description, column sep=3cm]
Aarrow["a+b",rounded corners,
to path={
-| ([yshift=-1.5cm,xshift=-.7cm]tikztostart.west)
-- ([yshift=-1.5cm,xshift=.7cm]tikztotarget.east)tikztonodes
|- (tikztotarget)} ]{r}
& B \ C & D
end{tikzcd}
end{document}
Answered by AndréC on November 1, 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