0

I have written this code for two line segments. I want to line them up to show that you can take sub intervals of the original, and add it to the new line segment.

\begin{center}
    {$\overline{\rm AB}$}
\begin{tikzpicture}
    \draw (0,0) -- (5,0) ;
\end{tikzpicture}
\end{center}

\begin{center} {$\overline{\rm CD}$} \begin{tikzpicture} \draw (0,0) -- (7.5,0) ; \end{tikzpicture} \end{center}

I'd love something like this:

Line Segment Comparison

1 Answers1

2

This can be done with simple \rule commands and the mathtools package. I took the liberty to replace the \underbraces with \underbrackets, as I find them more expressive in this context:

\documentclass{article}
\usepackage{mathtools}

\begin{document}

\begin{align} \begin{gathered} \overline{\mathrm{AB}} \[-2.5ex] \underbracket[0.5pt]{\rule{2cm}{0.8pt}}{\tfrac{1}{2}} \clap{\rule{0.4em}{0.8pt}}\mkern-3mu \underbracket[0.5pt]{\rule{2cm}{0.8pt}}{\tfrac{1}{2}} \end{gathered} & \qquad \begin{gathered} \overline{\mathrm{CD}} \[-2.5ex] \underbracket[0.5pt]{\rule{2cm}{0.8pt}}{\tfrac{1}{2}} \clap{\rule{0.4em}{0.8pt}} \mkern-3mu \underbracket[0.5pt]{\rule{2cm}{0.8pt}}{\tfrac{1}{2}} \clap{\rule{0.4em}{0.8pt}} \mkern-3mu \underbracket[0.5pt]{\rule{2cm}{0.8pt}}_{\tfrac{1}{2}} \end{gathered} \end{align}

\end{document}

enter image description here

Bernard
  • 271,350