Displaying fractions with slashes instead of stacked fractions in LaTeX
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
13 replies · 5K views
Discussion
Physics news on Phys.org
Science Advisor
Homework Helper
- 9,581
- 4,813
For that, you do not need to use the LaTex frac. You can just type it in. I have never had a problem nesting LaTex formats, but I am not a "power user".DaveE said:Is there a better way to get fractions to display like ## \rm{(a+b)/(c+d)}## instead of ## \frac{a+b}{c+d}##? Sometimes I'd like LaTex to do formatting "inside" the fraction; let's say with an integral symbol, for example.
- 20,819
- 28,467
I'm not sure I understood the question. Where exactly is the problem?
Science Advisor
Gold Member
2025 Award
- 4,600
- 4,323
I might not have eitherfresh_42 said:I'm not sure I understood the question. Where exactly is the problem?
I was thinking that maybe someone would just say try "\ifrac{}{}" instead. BTW, I know, I made that one up, there is no \ifrac (I think).
I guess the simplest version is how do I do this with a command as simply as \frac instead of turning off their formatting and doing it myself inside of \rm. I'm suspecting not since I'm not hearing a simple answer.
Science Advisor
Homework Helper
- 9,581
- 4,813
Or the answer is so simple that we don't know what more to say. Just type it in. If you have an example of a problem with nested LaTex formats, maybe someone can help. You may need to backslash some special characters for LaTex to take them literally.
Science Advisor
Gold Member
2025 Award
- 4,600
- 4,323
Yes, I think you're right. This stuff isn't so bad. Unless you think it's supposed to make sense, LOL.FactChecker said:Or the answer is so simple that we don't know what more to say. Just type it in. If you have an example of a problem with nested LaTex formats, maybe someone can help. You may need to backslash some special characters for LaTex to take them literally.
## \sum_{n=0}^\infty a_n x^n ## / ## \int_0^t H(t-\tau) \, d\tau ##
## \int_0^t \frac{sin(t-\tau)}{(t-\tau)} \, d\tau ## / ##
\begin{vmatrix}
1 & 2 & 3 & 4 \\
a & b & c & d \\
x & y & z & w
\end{vmatrix} ##
- 20,819
- 28,467
Do you mean something like that?
$$
\dfrac{ \displaystyle{\sum_{n=0}^\infty a_n x^n }}{ \displaystyle{\int_0^t H(t-\tau) \, d\tau }}
$$
$$ \dfrac{ \displaystyle{\int_0^t \dfrac{sin(t-\tau)}{(t-\tau)} \, d\tau }}{
\det\left(\begin{matrix}
1 & 2 & 3 & 4 \\
a & b & c & d \\
x & y & z & w
\end{matrix}\right)}$$
$$
\dfrac{ \displaystyle{\sum_{n=0}^\infty a_n x^n }}{ \displaystyle{\int_0^t H(t-\tau) \, d\tau }}
$$
$$ \dfrac{ \displaystyle{\int_0^t \dfrac{sin(t-\tau)}{(t-\tau)} \, d\tau }}{
\det\left(\begin{matrix}
1 & 2 & 3 & 4 \\
a & b & c & d \\
x & y & z & w
\end{matrix}\right)}$$
Science Advisor
Homework Helper
- 9,581
- 4,813
Are you happy with that? It seems to be a natural consequence of what you asked for, although I would recommend that you at least enclose the numerator and denominator in parenthesis to make it clearer. But you would also have to do that if you wrote it by hand.DaveE said:Yes, I think you're right. This stuff isn't so bad. Unless you think it's supposed to make sense, LOL.
## \sum_{n=0}^\infty a_n x^n ## / ## \int_0^t H(t-\tau) \, d\tau ##
## \int_0^t \frac{sin(t-\tau)}{(t-\tau)} \, d\tau ## / ##
\begin{vmatrix}
1 & 2 & 3 & 4 \\
a & b & c & d \\
x & y & z & w
\end{vmatrix} ##
If you want the forward slash to be larger, you can use \big, \Big, \bigg, and \Bigg in LaTex to make progressively larger slashes. This is \Bigg:
## \int_0^t \frac{sin(t-\tau)}{(t-\tau)} \, d\tau \Bigg /
\begin{vmatrix}
1 & 2 & 3 & 4 \\
a & b & c & d \\
x & y & z & w
\end{vmatrix} ##
- 20,819
- 28,467
Or even easier (and I think better to read) ...FactChecker said:Are you happy with that? It seems to be a natural consequence of what you asked for, although I would recommend that you at least enclose the numerator and denominator in parenthesis to make it clearer. But you would also have to do that if you wrote it by hand.
If you want the forward slash to be larger, you can use \big, \Big, \bigg, and \Bigg in LaTex to make progressively larger slashes. This is \Bigg:
## \int_0^t \frac{sin(t-\tau)}{(t-\tau)} \, d\tau \Bigg /
\begin{vmatrix}
1 & 2 & 3 & 4 \\
a & b & c & d \\
x & y & z & w
\end{vmatrix} ##
$$
\begin{vmatrix}
1 & 2 & 3 & 4 \\
a & b & c & d \\
x & y & z & w
\end{vmatrix}^{-1} \displaystyle{\int_0^t \dfrac{sin(t-\tau)}{(t-\tau)} \, d\tau}
$$
... if not even define ##A^{-1}:=
\begin{pmatrix}
1 & 2 & 3 & 4 \\
a & b & c & d \\
x & y & z & w
\end{pmatrix}## and write ##
\displaystyle{\int_0^t |\det(A)|\dfrac{sin(t-\tau)}{(t-\tau)} \, d\tau}## which immediately refers to the transformation theorem: https://en.wikipedia.org/wiki/Integration_by_substitution#Substitution_for_multiple_variables
Science Advisor
Gold Member
2025 Award
- 4,600
- 4,323
Nope. That's the normal (i.e. good) way to format these, LOL.fresh_42 said:Do you mean something like that?
$$
\dfrac{ \displaystyle{\sum_{n=0}^\infty a_n x^n }}{ \displaystyle{\int_0^t H(t-\tau) \, d\tau }}
$$
$$ \dfrac{ \displaystyle{\int_0^t \dfrac{sin(t-\tau)}{(t-\tau)} \, d\tau }}{
\det\left(\begin{matrix}
1 & 2 & 3 & 4 \\
a & b & c & d \\
x & y & z & w
\end{matrix}\right)}$$
Science Advisor
Gold Member
2025 Award
- 4,600
- 4,323
I think this is as good as it can get. I didn't really know about \big, thanks.FactChecker said:Are you happy with that? It seems to be a natural consequence of what you asked for, although I would recommend that you at least enclose the numerator and denominator in parenthesis to make it clearer. But you would also have to do that if you wrote it by hand.
If you want the forward slash to be larger, you can use \big, \Big, \bigg, and \Bigg in LaTex to make progressively larger slashes. This is \Bigg:
## \int_0^t \frac{sin(t-\tau)}{(t-\tau)} \, d\tau \Bigg /
\begin{vmatrix}
1 & 2 & 3 & 4 \\
a & b & c & d \\
x & y & z & w
\end{vmatrix} ##
Last edited:
Science Advisor
Gold Member
2025 Award
- 4,600
- 4,323
Yes, these are better. The example was arbitrary and stupid just to show a more complex problem than ##\frac{a}{b}##.fresh_42 said:Or even easier (and I think better to read) ...
$$
\begin{vmatrix}
1 & 2 & 3 & 4 \\
a & b & c & d \\
x & y & z & w
\end{vmatrix}^{-1} \displaystyle{\int_0^t \dfrac{sin(t-\tau)}{(t-\tau)} \, d\tau}
$$
... if not even define ##A^{-1}:=
\begin{pmatrix}
1 & 2 & 3 & 4 \\
a & b & c & d \\
x & y & z & w
\end{pmatrix}## and write ##
\displaystyle{\int_0^t |\det(A)|\dfrac{sin(t-\tau)}{(t-\tau)} \, d\tau}## which immediately refers to the transformation theorem: https://en.wikipedia.org/wiki/Integration_by_substitution#Substitution_for_multiple_variables
Science Advisor
Homework Helper
- 9,581
- 4,813
You are not alone. When I am doing anything slightly complicated in LaTex I end up Googling it. Even if I know a trick today, next week I will have to Google it again. :-) I had to Google this to answer your question.DaveE said:I think this is as good as it can get. I didn't really know about \big, thanks.
- 20,819
- 28,467
I have loaded my keyboard with 67 shortcuts. As a result, I use these all the time rather than learning new ones. And if, as your useful big-enlargements, I'll probably forget them again.FactChecker said:You are not alone. When I am doing anything slightly complicated in LaTex I end up Googling it. Even if I know a trick today, next week I will have to Google it again. :-) I had to Google this to answer your question.
Similar threads
LaTeX How do I write fractions in LaTeX?
- cookiemnstr510510
- · Replies 11 ·
- MATLAB, Maple, Mathematica, LaTeX
- Replies
- 11
Mathematica Moving variables outside fractions in Mathematica
- Silviu
- · Replies 7 ·
- MATLAB, Maple, Mathematica, LaTeX
- Replies
- 7
Slashed fraction instead of vertical one
- TheBigBadBen
- · Replies 13 ·
- MATLAB, Maple, Mathematica, LaTeX
- Replies
- 13
LaTeX Parentheses around mismatched size fractions in LaTeX
- wolfbd
- · Replies 2 ·
- MATLAB, Maple, Mathematica, LaTeX
- Replies
- 2
LaTeX How do I auto-fit brackets and fractions in Latex without using \Bigg?
- squenshl
- · Replies 1 ·
- MATLAB, Maple, Mathematica, LaTeX
- Replies
- 1
Reducing three fractions with l, m, n variables without auxiliary variable
- brotherbobby
- · Replies 3 ·
- Precalculus Mathematics Homework Help
- Replies
- 3
Partial fractions with complex linear terms
- zenterix
- · Replies 8 ·
- Calculus and Beyond Homework Help
- Replies
- 8
Mathematica How to type mathematical equations using LaTeX
- Greg Bernhardt
- · Replies 3 ·
- MATLAB, Maple, Mathematica, LaTeX
- Replies
- 3
High School "Neighbor fractions" in Gelfand's Algebra
- xwolfhunter
- · Replies 1 ·
- General Math
- Replies
- 1
Why are the numerators constants in partial fractions with quadratic factors?
- Mr Davis 97
- · Replies 7 ·
- Calculus and Beyond Homework Help
- Replies
- 7