Linebreak inside label - tikzcd package












5














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





























    5














    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



























      5












      5








      5


      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 '18 at 12:48









      Phelype Oleinik

      21.4k54381




      21.4k54381










      asked Nov 29 '18 at 12:47









      SoapSoap

      1554




      1554






















          4 Answers
          4






          active

          oldest

          votes


















          5














          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





























            5














            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





























              5














              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





























                3














                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',
                  autoActivateHeartbeat: false,
                  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









                  5














                  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


























                    5














                    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
























                      5












                      5








                      5






                      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 '18 at 16:35









                      egregegreg

                      711k8618893173




                      711k8618893173























                          5














                          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


























                            5














                            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
























                              5












                              5








                              5






                              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 '18 at 13:32









                              HerbertHerbert

                              270k24408718




                              270k24408718























                                  5














                                  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


























                                    5














                                    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
























                                      5












                                      5








                                      5






                                      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 '18 at 15:55









                                      marmotmarmot

                                      89.8k4103194




                                      89.8k4103194























                                          3














                                          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




























                                            3














                                            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


























                                              3












                                              3








                                              3






                                              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 '18 at 21:21

























                                              answered Nov 29 '18 at 13:14









                                              SebastianoSebastiano

                                              9,27841756




                                              9,27841756






























                                                  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

                                                  Bundesstraße 106

                                                  Verónica Boquete

                                                  Ida-Boy-Ed-Garten