Linebreak inside label - tikzcd package
up vote
5
down vote
favorite
I am using tikzcd.
I want to use line breaks within the label of the arrows. Naively, I thought that
begin{tikzcd}
A arrow[d, "label 1 \ label 2"] \
B
end{tikzcd}
would work. But it gives me

instead. How to solve this?
tikz-pgf tikz-cd
add a comment |
up vote
5
down vote
favorite
I am using tikzcd.
I want to use line breaks within the label of the arrows. Naively, I thought that
begin{tikzcd}
A arrow[d, "label 1 \ label 2"] \
B
end{tikzcd}
would work. But it gives me

instead. How to solve this?
tikz-pgf tikz-cd
add a comment |
up vote
5
down vote
favorite
up vote
5
down vote
favorite
I am using tikzcd.
I want to use line breaks within the label of the arrows. Naively, I thought that
begin{tikzcd}
A arrow[d, "label 1 \ label 2"] \
B
end{tikzcd}
would work. But it gives me

instead. How to solve this?
tikz-pgf tikz-cd
I am using tikzcd.
I want to use line breaks within the label of the arrows. Naively, I thought that
begin{tikzcd}
A arrow[d, "label 1 \ label 2"] \
B
end{tikzcd}
would work. But it gives me

instead. How to solve this?
tikz-pgf tikz-cd
tikz-pgf tikz-cd
edited 2 days ago
Phelype Oleinik
20.9k54380
20.9k54380
asked 2 days ago
Soap
1554
1554
add a comment |
add a comment |
4 Answers
4
active
oldest
votes
up vote
5
down vote
accepted
Use substack.
documentclass{article}
usepackage{amsmath}
usepackage{tikz-cd}
begin{document}
begin{tikzcd}[row sep=large]
A arrow[d, "substack{a \ a}"] & % good
A arrow[d,"a \ a" align=left] & % bad
A arrow[d,"shortstack{a\a}"] % ugly
\
B & B & B
end{tikzcd}
end{document}

If the labels are textual, use text inside substack. The same code as before, but with substack{text{a} \ text{a}} in the leftmost arrow yields

add a comment |
up vote
5
down vote
documentclass{book}
usepackage{tikz-cd,amsmath}
begin{document}
begin{tikzcd}[row sep=3cm]
A arrow[d, "shortstack{label 1\label 2}"] \
B
end{tikzcd}
end{document}

add a comment |
up vote
5
down vote
You only need to add align=left (or something of that sort).
documentclass{article}
usepackage{tikz-cd,amsmath}
begin{document}
begin{tikzcd}[row sep=3cm]
A arrow[d,"label1\ label2"align=left] \
B
end{tikzcd}
end{document}

add a comment |
up vote
3
down vote
From the pag. 13 of the guide of tikz-cd http://ctan.math.washington.edu/tex-archive/graphics/pgf/contrib/tikz-cd/tikz-cd-doc.pdf

I have used a matrix 2x1 (for example) to have two vertical labels. With the option row sep=...cm you can increase or decrease the lenght of the arrow.

documentclass[a4paper,12pt,oneside]{book}
usepackage{tikz-cd,amsmath}
begin{document}
begin{tikzcd}[row sep=2cm, ampersand replacement=&]
A arrow[d, "{begin{matrix} text{label1} \ text{label2} end{matrix}}
"] \
B
end{tikzcd}
end{document}
add a comment |
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
5
down vote
accepted
Use substack.
documentclass{article}
usepackage{amsmath}
usepackage{tikz-cd}
begin{document}
begin{tikzcd}[row sep=large]
A arrow[d, "substack{a \ a}"] & % good
A arrow[d,"a \ a" align=left] & % bad
A arrow[d,"shortstack{a\a}"] % ugly
\
B & B & B
end{tikzcd}
end{document}

If the labels are textual, use text inside substack. The same code as before, but with substack{text{a} \ text{a}} in the leftmost arrow yields

add a comment |
up vote
5
down vote
accepted
Use substack.
documentclass{article}
usepackage{amsmath}
usepackage{tikz-cd}
begin{document}
begin{tikzcd}[row sep=large]
A arrow[d, "substack{a \ a}"] & % good
A arrow[d,"a \ a" align=left] & % bad
A arrow[d,"shortstack{a\a}"] % ugly
\
B & B & B
end{tikzcd}
end{document}

If the labels are textual, use text inside substack. The same code as before, but with substack{text{a} \ text{a}} in the leftmost arrow yields

add a comment |
up vote
5
down vote
accepted
up vote
5
down vote
accepted
Use substack.
documentclass{article}
usepackage{amsmath}
usepackage{tikz-cd}
begin{document}
begin{tikzcd}[row sep=large]
A arrow[d, "substack{a \ a}"] & % good
A arrow[d,"a \ a" align=left] & % bad
A arrow[d,"shortstack{a\a}"] % ugly
\
B & B & B
end{tikzcd}
end{document}

If the labels are textual, use text inside substack. The same code as before, but with substack{text{a} \ text{a}} in the leftmost arrow yields

Use substack.
documentclass{article}
usepackage{amsmath}
usepackage{tikz-cd}
begin{document}
begin{tikzcd}[row sep=large]
A arrow[d, "substack{a \ a}"] & % good
A arrow[d,"a \ a" align=left] & % bad
A arrow[d,"shortstack{a\a}"] % ugly
\
B & B & B
end{tikzcd}
end{document}

If the labels are textual, use text inside substack. The same code as before, but with substack{text{a} \ text{a}} in the leftmost arrow yields

answered 2 days ago
egreg
701k8618693142
701k8618693142
add a comment |
add a comment |
up vote
5
down vote
documentclass{book}
usepackage{tikz-cd,amsmath}
begin{document}
begin{tikzcd}[row sep=3cm]
A arrow[d, "shortstack{label 1\label 2}"] \
B
end{tikzcd}
end{document}

add a comment |
up vote
5
down vote
documentclass{book}
usepackage{tikz-cd,amsmath}
begin{document}
begin{tikzcd}[row sep=3cm]
A arrow[d, "shortstack{label 1\label 2}"] \
B
end{tikzcd}
end{document}

add a comment |
up vote
5
down vote
up vote
5
down vote
documentclass{book}
usepackage{tikz-cd,amsmath}
begin{document}
begin{tikzcd}[row sep=3cm]
A arrow[d, "shortstack{label 1\label 2}"] \
B
end{tikzcd}
end{document}

documentclass{book}
usepackage{tikz-cd,amsmath}
begin{document}
begin{tikzcd}[row sep=3cm]
A arrow[d, "shortstack{label 1\label 2}"] \
B
end{tikzcd}
end{document}

answered 2 days ago
Herbert
266k23405714
266k23405714
add a comment |
add a comment |
up vote
5
down vote
You only need to add align=left (or something of that sort).
documentclass{article}
usepackage{tikz-cd,amsmath}
begin{document}
begin{tikzcd}[row sep=3cm]
A arrow[d,"label1\ label2"align=left] \
B
end{tikzcd}
end{document}

add a comment |
up vote
5
down vote
You only need to add align=left (or something of that sort).
documentclass{article}
usepackage{tikz-cd,amsmath}
begin{document}
begin{tikzcd}[row sep=3cm]
A arrow[d,"label1\ label2"align=left] \
B
end{tikzcd}
end{document}

add a comment |
up vote
5
down vote
up vote
5
down vote
You only need to add align=left (or something of that sort).
documentclass{article}
usepackage{tikz-cd,amsmath}
begin{document}
begin{tikzcd}[row sep=3cm]
A arrow[d,"label1\ label2"align=left] \
B
end{tikzcd}
end{document}

You only need to add align=left (or something of that sort).
documentclass{article}
usepackage{tikz-cd,amsmath}
begin{document}
begin{tikzcd}[row sep=3cm]
A arrow[d,"label1\ label2"align=left] \
B
end{tikzcd}
end{document}

answered 2 days ago
marmot
79.8k490169
79.8k490169
add a comment |
add a comment |
up vote
3
down vote
From the pag. 13 of the guide of tikz-cd http://ctan.math.washington.edu/tex-archive/graphics/pgf/contrib/tikz-cd/tikz-cd-doc.pdf

I have used a matrix 2x1 (for example) to have two vertical labels. With the option row sep=...cm you can increase or decrease the lenght of the arrow.

documentclass[a4paper,12pt,oneside]{book}
usepackage{tikz-cd,amsmath}
begin{document}
begin{tikzcd}[row sep=2cm, ampersand replacement=&]
A arrow[d, "{begin{matrix} text{label1} \ text{label2} end{matrix}}
"] \
B
end{tikzcd}
end{document}
add a comment |
up vote
3
down vote
From the pag. 13 of the guide of tikz-cd http://ctan.math.washington.edu/tex-archive/graphics/pgf/contrib/tikz-cd/tikz-cd-doc.pdf

I have used a matrix 2x1 (for example) to have two vertical labels. With the option row sep=...cm you can increase or decrease the lenght of the arrow.

documentclass[a4paper,12pt,oneside]{book}
usepackage{tikz-cd,amsmath}
begin{document}
begin{tikzcd}[row sep=2cm, ampersand replacement=&]
A arrow[d, "{begin{matrix} text{label1} \ text{label2} end{matrix}}
"] \
B
end{tikzcd}
end{document}
add a comment |
up vote
3
down vote
up vote
3
down vote
From the pag. 13 of the guide of tikz-cd http://ctan.math.washington.edu/tex-archive/graphics/pgf/contrib/tikz-cd/tikz-cd-doc.pdf

I have used a matrix 2x1 (for example) to have two vertical labels. With the option row sep=...cm you can increase or decrease the lenght of the arrow.

documentclass[a4paper,12pt,oneside]{book}
usepackage{tikz-cd,amsmath}
begin{document}
begin{tikzcd}[row sep=2cm, ampersand replacement=&]
A arrow[d, "{begin{matrix} text{label1} \ text{label2} end{matrix}}
"] \
B
end{tikzcd}
end{document}
From the pag. 13 of the guide of tikz-cd http://ctan.math.washington.edu/tex-archive/graphics/pgf/contrib/tikz-cd/tikz-cd-doc.pdf

I have used a matrix 2x1 (for example) to have two vertical labels. With the option row sep=...cm you can increase or decrease the lenght of the arrow.

documentclass[a4paper,12pt,oneside]{book}
usepackage{tikz-cd,amsmath}
begin{document}
begin{tikzcd}[row sep=2cm, ampersand replacement=&]
A arrow[d, "{begin{matrix} text{label1} \ text{label2} end{matrix}}
"] \
B
end{tikzcd}
end{document}
edited yesterday
answered 2 days ago
Sebastiano
8,51641756
8,51641756
add a comment |
add a comment |
Thanks for contributing an answer to TeX - LaTeX Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f462374%2flinebreak-inside-label-tikzcd-package%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown