How does one produce a backslash fraction? That is, something like 2\1 with the 1 above the 2.
Asked
Active
Viewed 1.0k times
9
Torbjørn T.
- 206,688
Jim
- 223
2 Answers
17
I chose to use math mode to set the argument of \bsfrac, even though I notice that \nicefrac sets in text mode. The behavior can be changed for \bsfrac with the removal of the $ characters.
\documentclass{article}
\usepackage{graphicx,nicefrac}
\newcommand\bsfrac[2]{%
\scalebox{-1}[1]{\nicefrac{\scalebox{-1}[1]{$#1$}}{\scalebox{-1}[1]{$#2$}}}%
}
\begin{document}
A nice fraction: \nicefrac{55}{23} or \nicefrac{$(x-1)$}{$x$}.
And here is \bsfrac{55}{23} or \bsfrac{(x-1)}{x}.
\end{document}
One can simplify the definition as
\newcommand\bsfrac[2]{\reflectbox{\nicefrac{\reflectbox{$#1$}}{\reflectbox{$#2$}}}}
or even, as Máté suggests,
\newcommand\bsfrac[2]{\reflectbox{\nicefrac[\reflectbox]{$#1$}{$#2$}}}
Steven B. Segletes
- 237,551
-
5
-
2@MCMastery Apparently, my efforts to use mnemonic devices to name macros sometimes can be misunderstood...http://tex.stackexchange.com/questions/167670/umlaut-dots-in-a-different-color/167674#167674 – Steven B. Segletes Oct 19 '16 at 18:42
-
You can even further shorten the definition of
bsfracto\newcommand{\bsfrac}[2]{\reflectbox{\nicefrac[\reflectbox]{#1}{#2}}}– Máté Wierdl Sep 20 '17 at 11:47

\frac{1}{2}, using amsmath ? – Oct 19 '16 at 14:33;^)– Steven B. Segletes Oct 21 '16 at 14:43