9

How does one produce a backslash fraction? That is, something like 2\1 with the 1 above the 2.

4
  • Please draw a picture. Oct 19, 2016 at 14:25
  • Do you mean \frac{1}{2}, using amsmath ?
    – user30471
    Oct 19, 2016 at 14:33
  • 3
    Interesting idea, but also (I'm just curious) why would you write a fraction this way? I spend so much time in classes trying to get the students not to use a slanted lines for fractions 'cause it inevitably leads to all sorts of mistakes. Or, does it have special meaning?
    – A.Ellett
    Oct 19, 2016 at 22:06
  • 2
    @A.Ellett I think it was the musical time-signature notation used by that famous American composer, Burt Back-a-frac. ;^) Oct 21, 2016 at 14:43

2 Answers 2

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}

enter image description here

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$}}}
3
  • 5
    Oh, that's what the bs stands for...
    – MCMastery
    Oct 19, 2016 at 18:39
  • 2
    @MCMastery Apparently, my efforts to use mnemonic devices to name macros sometimes can be misunderstood...tex.stackexchange.com/questions/167670/… Oct 19, 2016 at 18:42
  • You can even further shorten the definition of bsfrac to \newcommand{\bsfrac}[2]{\reflectbox{\nicefrac[\reflectbox]{#1}{#2}}} Sep 20, 2017 at 11:47
6

A shorter less elegant way is to simply use:

$^1$/$_2$ %or
$_1 \backslash ^2$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .