Linebreak inside label - tikzcd package











up vote
5
down vote

favorite
1












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



enter image description here



instead. How to solve this?










share|improve this question




























    up vote
    5
    down vote

    favorite
    1












    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



    enter image description here



    instead. How to solve this?










    share|improve this question


























      up vote
      5
      down vote

      favorite
      1









      up vote
      5
      down vote

      favorite
      1






      1





      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



      enter image description here



      instead. How to solve this?










      share|improve this question















      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



      enter image description here



      instead. How to solve this?







      tikz-pgf tikz-cd






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 29 at 12:48









      Phelype Oleinik

      21.3k54380




      21.3k54380










      asked Nov 29 at 12:47









      Soap

      1554




      1554






















          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}


          enter image description here



          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



          enter image description here






          share|improve this answer




























            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}


            enter image description here






            share|improve this answer




























              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}


              enter image description here






              share|improve this answer




























                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



                enter image description here



                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.



                enter image description here



                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}





                share|improve this answer























                  Your Answer








                  StackExchange.ready(function() {
                  var channelOptions = {
                  tags: "".split(" "),
                  id: "85"
                  };
                  initTagRenderer("".split(" "), "".split(" "), channelOptions);

                  StackExchange.using("externalEditor", function() {
                  // Have to fire editor after snippets, if snippets enabled
                  if (StackExchange.settings.snippets.snippetsEnabled) {
                  StackExchange.using("snippets", function() {
                  createEditor();
                  });
                  }
                  else {
                  createEditor();
                  }
                  });

                  function createEditor() {
                  StackExchange.prepareEditor({
                  heartbeatType: 'answer',
                  convertImagesToLinks: false,
                  noModals: true,
                  showLowRepImageUploadWarning: true,
                  reputationToPostImages: null,
                  bindNavPrevention: true,
                  postfix: "",
                  imageUploader: {
                  brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
                  contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
                  allowUrls: true
                  },
                  onDemand: true,
                  discardSelector: ".discard-answer"
                  ,immediatelyShowMarkdownHelp:true
                  });


                  }
                  });














                  draft saved

                  draft discarded


















                  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

























                  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}


                  enter image description here



                  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



                  enter image description here






                  share|improve this answer

























                    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}


                    enter image description here



                    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



                    enter image description here






                    share|improve this answer























                      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}


                      enter image description here



                      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



                      enter image description here






                      share|improve this answer












                      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}


                      enter image description here



                      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



                      enter image description here







                      share|improve this answer












                      share|improve this answer



                      share|improve this answer










                      answered Nov 29 at 16:35









                      egreg

                      704k8618763155




                      704k8618763155






















                          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}


                          enter image description here






                          share|improve this answer

























                            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}


                            enter image description here






                            share|improve this answer























                              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}


                              enter image description here






                              share|improve this answer












                              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}


                              enter image description here







                              share|improve this answer












                              share|improve this answer



                              share|improve this answer










                              answered Nov 29 at 13:32









                              Herbert

                              267k23407716




                              267k23407716






















                                  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}


                                  enter image description here






                                  share|improve this answer

























                                    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}


                                    enter image description here






                                    share|improve this answer























                                      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}


                                      enter image description here






                                      share|improve this answer












                                      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}


                                      enter image description here







                                      share|improve this answer












                                      share|improve this answer



                                      share|improve this answer










                                      answered Nov 29 at 15:55









                                      marmot

                                      82.9k493177




                                      82.9k493177






















                                          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



                                          enter image description here



                                          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.



                                          enter image description here



                                          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}





                                          share|improve this answer



























                                            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



                                            enter image description here



                                            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.



                                            enter image description here



                                            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}





                                            share|improve this answer

























                                              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



                                              enter image description here



                                              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.



                                              enter image description here



                                              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}





                                              share|improve this answer














                                              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



                                              enter image description here



                                              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.



                                              enter image description here



                                              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}






                                              share|improve this answer














                                              share|improve this answer



                                              share|improve this answer








                                              edited Nov 30 at 21:21

























                                              answered Nov 29 at 13:14









                                              Sebastiano

                                              8,59841756




                                              8,59841756






























                                                  draft saved

                                                  draft discarded




















































                                                  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.




                                                  draft saved


                                                  draft discarded














                                                  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





















































                                                  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







                                                  Popular posts from this blog

                                                  Quarter-circle Tiles

                                                  build a pushdown automaton that recognizes the reverse language of a given pushdown automaton?

                                                  Mont Emei