LaTeX Writing Fractions in LaTeX Easily

  • Thread starter Thread starter cookiemnstr510510
  • Start date Start date
  • Tags Tags
    Fractions Latex
AI Thread Summary
The discussion focuses on how to properly format fractions in LaTeX for clarity in mathematical equations. Users are seeking assistance with displaying fractions like 1/2 in a horizontal format. Key points include the correct use of LaTeX commands such as \frac{a}{b} for fractions, which works in both inline and display modes when enclosed in appropriate dollar signs. The distinction between inline and display modes is emphasized, with suggestions to use \dfrac for display-style fractions and \tfrac for text-style fractions. Users are encouraged to ensure they are using the correct syntax and environment for their equations to display correctly. Overall, the conversation highlights common pitfalls and clarifies the steps necessary to achieve the desired formatting in LaTeX.
cookiemnstr510510
Messages
162
Reaction score
14
Hello all, So I've been trying to write some basic equations out like 1/2 but would like it to appear in a horizontal fashion (like 1 over 2). I have been reading threads on how to use latex, I've tried to look at others equations, right click and have the latex code shown to me so i can re-create, but it doesn't work when I try. for example:
if I want to type a/b this is what I've tried:
\frac{a}{b}
\left (\frac a b \right)
I just want to know how to write a fraction.
Any help will be appreciated as I want to make my equations easier for all you wonderful homework helpers!
And sorry if I'm posting in the incorrect area, didn't see another forum to post.
 
Physics news on Phys.org
Does your first code snippet not work? This is what I get when I type \frac{a}{b} within the latex brackets: $$\frac{a}{b}$$ Is that not what you're looking for?
 
cookiemnstr510510 said:
Hello all, So I've been trying to write some basic equations out like 1/2 but would like it to appear in a horizontal fashion (like 1 over 2). I have been reading threads on how to use latex, I've tried to look at others equations, right click and have the latex code shown to me so i can re-create, but it doesn't work when I try. for example:
if I want to type a/b this is what I've tried:
\frac{a}{b}
\left (\frac a b \right)
I just want to know how to write a fraction.
Any help will be appreciated as I want to make my equations easier for all you wonderful homework helpers!
And sorry if I'm posting in the incorrect area, didn't see another forum to post.
Here's a short summary: https://www.physicsforums.com/help/latexhelp/
Both of your versions work: ##\frac{a}{b}## without and ##\left (\frac a b \right)## with extra brackets. You can also use \dfrac which gives ##\dfrac{a}{b}##.
 
  • Like
Likes cookiemnstr510510
Okay just realized that I probably cannot just type in \frac{a}{b} into my text field. I guess my question now is what are the steps I'm missing?
 
Matterwave said:
Does your first code snippet not work? This is what I get when I type \frac{a}{b} within the latex brackets: $$\frac{a}{b}$$ Is that not what you're looking for?
what does within latex brackets mean?
 
You have to brace the expression between double dollar signs for new line latex and double pound signs for in line latex. Quote my post to see how it's written.
 
  • Like
Likes cookiemnstr510510
$$\frac{a}{b}$$
 
  • Like
Likes berkeman
Matterwave said:
You have to brace the expression between double dollar signs for new line latex and double pound signs for in line latex. Quote my post to see how it's written.
GOT IT! thanks a bunch!
 
fresh_42 said:
Here's a short summary: https://www.physicsforums.com/help/latexhelp/
Both of your versions work: ##\frac{a}{b}## without and ##\left (\frac a b \right)## with extra brackets. You can also use \dfrac which gives ##\dfrac{a}{b}##.
Thanks!
 
  • #10
cookiemnstr510510 said:
Okay just realized that I probably cannot just type in \frac{a}{b} into my text field. I guess my question now is what are the steps I'm missing?
## for inline formuals ## and $$ for extra lines $$.
 
  • Like
Likes cookiemnstr510510
  • #11
No problem. :)
 
  • Like
Likes cookiemnstr510510
  • #12
fresh_42 said:
Here's a short summary: https://www.physicsforums.com/help/latexhelp/
Both of your versions work: ##\frac{a}{b}## without and ##\left (\frac a b \right)## with extra brackets. You can also use \dfrac which gives ##\dfrac{a}{b}##.
Just to expand a bit on this: \frac always gives you a fraction with sized determined by the environment. In an inline environment it will give you ##\frac{a}{b}## whereas in a display environment it will give you
$$
\frac{a}{b}
$$
Then there are the two commands \dfrac (display mode fraction) which will always give you a display style fraction, even inline, as ##\dfrac{a}{b}## and the \tfrac (text mode fraction) which will always give you an inline style fraction, even in a display environment
$$
\tfrac{a}{b}
$$
Personally I tend to avoid fractions in inline text and instead use ##a/b##.
 
  • Like
Likes cookiemnstr510510

Similar threads

Replies
8
Views
3K
Replies
3
Views
4K
Replies
5
Views
2K
Replies
1
Views
2K
Replies
9
Views
2K
Replies
8
Views
3K
Back
Top