LaTeX: Difference Between \frac and \dfrac?

  • LaTeX
  • Thread starter FilupSmith
  • Start date
  • Tags
    Latex
In summary, the difference between \frac and \dfrac in LaTeX is that \dfrac does not automatically scale to the "best" size depending on the position in the formula, while \frac does. \dfrac also does not change size between inline and display math, while \frac does. Additionally, \tfrac and \frac allow for text-sized fractions, while \dfrac is best for formulas.
  • #1
FilupSmith
28
0
Hi, I'm trying to learn LaTeX and one of the things I'm trying to figure out is what is the difference between \frac and \dfrac?

I mean, look:
\frac{a}{b} is: $$\frac{a}{b}$$
\dfrac{a}{b} is: $$\dfrac{a}{b}$$

Other then the thickened line, is there really any difference?
Thank you...
 
Physics news on Phys.org
  • #2
Looking it up, a slight display difference is the only real change that you'll see on PF.
 
  • #3
Since the "d" is short for "\displaystyle" or "\D", you'll only see a difference for inline latex, e.g., ##\frac{a}{b}## versus ##\dfrac{a}{b}##
 
  • #4
I looked it up and i believe the only difference is that \tfrac or \frac allow for text sized fractions (great for 1/3, etc.) while \dfrac is best for formulas! Thanks none the less!
 
  • #5
\frac automatically scales to the "best" size depending on the position in the formula, as well as changing between inline and display math. \dfrac and \tfrac don't change size.

Use \frac, unless you don't want the default size.

Code:
 ##\frac{1}{2} 3^{\frac{1}{2}}\quad 
\dfrac{1}{2}3^{\dfrac{1}{2}}\quad 
\tfrac{1}{2}3^{\tfrac{1}{2}}##

$$\frac{1}{2} 3^{\frac{1}{2}}\quad 
\dfrac{1}{2}3^{\dfrac{1}{2}}\quad 
\tfrac{1}{2}3^{\tfrac{1}{2}}$$

##\frac{1}{2} 3^{\frac{1}{2}}\quad
\dfrac{1}{2}3^{\dfrac{1}{2}}\quad
\tfrac{1}{2}3^{\tfrac{1}{2}}##

$$\frac{1}{2} 3^{\frac{1}{2}}\quad
\dfrac{1}{2}3^{\dfrac{1}{2}}\quad
\tfrac{1}{2}3^{\tfrac{1}{2}}$$
 
Last edited:

What is the difference between \frac and \dfrac in LaTeX?

The main difference between \frac and \dfrac in LaTeX is the way they handle fractions. \frac is a basic command that displays fractions in a smaller font size and with the numerator and denominator placed next to each other. \dfrac, on the other hand, displays fractions in a larger font size and with the numerator and denominator stacked on top of each other. This makes \dfrac more suitable for displaying complex or large fractions.

Can I use \frac and \dfrac interchangeably in LaTeX?

Yes, both \frac and \dfrac can be used to display fractions in LaTeX. However, it is recommended to use \frac for simple fractions and \dfrac for more complex fractions to ensure proper formatting and readability.

Can I change the font size of fractions displayed with \frac and \dfrac in LaTeX?

Yes, the font size of fractions displayed with \frac and \dfrac can be changed in LaTeX. The size can be adjusted by using the \displaystyle command before the fraction, followed by the desired font size command, such as \tiny or \large.

Can I use \frac and \dfrac in both inline and display equations in LaTeX?

Yes, both \frac and \dfrac can be used in both inline and display equations in LaTeX. However, it is important to note that \dfrac may cause spacing issues in inline equations, so it is best to use \frac for fractions in inline equations.

Are there any other commands in LaTeX for displaying fractions?

Yes, there are other commands in LaTeX for displaying fractions, such as \tfrac, which is similar to \frac but displays fractions in a smaller font size, and \cfrac, which is similar to \dfrac but allows for more customization options such as changing the alignment of the numerator and denominator. It is recommended to use these commands when needed for specific formatting purposes.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
9
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
11
Views
244
  • MATLAB, Maple, Mathematica, LaTeX
Replies
12
Views
789
  • MATLAB, Maple, Mathematica, LaTeX
Replies
8
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
8
Views
1K
  • Calculus and Beyond Homework Help
Replies
13
Views
263
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
1K
  • Advanced Physics Homework Help
Replies
4
Views
1K
Back
Top