Tikz-dimline label position












4














MWE:



documentclass[tikz, border=1cm]{standalone}
usepackage{tikz-dimline}
begin{document}
begin{tikzpicture}[
plotmark/.style = {%
draw, fill=red, circle, inner sep=0pt, minimum size=4pt
}
]
coordinate (A) at (0,0);
coordinate (B) at (5,3);

draw (A)--(B);
dimline {(A)}{(B)}{label};

node[plotmark, label={above:$A$}] at (A) {};
node[plotmark, label={above:$B$}] at (B) {};
end{tikzpicture}
end{document}


enter image description here



Question: How do I position the label and its two arrow lines, to the other end of the gray lines?










share|improve this question



























    4














    MWE:



    documentclass[tikz, border=1cm]{standalone}
    usepackage{tikz-dimline}
    begin{document}
    begin{tikzpicture}[
    plotmark/.style = {%
    draw, fill=red, circle, inner sep=0pt, minimum size=4pt
    }
    ]
    coordinate (A) at (0,0);
    coordinate (B) at (5,3);

    draw (A)--(B);
    dimline {(A)}{(B)}{label};

    node[plotmark, label={above:$A$}] at (A) {};
    node[plotmark, label={above:$B$}] at (B) {};
    end{tikzpicture}
    end{document}


    enter image description here



    Question: How do I position the label and its two arrow lines, to the other end of the gray lines?










    share|improve this question

























      4












      4








      4


      0





      MWE:



      documentclass[tikz, border=1cm]{standalone}
      usepackage{tikz-dimline}
      begin{document}
      begin{tikzpicture}[
      plotmark/.style = {%
      draw, fill=red, circle, inner sep=0pt, minimum size=4pt
      }
      ]
      coordinate (A) at (0,0);
      coordinate (B) at (5,3);

      draw (A)--(B);
      dimline {(A)}{(B)}{label};

      node[plotmark, label={above:$A$}] at (A) {};
      node[plotmark, label={above:$B$}] at (B) {};
      end{tikzpicture}
      end{document}


      enter image description here



      Question: How do I position the label and its two arrow lines, to the other end of the gray lines?










      share|improve this question













      MWE:



      documentclass[tikz, border=1cm]{standalone}
      usepackage{tikz-dimline}
      begin{document}
      begin{tikzpicture}[
      plotmark/.style = {%
      draw, fill=red, circle, inner sep=0pt, minimum size=4pt
      }
      ]
      coordinate (A) at (0,0);
      coordinate (B) at (5,3);

      draw (A)--(B);
      dimline {(A)}{(B)}{label};

      node[plotmark, label={above:$A$}] at (A) {};
      node[plotmark, label={above:$B$}] at (B) {};
      end{tikzpicture}
      end{document}


      enter image description here



      Question: How do I position the label and its two arrow lines, to the other end of the gray lines?







      tikz-pgf






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 1 hour ago









      blackened

      1,449714




      1,449714






















          1 Answer
          1






          active

          oldest

          votes


















          4














          This is a pure calc alternative in case dimline doesn't allow you to do that. (I do not know what dimline does.) This is an updated answer in which I try to address your comments. It comes with a decoration indicate dimensions, which has one argument, the label. All distances and other parameters are stored in pgfkeys. Drawing the line plus all the dimension lines and perpendicular lines boils down to



           draw[postaction={indicate dimensions={label}}] (A)--(B);


          Here is the code



          documentclass[tikz, border=1cm]{standalone}
          usetikzlibrary{calc,decorations.pathreplacing}
          tikzset{dimlabel distance/.initial=5mm,
          vertical lines extend/.initial=5mm,
          vertical dim line/.style={gray,thin},
          dim arrow line/.style={latex-latex,thin},
          dim label/.style={},
          indicate dimensions/.style={decorate,decoration={
          show path construction,
          lineto code={
          draw[dim arrow line]
          ($ (tikzinputsegmentfirst)!pgfkeysvalueof{/tikz/dimlabel distance}!-90:(tikzinputsegmentlast) $) -- ($ (tikzinputsegmentlast)!pgfkeysvalueof{/tikz/dimlabel distance}!90:(tikzinputsegmentfirst) $)
          node[midway,sloped,fill=white,dim label]{#1};
          draw[vertical dim line] (tikzinputsegmentfirst) --
          ($ (tikzinputsegmentfirst)!pgfkeysvalueof{/tikz/vertical lines extend}!-90:(tikzinputsegmentlast) $)
          (tikzinputsegmentlast) --
          ($ (tikzinputsegmentlast)!pgfkeysvalueof{/tikz/vertical lines extend}!90:(tikzinputsegmentfirst) $);
          }}}}

          begin{document}
          begin{tikzpicture}[
          plotmark/.style = {%
          draw, fill=red, circle, inner sep=0pt, minimum size=4pt
          }
          ]
          coordinate (A) at (0,0);
          coordinate (B) at (5,3);

          draw[postaction={indicate dimensions={label}}] (A)--(B);

          node[plotmark, label={above:$A$}] at (A) {};
          node[plotmark, label={above:$B$}] at (B) {};
          end{tikzpicture}
          end{document}


          enter image description here



          Initially, both vertical lines extend and dimlabel distance are set to 5mm, such that the gray auxiliary lines terminate where the arrows end.






          share|improve this answer























          • How do I style the vertical lines and the arrow lines?
            – blackened
            16 mins ago






          • 1




            @blackened I added a more customizable version. It has a style for the arrows dim arrow line which you could modify to your needs as well as a style for the perpendicular lines and all dimensions are stored in pgfkeys.
            – marmot
            5 mins ago










          • Is your code extensible to cover angular dimensional representations?
            – blackened
            3 mins ago











          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%2f468143%2ftikz-dimline-label-position%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          4














          This is a pure calc alternative in case dimline doesn't allow you to do that. (I do not know what dimline does.) This is an updated answer in which I try to address your comments. It comes with a decoration indicate dimensions, which has one argument, the label. All distances and other parameters are stored in pgfkeys. Drawing the line plus all the dimension lines and perpendicular lines boils down to



           draw[postaction={indicate dimensions={label}}] (A)--(B);


          Here is the code



          documentclass[tikz, border=1cm]{standalone}
          usetikzlibrary{calc,decorations.pathreplacing}
          tikzset{dimlabel distance/.initial=5mm,
          vertical lines extend/.initial=5mm,
          vertical dim line/.style={gray,thin},
          dim arrow line/.style={latex-latex,thin},
          dim label/.style={},
          indicate dimensions/.style={decorate,decoration={
          show path construction,
          lineto code={
          draw[dim arrow line]
          ($ (tikzinputsegmentfirst)!pgfkeysvalueof{/tikz/dimlabel distance}!-90:(tikzinputsegmentlast) $) -- ($ (tikzinputsegmentlast)!pgfkeysvalueof{/tikz/dimlabel distance}!90:(tikzinputsegmentfirst) $)
          node[midway,sloped,fill=white,dim label]{#1};
          draw[vertical dim line] (tikzinputsegmentfirst) --
          ($ (tikzinputsegmentfirst)!pgfkeysvalueof{/tikz/vertical lines extend}!-90:(tikzinputsegmentlast) $)
          (tikzinputsegmentlast) --
          ($ (tikzinputsegmentlast)!pgfkeysvalueof{/tikz/vertical lines extend}!90:(tikzinputsegmentfirst) $);
          }}}}

          begin{document}
          begin{tikzpicture}[
          plotmark/.style = {%
          draw, fill=red, circle, inner sep=0pt, minimum size=4pt
          }
          ]
          coordinate (A) at (0,0);
          coordinate (B) at (5,3);

          draw[postaction={indicate dimensions={label}}] (A)--(B);

          node[plotmark, label={above:$A$}] at (A) {};
          node[plotmark, label={above:$B$}] at (B) {};
          end{tikzpicture}
          end{document}


          enter image description here



          Initially, both vertical lines extend and dimlabel distance are set to 5mm, such that the gray auxiliary lines terminate where the arrows end.






          share|improve this answer























          • How do I style the vertical lines and the arrow lines?
            – blackened
            16 mins ago






          • 1




            @blackened I added a more customizable version. It has a style for the arrows dim arrow line which you could modify to your needs as well as a style for the perpendicular lines and all dimensions are stored in pgfkeys.
            – marmot
            5 mins ago










          • Is your code extensible to cover angular dimensional representations?
            – blackened
            3 mins ago
















          4














          This is a pure calc alternative in case dimline doesn't allow you to do that. (I do not know what dimline does.) This is an updated answer in which I try to address your comments. It comes with a decoration indicate dimensions, which has one argument, the label. All distances and other parameters are stored in pgfkeys. Drawing the line plus all the dimension lines and perpendicular lines boils down to



           draw[postaction={indicate dimensions={label}}] (A)--(B);


          Here is the code



          documentclass[tikz, border=1cm]{standalone}
          usetikzlibrary{calc,decorations.pathreplacing}
          tikzset{dimlabel distance/.initial=5mm,
          vertical lines extend/.initial=5mm,
          vertical dim line/.style={gray,thin},
          dim arrow line/.style={latex-latex,thin},
          dim label/.style={},
          indicate dimensions/.style={decorate,decoration={
          show path construction,
          lineto code={
          draw[dim arrow line]
          ($ (tikzinputsegmentfirst)!pgfkeysvalueof{/tikz/dimlabel distance}!-90:(tikzinputsegmentlast) $) -- ($ (tikzinputsegmentlast)!pgfkeysvalueof{/tikz/dimlabel distance}!90:(tikzinputsegmentfirst) $)
          node[midway,sloped,fill=white,dim label]{#1};
          draw[vertical dim line] (tikzinputsegmentfirst) --
          ($ (tikzinputsegmentfirst)!pgfkeysvalueof{/tikz/vertical lines extend}!-90:(tikzinputsegmentlast) $)
          (tikzinputsegmentlast) --
          ($ (tikzinputsegmentlast)!pgfkeysvalueof{/tikz/vertical lines extend}!90:(tikzinputsegmentfirst) $);
          }}}}

          begin{document}
          begin{tikzpicture}[
          plotmark/.style = {%
          draw, fill=red, circle, inner sep=0pt, minimum size=4pt
          }
          ]
          coordinate (A) at (0,0);
          coordinate (B) at (5,3);

          draw[postaction={indicate dimensions={label}}] (A)--(B);

          node[plotmark, label={above:$A$}] at (A) {};
          node[plotmark, label={above:$B$}] at (B) {};
          end{tikzpicture}
          end{document}


          enter image description here



          Initially, both vertical lines extend and dimlabel distance are set to 5mm, such that the gray auxiliary lines terminate where the arrows end.






          share|improve this answer























          • How do I style the vertical lines and the arrow lines?
            – blackened
            16 mins ago






          • 1




            @blackened I added a more customizable version. It has a style for the arrows dim arrow line which you could modify to your needs as well as a style for the perpendicular lines and all dimensions are stored in pgfkeys.
            – marmot
            5 mins ago










          • Is your code extensible to cover angular dimensional representations?
            – blackened
            3 mins ago














          4












          4








          4






          This is a pure calc alternative in case dimline doesn't allow you to do that. (I do not know what dimline does.) This is an updated answer in which I try to address your comments. It comes with a decoration indicate dimensions, which has one argument, the label. All distances and other parameters are stored in pgfkeys. Drawing the line plus all the dimension lines and perpendicular lines boils down to



           draw[postaction={indicate dimensions={label}}] (A)--(B);


          Here is the code



          documentclass[tikz, border=1cm]{standalone}
          usetikzlibrary{calc,decorations.pathreplacing}
          tikzset{dimlabel distance/.initial=5mm,
          vertical lines extend/.initial=5mm,
          vertical dim line/.style={gray,thin},
          dim arrow line/.style={latex-latex,thin},
          dim label/.style={},
          indicate dimensions/.style={decorate,decoration={
          show path construction,
          lineto code={
          draw[dim arrow line]
          ($ (tikzinputsegmentfirst)!pgfkeysvalueof{/tikz/dimlabel distance}!-90:(tikzinputsegmentlast) $) -- ($ (tikzinputsegmentlast)!pgfkeysvalueof{/tikz/dimlabel distance}!90:(tikzinputsegmentfirst) $)
          node[midway,sloped,fill=white,dim label]{#1};
          draw[vertical dim line] (tikzinputsegmentfirst) --
          ($ (tikzinputsegmentfirst)!pgfkeysvalueof{/tikz/vertical lines extend}!-90:(tikzinputsegmentlast) $)
          (tikzinputsegmentlast) --
          ($ (tikzinputsegmentlast)!pgfkeysvalueof{/tikz/vertical lines extend}!90:(tikzinputsegmentfirst) $);
          }}}}

          begin{document}
          begin{tikzpicture}[
          plotmark/.style = {%
          draw, fill=red, circle, inner sep=0pt, minimum size=4pt
          }
          ]
          coordinate (A) at (0,0);
          coordinate (B) at (5,3);

          draw[postaction={indicate dimensions={label}}] (A)--(B);

          node[plotmark, label={above:$A$}] at (A) {};
          node[plotmark, label={above:$B$}] at (B) {};
          end{tikzpicture}
          end{document}


          enter image description here



          Initially, both vertical lines extend and dimlabel distance are set to 5mm, such that the gray auxiliary lines terminate where the arrows end.






          share|improve this answer














          This is a pure calc alternative in case dimline doesn't allow you to do that. (I do not know what dimline does.) This is an updated answer in which I try to address your comments. It comes with a decoration indicate dimensions, which has one argument, the label. All distances and other parameters are stored in pgfkeys. Drawing the line plus all the dimension lines and perpendicular lines boils down to



           draw[postaction={indicate dimensions={label}}] (A)--(B);


          Here is the code



          documentclass[tikz, border=1cm]{standalone}
          usetikzlibrary{calc,decorations.pathreplacing}
          tikzset{dimlabel distance/.initial=5mm,
          vertical lines extend/.initial=5mm,
          vertical dim line/.style={gray,thin},
          dim arrow line/.style={latex-latex,thin},
          dim label/.style={},
          indicate dimensions/.style={decorate,decoration={
          show path construction,
          lineto code={
          draw[dim arrow line]
          ($ (tikzinputsegmentfirst)!pgfkeysvalueof{/tikz/dimlabel distance}!-90:(tikzinputsegmentlast) $) -- ($ (tikzinputsegmentlast)!pgfkeysvalueof{/tikz/dimlabel distance}!90:(tikzinputsegmentfirst) $)
          node[midway,sloped,fill=white,dim label]{#1};
          draw[vertical dim line] (tikzinputsegmentfirst) --
          ($ (tikzinputsegmentfirst)!pgfkeysvalueof{/tikz/vertical lines extend}!-90:(tikzinputsegmentlast) $)
          (tikzinputsegmentlast) --
          ($ (tikzinputsegmentlast)!pgfkeysvalueof{/tikz/vertical lines extend}!90:(tikzinputsegmentfirst) $);
          }}}}

          begin{document}
          begin{tikzpicture}[
          plotmark/.style = {%
          draw, fill=red, circle, inner sep=0pt, minimum size=4pt
          }
          ]
          coordinate (A) at (0,0);
          coordinate (B) at (5,3);

          draw[postaction={indicate dimensions={label}}] (A)--(B);

          node[plotmark, label={above:$A$}] at (A) {};
          node[plotmark, label={above:$B$}] at (B) {};
          end{tikzpicture}
          end{document}


          enter image description here



          Initially, both vertical lines extend and dimlabel distance are set to 5mm, such that the gray auxiliary lines terminate where the arrows end.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited 6 mins ago

























          answered 1 hour ago









          marmot

          87.6k4101189




          87.6k4101189












          • How do I style the vertical lines and the arrow lines?
            – blackened
            16 mins ago






          • 1




            @blackened I added a more customizable version. It has a style for the arrows dim arrow line which you could modify to your needs as well as a style for the perpendicular lines and all dimensions are stored in pgfkeys.
            – marmot
            5 mins ago










          • Is your code extensible to cover angular dimensional representations?
            – blackened
            3 mins ago


















          • How do I style the vertical lines and the arrow lines?
            – blackened
            16 mins ago






          • 1




            @blackened I added a more customizable version. It has a style for the arrows dim arrow line which you could modify to your needs as well as a style for the perpendicular lines and all dimensions are stored in pgfkeys.
            – marmot
            5 mins ago










          • Is your code extensible to cover angular dimensional representations?
            – blackened
            3 mins ago
















          How do I style the vertical lines and the arrow lines?
          – blackened
          16 mins ago




          How do I style the vertical lines and the arrow lines?
          – blackened
          16 mins ago




          1




          1




          @blackened I added a more customizable version. It has a style for the arrows dim arrow line which you could modify to your needs as well as a style for the perpendicular lines and all dimensions are stored in pgfkeys.
          – marmot
          5 mins ago




          @blackened I added a more customizable version. It has a style for the arrows dim arrow line which you could modify to your needs as well as a style for the perpendicular lines and all dimensions are stored in pgfkeys.
          – marmot
          5 mins ago












          Is your code extensible to cover angular dimensional representations?
          – blackened
          3 mins ago




          Is your code extensible to cover angular dimensional representations?
          – blackened
          3 mins ago


















          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%2f468143%2ftikz-dimline-label-position%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

          Eastern Orthodox Church

          Zagreb

          Understanding the information contained in the Deep Space Network XML data?