Writing Fractions in LaTeX Easily

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

Discussion Overview

The discussion revolves around how to write fractions in LaTeX, focusing on formatting equations for clarity in a forum context. Participants share their experiences and seek assistance with specific LaTeX commands and formatting practices.

Discussion Character

  • Technical explanation
  • Homework-related

Main Points Raised

  • One participant expresses difficulty in writing fractions like 1/2 in a horizontal format using LaTeX, specifically mentioning attempts with \frac{a}{b} and \left (\frac a b \right).
  • Another participant confirms that \frac{a}{b} works when typed within LaTeX brackets, providing an example output.
  • A participant suggests that the original poster may be missing steps in using LaTeX correctly.
  • Clarifications are provided regarding the use of double dollar signs for new line LaTeX and double pound signs for inline LaTeX.
  • Participants mention alternative commands like \dfrac for display style fractions and \tfrac for text mode fractions, explaining their differences in formatting.
  • One participant notes a personal preference for avoiding fractions in inline text, opting instead for a/b.

Areas of Agreement / Disagreement

Participants generally agree on the functionality of the LaTeX commands discussed, but there is no consensus on the best practices for using fractions in inline versus display formats.

Contextual Notes

Some participants express uncertainty about the specific steps required to use LaTeX effectively, indicating potential gaps in understanding the formatting rules.

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   Reactions: 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   Reactions: cookiemnstr510510
$$\frac{a}{b}$$
 
  • Like
Likes   Reactions: 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   Reactions: cookiemnstr510510
  • #11
No problem. :)
 
  • Like
Likes   Reactions: 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   Reactions: cookiemnstr510510

Similar threads

  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 5 ·
Replies
5
Views
5K
  • · Replies 3 ·
Replies
3
Views
4K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 13 ·
Replies
13
Views
2K
  • · Replies 9 ·
Replies
9
Views
3K
  • · Replies 7 ·
Replies
7
Views
3K
  • · Replies 11 ·
Replies
11
Views
9K
  • · Replies 8 ·
Replies
8
Views
3K