Parentheses around mismatched size fractions in LaTeX

In summary: Another way to do this is to use a fractional matrix:\begin{matrix}\left[ \frac{Q_2}{\left( r_2\sqrt{4\pi}+\sqrt{Q_2\gamma A} \right)^2 } +Q_3 \right]\end{matrix}This way, the brackets will automatically size to the correct width.
  • #1
wolfbd
1
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
  • #2
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:
  • #3
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:

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

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

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

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

1. What are parentheses around mismatched size fractions in LaTeX?

In LaTeX, parentheses are used to enclose mismatched size fractions, which are expressions with both a numerator and denominator that have different font sizes. These parentheses help to visually distinguish the fraction from the surrounding text and indicate that it should be read as a single unit.

2. How do I use parentheses around mismatched size fractions in LaTeX?

To use parentheses around mismatched size fractions in LaTeX, simply include them in the fraction expression using the "\frac" command. For example, "\frac{(x+1)}{(x-1)}" would produce a fraction with parentheses around the numerator and denominator.

3. Can I customize the size of parentheses around mismatched size fractions in LaTeX?

Yes, you can customize the size of the parentheses using the "\left" and "\right" commands. These commands will automatically adjust the size of the parentheses based on the size of the fraction. For example, "\left(\frac{x}{y}\right)" would produce larger parentheses than "\left(\frac{1}{2}\right)".

4. Do I need to use parentheses around mismatched size fractions in every instance?

No, parentheses are not required for every instance of a mismatched size fraction in LaTeX. They are mainly used for clarity and to improve the aesthetic appearance of the fraction. If the fraction is already clear without parentheses, you do not need to include them.

5. Are there any other uses for parentheses in LaTeX?

Yes, parentheses have several other uses in LaTeX, including grouping mathematical expressions, defining function parameters, and indicating the order of operations. They can also be used in text mode to enclose text that should be treated as a single unit, such as abbreviations or acronyms.

Similar threads

Replies
4
Views
810
  • Advanced Physics Homework Help
Replies
3
Views
499
  • MATLAB, Maple, Mathematica, LaTeX
Replies
7
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
7
Views
964
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
883
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
737
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
5K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
Back
Top