TransWikia.com

Are there simple ways to draw measurement of length of a line in tikz?

TeX - LaTeX Asked by lightweight on August 4, 2021

The "measurement of length of a line" in my question is the part highlighted by a green rectangle in the following figure:
enter image description here

Now, I am drawing the elements (i.e. two arrows, two ends, 8) of the measurement separately. It is tedious. I wonder are there simple ways to draw these measurements? For example, somecommand [<->, offset=x mm, "text"] (point1) -- (point2), namely somecommand [<->, offset=2mm, "4"] (A) -- (D) or somecommand [<->, offset=2mm, "8"] (B) -- (C) in the above figure. I would appreciate any help with this situation.

One Answer

In case you'd be interested, it uses a short code with pstricks:

documentclass[ border=3pt]{standalone}
usepackage{pst-eucl}%,

begin{document}

begin{pspicture}(-0.5,-0.5)(8.5,4.5)
    psset{ labelsep=0.8ex, linejoin=1, RightAngleSize=0.25, tbarsize=8pt, arrowinset=0.1}
    pstGeonode[PointSymbol=none, PosAngle={180,180,0,0}](3,4){A}(0,0){B}(8,0){C}(7,4){D}
    psline(A)(B)(C)(D)(A)%
    pnodes{H}(4,4)(4,0)pcline(H0)(H1)ncput*{4}
    pstRightAngle{D}{H0}{H1} pstRightAngle{C}{H1}{H0}
    psset{offset=1.6ex}
    pcline{|<->|}(A)(D)ncput*{4} pcline{|<->|}(C)(B)ncput*{8}
end{pspicture}

end{document} 

enter image description here

Answered by Bernard on August 4, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP