Parentheses around mismatched size fractions in LaTeX

  • Context: LaTeX 
  • Thread starter Thread starter wolfbd
  • Start date Start date
  • Tags Tags
    Fractions Latex
Click For Summary
SUMMARY

The discussion focuses on formatting fractions in LaTeX, specifically addressing the issue of sizing brackets around a nested fraction. Users suggest using the \vphantom{} command to align elements correctly and recommend alternatives to \dfrac for better visual results. The conversation highlights the importance of using \bigl and \bigr for more appropriate bracket sizing and offers various strategies to improve the overall appearance of complex mathematical expressions in LaTeX.

PREREQUISITES
  • Understanding of LaTeX syntax and commands
  • Familiarity with mathematical typesetting
  • Knowledge of LaTeX commands like \frac, \dfrac, \vphantom, \left, and \right
  • Experience with LaTeX environments for equations
NEXT STEPS
  • Explore advanced LaTeX commands for mathematical formatting
  • Learn about the use of \bigl and \bigr for customized bracket sizing
  • Investigate the impact of \vphantom on vertical alignment in LaTeX
  • Study best practices for nesting fractions in LaTeX documents
USEFUL FOR

Mathematicians, educators, and students who require precise formatting of complex equations in LaTeX, as well as anyone looking to enhance their typesetting skills for academic or professional documents.

wolfbd
Messages
1
Reaction score
0
I have a fraction in the denominator of another fraction, and I'm trying to put a set of brackets around it. However, I can't seem to get them to size properly. Example below:

Code:
 Q_1 \left[ \frac{Q_2}{4\pi \left( r_2+\sqrt{ \dfrac{Q_2\gamma A}{4\pi}} \right)^2 } + Q_3 \right]

which comes out as

\begin{equation}
Q_1 \left[ \frac{Q_2}{4\pi \left( r_2+\sqrt{ \dfrac{Q_2\gamma A}{4\pi}} \right)^2 } +Q_3\right]
\end{equation}

Obviously, I want to get rid of the space at the top. I've tried using \Bigg[ (which ends up too small) and even creating my own sizing in the preamble:
Code:
\makeatletter
\newcommand{\vast}{\bBigg@{4}}
\makeatother
(which ends up too big since it only accepts integer sizing, as far as I can tell). Any ideas? Thanks.
 
Physics news on Phys.org
You can get the brackets right by putting the fraction inside a matrix.

That leaves the ##Q_1## in a silly place, but you can fix that with the \vphantom{} command. \vphantom{} works out the vertical height of what is inside the {}, and creates an invisible zero-width object of that size.

So, in front of the matrix in [ ] , make another matrix without backets, use \vphantom to make it the same height, and the ##Q_1## will line up with the ##Q_3##.

Code:
\begin{matrix}
\vphantom{\frac{Q_2}{4\pi \left( r_2+\sqrt{ \dfrac{Q_2\gamma A}{4\pi}} \right)^2 }}
Q_1 
\end{matrix}
\begin{bmatrix} 
\frac{Q_2}{4\pi \left( r_2+\sqrt{ \dfrac{Q_2\gamma A}{4\pi}} \right)^2 } + Q_3
\end{bmatrix}

$$\begin{matrix}
\vphantom{\frac{Q_2}{4\pi \left( r_2+\sqrt{ \dfrac{Q_2\gamma A}{4\pi}} \right)^2 }}
Q_1
\end{matrix}
\begin{bmatrix}
\frac{Q_2}{4\pi \left( r_2+\sqrt{ \dfrac{Q_2\gamma A}{4\pi}} \right)^2 } + Q_3
\end{bmatrix}$$

if you are a perfectionist, you might want to put a bit of negative space in between the two matrices as well.

Easy peasy. :devil:
 
Last edited:
wolfbd said:
\begin{equation}
Q_1 \left[ \frac{Q_2}{4\pi \left( r_2+\sqrt{ \dfrac{Q_2\gamma A}{4\pi}} \right)^2 } +Q_3\right]
\end{equation}

One problem is that you are fighting LaTeX by using \dfrac. Simply changing to \frac improves things to some extent:

Q_1 \left[ \frac{Q_2}{4\pi \left( r_2+\sqrt{ \frac{Q_2\gamma A}{4\pi}} \right)^2 } + Q_3 \right]

There are other ways to represent division. Sometimes a/b looks better than \frac a b:
Q_1 \left[ \frac{Q_2}{4\pi \left( r_2+\sqrt{ (Q_2\gamma A)/(4\pi)} \right)^2 } + Q_3 \right]

You can pull the 4\pi inside the parentheses as \sqrt{4\pi}. This clears the denominator that is the root cause of your problems:
Q_1 \left[ \frac{Q_2}{\left( r_2\sqrt{4\pi}+\sqrt{Q_2\gamma A} \right)^2 } + Q_3 \right]

Sometimes \left and \right are too big. This is one of those times. Use \bigl and \bigr instead:
Q_1 \left[ \frac{Q_2}{\bigl( r_2\sqrt{4\pi}+\sqrt{Q_2\gamma A} \bigr)^2 } + Q_3 \right]
 

Similar threads

Replies
4
Views
1K
  • · Replies 7 ·
Replies
7
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 11 ·
Replies
11
Views
8K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 2 ·
Replies
2
Views
1K
  • · Replies 7 ·
Replies
7
Views
2K
Replies
5
Views
3K
  • · Replies 2 ·
Replies
2
Views
1K
  • · Replies 0 ·
Replies
0
Views
6K