GeneralMultiple lines in mathematical formula

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
pittopitto
Posts: 2
Joined: Mon Oct 15, 2007 12:45 am

Multiple lines in mathematical formula

Post by pittopitto »

Hello, I have a little problem. I need to build a special mathematical formula that contains multiple overlines or underlines, but in this format:

Code: Select all

---------
       ---------
AA     BB     CC
That is if, for example I have three variables AA, BB and CC, I need to put one line on AA and BB and another line on BB and CC.

How can I do that in LaTeX?

Thanks a lot

pitto

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Multiple lines in mathematical formula

Post by gmedina »

I don't know if there is a package that directly allows you to achieve what you want, but below I include a possible solution:

Code: Select all

\documentclass{article}
\usepackage{amsmath}

\begin{document}
\newlength{\expWidth}
\settowidth{\expWidth}{AABB}
\[
 \overset{\rule{\expWidth}{0.5pt}\hfill}{AA\overline{BBCC}}
\]
\end{document}
Basically, I used \overline to draw a line from BB to CC and then \overset to place a line from AA to BB.
1,1,2,3,5,8,13,21,34,55,89,144,233,...
Post Reply