- #1
TheBigBadBen
- 80
- 0
Is there any way to nicely LaTeX a "slashed" fraction? In other words, if I want to write $a_1/a_2$ instead of $\frac{a_1}{a_2}$ or even $\dfrac{a_1}{a_2}$, is there a way to make it look nice?
\documentclass{article}
\usepackage{units}
\begin{document}
$\nicefrac{a_1}{a_2}$
\end{document}
What exactly is ugly about $a_1/a_2$, i.e., what do you want to change? The nicefrac package makes the numerator and denominator smaller and moves them closer to the slash; that's what is calls "nice" as opposed to fractions with regular slash, which it calls "ugly". This is debatable. The StackOverflow method simply makes the height of the slash equal to the height of its arguments.TheBigBadBen said:Is there any way to nicely LaTeX a "slashed" fraction? In other words, if I want to write $a_1/a_2$ instead of $\frac{a_1}{a_2}$ or even $\dfrac{a_1}{a_2}$, is there a way to make it look nice?
TheBigBadBen said:
That applies especially in exponents. I always write $x^{1/2}$ in preference to $x^{\frac12}$, also \(\displaystyle \int_{-\pi/2}^{\pi/2}f(t)\,dt\) rather than \(\displaystyle \int_{-\frac\pi2}^{\frac\pi2}f(t)\,dt\).Evgeny.Makarov said:Another advice from the TeXbook is not to overuse \frac (or, rather, \over in plain TeX). E.g., instead of $\dfrac{\frac{a}{b}}{2}$ it is recommended to type $\dfrac{a/b}{2}$.
Evgeny.Makarov said:What exactly is ugly about $a_1/a_2$, i.e., what do you want to change? The nicefrac package makes the numerator and denominator smaller and moves them closer to the slash; that's what is calls "nice" as opposed to fractions with regular slash, which it calls "ugly". This is debatable. The StackOverflow method simply makes the height of the slash equal to the height of its arguments.
\newcommand{\name}{% name is whatever you want to call it
\leavevmode
\begingroup
\setbox 2 = \hbox {\small \(a_1\)}%
\setbox 0 = \hbox {/}%
\dimen 0 = \ht 0 \advance \dimen 0 by -\ht 2
\raise \dimen 0 \box 2
\kern -0.3333\wd0/\kern -0.3333\wd 0
\lower \dp 0 \hbox {\small \(a_2\)}%
\endgroup
}
\begin{document}
something \name\space something
\end{document}
I like Serena said:Here's an overview, using MiKTeX.
http://www.mathhelpboards.com/attachment.php?attachmentid=875
TheBigBadBen said:I can't view your attachment
A slashed fraction, also known as a solidus or virgule, is a diagonal line that is used to represent division or fractions instead of a traditional vertical line.
Slashed fractions are commonly used in mathematics and science because they are easier to read and write. They also take up less space, making them more efficient in mathematical expressions and equations.
No, there are no differences in meaning between a slashed fraction and a vertical one. They both represent the same concept of division or fractions.
Yes, slashed fractions can be used in any mathematical expression where division or fractions are involved. They are particularly useful in complex equations where multiple fractions are present.
Slashed fractions are commonly used in chemistry to represent molar ratios, in physics to represent unit conversions, and in biology to represent population growth rates. They are also used in statistics to represent probability and in engineering to represent unit costs.