How to create a backslash fraction?

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$}}}

A shorter less elegant way is to simply use:

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

Tags:

Fractions