6

I have an expression with an \underbrace, where the parenthesis and a second partial devirative gets a little to big.

Here is the code:

\begin{fleqn}
\begin{align*}
    \frac{1}{v_G} =  \frac{1}{v_{ph}} \cdot \left(\frac{1 - \frac{\lambda}{n} \frac{\partial n}{\partial \lambda}}{1 - \left(\frac{\lambda}{n} \right)^2 \underbrace{\frac{\partial^2 n}{\partial \lambda^2}}_{=0}} \right) = \frac{1}{v_{ph}} \cdot \left( 1 - \frac{\lambda}{n} \frac{\partial n}{\partial \lambda} \right) 
\end{align*}
\end{fleqn}

and here the result:

enter image description here

How can I adjust the code so that the second order partial derivative is as big as the term over the fraction line?

CarLaTeX
  • 62,716
  • 1
    Welcome to TeX.SX! The simplest would be removing the big parentheses which are redundant. But also the \underbrace needs a fix. – egreg Nov 04 '18 at 14:31

3 Answers3

5

I would simply omit those redundant parentheses. And most certainly fix the size of the \underbrace object.

It's also possible (but requires a phantom) to have the right size for the parentheses:

\documentclass{article}
\usepackage{amsmath}

\makeatletter
\newcommand{\fixedunderbrace}[2]{{\mathpalette\fixed@underbrace{{#1}{#2}}}}
\newcommand{\fixed@underbrace}[2]{\fixed@@underbrace#1#2}
\newcommand{\fixed@@underbrace}[3]{\underbrace{#1#2}_{#3}}
\makeatother

\begin{document}

\begin{equation*}
\frac{1}{v_G} =
\frac{1}{v_{ph}} \cdot 
  \frac{1 - \frac{\lambda}{n} \frac{\partial n}{\partial \lambda}}
       {1 - \left(\frac{\lambda}{n} \right)^2
        \fixedunderbrace{\frac{\partial^2 n}{\partial \lambda^2}}{=0}}
= \frac{1}{v_{ph}} \cdot 
  \left( 1 - \frac{\lambda}{n} \frac{\partial n}{\partial \lambda} \right) 
\end{equation*}

\begin{equation*}
\frac{1}{v_G} =
\frac{1}{v_{ph}} \cdot 
  \left(
  \frac{1 - \frac{\lambda}{n} \frac{\partial n}{\partial \lambda}}
       {1 - \left(\frac{\lambda}{n} \right)^2
        \smash[b]{\fixedunderbrace{\frac{\partial^2 n}{\partial \lambda^2}}{=0}}}
  \right)
  \vphantom{
    \frac{1 - \frac{\lambda}{n} \frac{\partial n}{\partial \lambda}}
       {1 - \left(\frac{\lambda}{n} \right)^2
        \fixedunderbrace{\frac{\partial^2 n}{\partial \lambda^2}}{=0}}
  }
= \frac{1}{v_{ph}} \cdot 
  \left( 1 - \frac{\lambda}{n} \frac{\partial n}{\partial \lambda} \right) 
\end{equation*}

\end{document}

enter image description here

egreg
  • 1,121,712
  • With mathlap or something like that command is also possible? – manooooh Nov 04 '18 at 14:51
  • 1
    @manooooh No, \math[r|c|l]lap is for hiding horizontal lengths; for hiding a vertical length one needs \smash; however, the real height has to be reinforced later or the vertical spacing would break (the line below the display would be too near, in this case). – egreg Nov 04 '18 at 14:57
3

Some suggestions (the first two of which have already been made by @egreg):

  • Omit the large parentheses entirely -- they seem to satisfy no useful purpose.

  • Use \tfrac (or \textstyle\frac) instead of \frac in the first argument of \underbrace. (By default, the first argument of \underbrace is processed in display-style math mode. However, the remainder of the denominator is processed in text style, not display style. That's why it's necessary to write \tfrac instead of just \frac.)

  • Omit all \cdot directives. They achieve little but clutter up the appearance of the equation.

  • For better horizontal spacing as well as for more typographically-appropriate sizing of the parentheses in the final part of the equation, use \Bigl( and \Bigr) instead of \left( and \right).

enter image description here

\documentclass{article}
\usepackage{amsmath} % for "\tfrac" macro
\begin{document}
\[
\frac{1}{v_G} 
= \frac{1}{v_{ph}}  
\frac{1 - \frac{\lambda}{n} \frac{\partial n}{\partial \lambda}}{%
      1 - \bigl(\frac{\lambda}{n} \bigr)^{\!2} \!
\underbrace{\tfrac{\partial^2 n}{\partial\lambda^2}}_{=0}}
= \frac{1}{v_{ph}} \Bigl( 1 - \frac{\lambda}{n} 
    \frac{\partial n}{\partial \lambda} \Bigr)
\]
\end{document}
Mico
  • 506,678
2

You can either use the \cfrac command to have all fractions in display style, or \tfrac for the underbraced partial derivative. I don't like such a discrepancy between these two sizes in the same formula, so I suggest using the medium size commands from nccmath (~80% of \displaystyle). I give an example of both, with some spacing improvements, and in the second example, the use ofthe esdiff package to simpify typing of partial derivatives:

\documentclass{article}

\usepackage{amsmath, nccmath}
\usepackage{esdiff}
\usepackage{bigstrut}

\begin{document}

\begin{fleqn}
\begin{align*}
    \frac{1}{v_G} = \frac{1}{v_{ph}} \cdot \left(\frac{1 - \cfrac{\lambda}{n\bigstrut[b]} \cfrac{\partial n}{\partial \lambda}}{1 - \biggl(\cfrac{\lambda}{n} \biggr)^{\mkern-5mu 2} \smash[b]{\underbrace{\cfrac{\partial^2 n}{\partial \lambda^2}}_{=0}}} \right) = \frac{1}{v_{ph}} \cdot \left( 1 - \frac{\lambda}{n} \frac{\partial n}{\partial \lambda} \right)
\end{align*}
\bigskip

\begin{align*}
    \frac{1}{v_G} = \frac{1}{v_{ph}} \cdot \left(\frac{1 - \medmath{\frac{\lambda}{n\bigstrut[b]} \diffp{n}{\lambda}}}{1 - \medmath{ \left(\frac{\lambda}{n} \right)^{\mkern-5mu 2} \smash[b]{\underbrace{\diffp[2]{n}{\lambda}}_{=0}}}} \right) = \frac{1}{v_{ph}} \cdot \left( 1 - \frac{\lambda}{n} \diffp{n}{\lambda} \right)
\end{align*}
\end{fleqn}

\end{document} 

enter image description here

Bernard
  • 271,350
  • @Bernhard Thank you very much! Your solution seems to be very compact. In future, I will use the \usepackage{esdiff} :) – astronerd Nov 04 '18 at 15:28