I searched for problems like this, but couldn't find any approach. Then, I don't believe this is a duplicated question.
The question is: how to draw section-size arrow marks (like the one shown in the picture) using tikz.
I searched for problems like this, but couldn't find any approach. Then, I don't believe this is a duplicated question.
The question is: how to draw section-size arrow marks (like the one shown in the picture) using tikz.
tikz-dimline was designed for this pourpose. Following code is an example from its documentation.
\documentclass[tikz, border=2mm]{standalone}
\usepackage{tikz-dimline}
\begin{document}
\begin{tikzpicture}[scale=0.5]
\draw[help lines] (-1,-1) grid (4,7);
\draw (0,0) -- (0,4) -- (.5,4) -- (.5,5) -- (1.,5) -- (1.,4) -- (1.5,4) -- (1.5,0)
-- cycle;
\dimline[color=blue,
extension start length=-0.25, extension end length=-0.25]{(2.75,0)}{(2.75,4)}{4.0};
\dimline[color=red,
line style={arrows=dimline reverse-dimline reverse},
label style={above=0.8ex,font=\tiny},
extension start length=1,
extension end length=1]{(0.5,5.6)}{(1.0,5.6)}{0.5};
\end{tikzpicture}
\end{document}
An other approach using the To path operation :
\documentclass[border=5mm,tikz]{standalone}
\usetikzlibrary{arrows.meta,calc}
\tikzset{
diameter/.style={to path={},
execute at end to={
\draw[Stealth-](\tikztostart)--($(\tikztostart)!-0.5cm!(\tikztotarget)$);
\draw[Stealth-](\tikztotarget)--($(\tikztotarget)!-0.5cm!(\tikztostart)$);
\path (\tikztostart)--(\tikztotarget) \tikztonodes;
},
}
}
\begin{document}
\begin{tikzpicture}
\draw(0,0)--(2,0);
\draw(0,1)--(2,1);
\path[diameter] (0.5,0)to node{\(\phi\)}(1,1);
\path[diameter] (1.5,0)to node{\(\phi\)}(1.5,1);
\end{tikzpicture}
\end{document}
\documentclass[tikz,border=3.14mm]{standalone} \begin{document} \begin{tikzpicture} \node (tmp) {$\phi$}; \draw (tmp.north east) -- ++ (-3,0); \draw (tmp.south east) -- ++ (-3,0); \draw[<-] (tmp.north) -- ++ (0,0.5); \draw[<-] (tmp.south) -- ++ (0,-0.5); \end{tikzpicture} \end{document}. – Dec 18 '18 at 19:37\sectioncommand, right? – Dec 18 '18 at 19:45