Math & ScienceUnderbrace with Lots of Text

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
latexhelp1
Posts: 141
Joined: Sun Jun 12, 2011 6:30 am

Underbrace with Lots of Text

Post by latexhelp1 »

I have an underbrace with too much text. Is is possible to specify the text in the underbrace to take more than one line rather than to create additional space in the equation?

Code: Select all

\begin{equation*}
\hspace{2cm} \frac{dy}{dx} =  \underbrace{\frac{da}{db}\frac{db}{dx}}_\text{way too much text here} + \underbrace{\frac{da}{dc}\frac{dc}{db}\frac{db}{dx}}_\text{also way too much text here} < 0 
\end{equation*}
Last edited by latexhelp1 on Thu Feb 09, 2012 11:19 pm, edited 1 time in total.

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

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Underbrace with Lots of Text

Post by localghost »

Wherever you need line breaks, you can use the \parbox command.

Code: Select all

\documentclass[11pt]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{mathtools}

\begin{document}
  \begin{equation*}
    \frac{dy}{dx}=\underbrace{\frac{da}{db}\frac{db}{dx}}_{\parbox{4em}{\footnotesize way too much text here}} + \underbrace{\frac{da}{dc}\frac{dc}{db}\frac{db}{dx}}_{\parbox{4em}{\footnotesize way too much text here}} < 0
  \end{equation*}
\end{document}

Thorsten
latexhelp1
Posts: 141
Joined: Sun Jun 12, 2011 6:30 am

Underbrace with Lots of Text

Post by latexhelp1 »

Thank you for this help. However, it does not achieve what I'm looking for. I'd like to reduce the space after the equal sign and before the plus sign. I'd also like to center align the text beneath the underbrace.
localghost wrote:Wherever you need line breaks, you can use the \parbox command.

Code: Select all

\documentclass[11pt]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{mathtools}

\begin{document}
  \begin{equation*}
    \frac{dy}{dx}=\underbrace{\frac{da}{db}\frac{db}{dx}}_{\parbox{4em}{\footnotesize way too much text here}} + \underbrace{\frac{da}{dc}\frac{dc}{db}\frac{db}{dx}}_{\parbox{4em}{\footnotesize way too much text here}} < 0
  \end{equation*}
\end{document}

Thorsten
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Underbrace with Lots of Text

Post by localghost »

Simply reduce the size of the box and insert a \centering command inside to achieve what you are after. It's all done with very basic LaTeX elements. Be a bit more proactive.

Code: Select all

\documentclass[11pt]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{mathtools}

\begin{document}
  \begin{equation*}
    \frac{dy}{dx} = \underbrace{\frac{da}{db}\frac{db}{dx}}_{\parbox{3em}{\footnotesize\centering way too much text here}} + \underbrace{\frac{da}{dc}\frac{dc}{db}\frac{db}{dx}}_{\parbox{3em}{\footnotesize\centering way too much text here}} < 0
  \end{equation*}
\end{document}
If the boxes are still to wide, just reduce their width again.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10324
Joined: Mon Mar 10, 2008 9:44 pm

Underbrace with Lots of Text

Post by Stefan Kottwitz »

You could also use tabular with text, or substack or subarray with math.

Code: Select all

\begin{equation*}
  \frac{dy}{dx} = \underbrace{\frac{da}{db}\frac{db}{dx}}_{%
    \footnotesize\begin{tabular}{c}way too\\much\\text\\here\end{tabular}}
    + \ldots
\end{equation*}
Stefan
LaTeX.org admin
latexhelp1
Posts: 141
Joined: Sun Jun 12, 2011 6:30 am

Underbrace with Lots of Text

Post by latexhelp1 »

Thank you. I cannot understand how to add an overbrace. I am trying so hard. I cannot get it to compile. I want to add an overbrace over the \frac{da}{db} and put a +. I would so very much appreciate your help.
localghost wrote:The simply reduce the size of the box and insert a \centering command inside to achieve what you are after. It's all done with very basic LaTeX elements. Be a bit more proactive.

Code: Select all

\documentclass[11pt]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{mathtools}

\begin{document}
  \begin{equation*}
    \frac{dy}{dx} = \underbrace{\frac{da}{db}\frac{db}{dx}}_{\parbox{3em}{\footnotesize\centering way too much text here}} + \underbrace{\frac{da}{dc}\frac{dc}{db}\frac{db}{dx}}_{\parbox{3em}{\footnotesize\centering way too much text here}} < 0
  \end{equation*}
\end{document}
If the boxes are still to wide, just reduce their width again.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Underbrace with Lots of Text

Post by localghost »

I'm a bit confused. Up to now I thought we would talk about \underbrace. Please elaborate. Did I miss something? Or did I mix up topics and went to the wrong thread?
Post Reply