In Engineering it is customary to denote small dimensions with arrows as shown below (in binding correction and trim top):

enter image description here

Variants exist such as

enter image description here

Currently they are all hardcoded as for example:

 \draw (0, \trystockheight@cx + 3mm) -- ++ (0,1cm)
       ++ (\lefttrim,-1cm) -- ++(0,1cm) ++(-1cm-\lefttrim,-0.5cm)[->,>=latex]
       -- ++(0.5cm+\lefttrim,0);  

 \draw (0, \trystockheight@cx + 3mm)
        ++ (0,0.5cm) -- ++ (\lefttrim,0)
        ++(1cm,0cm)[|->,>=latex]-- ++(-1cm,0cm)
        node[right] at ++(1cm,0)
        {\bindingcorrectionname\ \convert@cx{\lefttrim} $(\delta_b)$ };

What is an efficient was to generalize and draw such arrows, taking into account that labels can be left or right etc.

My apologies to anyone that might need a MWE, but the current code is quite longish to cut down to a minimal.


Recently, I needed to do this kind of drawing and that's what I used (I think I made a mix between codes from Jake, Martin and me. Missing cases where dimensions are small. I kept all the code to show the result. The third argument wit dimcan b used to place the label (right, left etc.)

\usetikzlibrary{ arrows,  calc,decorations,decorations.markings,decorations.text}

\pgfkeys{/pgf/decoration/.cd, distance/.initial = 10pt}  

\pgfdeclaredecoration{add dim}{final}{

    dim/.style args={#1,#2,#3}{%
                decoration = {add dim,distance=\ifx&#2&0pt\else#2\fi},
                postaction = {%
                        mark=at position .5 with {\node[inner sep=2pt,
                                                        fill=\ifx&#1&none\else white\fi,
                                                        #3] at (0,0) {#1};}
\tikzset{add reference/.style={insert path={%
    coordinate [pos=0] (#1 south west) 
    coordinate [pos=1]   (#1 north east)
    coordinate [pos=.5] (#1 center)                        
    (#1 south west |- #1 north east)     coordinate (#1 north west)
    (#1 center     |- #1 north east)     coordinate (#1 north)
    (#1 center     |- #1 south west)     coordinate (#1 south)
    (#1 south west -| #1 north east)     coordinate (#1 south east)
    (#1 center     -| #1 south west)     coordinate (#1 west)
    (#1 center     -| #1 north east)     coordinate (#1 east)   

 \tikzset{pt/.style={circle,fill=#1,inner sep=0mm,minimum size=4pt}}   


\path  (0,0)  coordinate  (O) 
       (5,8)  coordinate  (pt upper left);

\draw (O) rectangle (pt upper left)  [add reference=R];

\draw[dashed] (R north) --  (R south) 
              (R west) --   (R east);

\node[circle,draw,inner sep=0pt,minimum size=6pt,outer sep=1pt] (pt center) at (R center)   {};   
\node[circle,fill,inner sep=0pt,minimum size=6pt,outer sep=1pt] (pt base) at (0,2)  {};
\draw[dotted] (pt base) -- ++(7,0); 
\path[dim={totalheight,10ex,}]   (R north east) --  (R south east);
\path[dim={height,5ex,left}]         (R north east) --  (pt base -| R south east);
\path[dim={depth,5ex,}]          (pt base -| R south east) --  (R south east);
\path[dim={width,-4ex,}]         (R south west) --  (R south east);

\node[font=\footnotesize](line base) at (1.25,1){\emph{ligne de base}}; 
\draw [->,>=latex'] (line base) to [bend right](2,2);
\node[font=\footnotesize,text width=2cm](pt ref) at (-1.5,.5){\emph{point de\\référence}}; 
\draw [->,>=latex'] (pt ref) to [bend left](pt base); 
\node[font=\footnotesize](lines cent) at (1.25,6){\emph{lignes centrales}};
\draw [->,>=latex'] (lines cent) edge [bend right] (2.5,5)
                                 edge [bend right] (1.5,4);     
\node[font=\footnotesize](pt cent) at (4,3){\emph{point central}};
\draw [->,>=latex'] (pt cent) to [bend right](pt center);

\node[above]       at (R north)      {[\texttt{t}]};
\node[above left]  at (R north west) {[\texttt{lt}]}; 
\node[above right] at (R north east) {[\texttt{rt}]};

\node[below]       at (R south)      {[\texttt{b}]};
\node[below left]  at (R south west) {[\texttt{lb}]}; 
\node[below right] at (R south east) {[\texttt{rb}]};

\node[above right] at (R center)  {[\texttt{c}]};
\node[left]        at (R west)    {[\texttt{lc}]}; 
\node[right]       at (R east)    {[\texttt{rc}]};

\node[above right] at ([xshift=2.5cm]pt base)  {[\texttt{B}]};
\node[above left]        at (pt base)    {[\texttt{lB}]}; 
\node[above right]       at ([xshift=5cm]pt base)    {[\texttt{rB}]};     

enter image description here

| improve this answer | |

Just to start an answer, here is the new arrow type inv. This will probably help.



  \pgfsetdash{}{0pt} % do not dash
  \pgfsetmiterjoin   % fix join
  \pgfsetroundcap    % fix cap
  % arrow
  % amp
  \pgfpathlineto{\pgfpoint{\pgfgetarrowoptions{inv} \pgflinewidth}{0pt}}
  % mark

  \draw[line width=1pt,inv-inv]
  (0,0) -- (5,0);
  \fill[red] (0,0) circle[radius=1pt];
  \draw[line width=2pt,inv-inv]
  (0,1) -- (5,1);
  \fill[red] (0,1) circle[radius=1pt];
    \draw[line width=2pt,inv-inv]
    (0,2) -- (5,2);
  \fill[red] (0,2) circle[radius=1pt];
  \draw[blue,line width=3pt,inv-inv]
  (0,3) -- (5,3);
  \fill[red] (0,3) circle[radius=1.5pt];
  \node[fit=(current bounding box),draw=gray,inner sep=0pt,dashed]{};
  \node[fit=(current bounding box),inner sep=1.2cm]{};

enter image description here

| improve this answer | |
  • Nice one. One tiny detail: The standard engineering arrowheads are roughly assumed to have 1 unit of width 3 units of length. – percusse Jun 1 '12 at 22:46
  • @percusse Thanks for this information. I have changed my code to use this ratio. – Paul Gaborit Jun 2 '12 at 0:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.