5

The command \nicefrac{a}{b} renders as a/b. Is there a similar command for b\a?

2 Answers 2

9

Use reflectbox from package graphicx:

\documentclass{article}

\usepackage{graphicx, nicefrac}
\let\rfb\reflectbox

\newcommand{\uglyfrac}[2]{\rfb{\nicefrac{\rfb{#1}}{\rfb{#2}}}}

% for math mode, you can use:

\newcommand{\muglyfrac}[2]{\uglyfrac{\ensuremath{#1}}{\ensuremath{#2}}}


\begin{document}

joe \nicefrac{a}{b} blow

joe \uglyfrac{a}{b} blow

$ joe\: \muglyfrac{a}{b}\: blow$


\end{document}

enter image description here

0
1

You can select between more alternatives:

% simply using math mode:

\def\uglyfrac#1#2{\leavevmode\hbox{${}_{\rm#2}{\mkern-4mu\backslash\mkern-4mu}^{\rm#1}$}}

% using \lower, \raise, you can simply control the amount of raising, lowering: 

joe \uglyfrac{a}{b} blow.

\def\uglyfrac#1#2{\leavevmode\lower.4ex\hbox{$\scriptstyle\rm#2$}\kern-.2em
   $\backslash$\kern-.2em\raise.9ex\hbox{$\scriptstyle\rm#1$}}

joe \uglyfrac{a}{b} blow.

% using OpTeX for doing current font smaller:

\def\uglyfrac#1#2{\leavevmode\lower.4ex\hbox{\setfontsize{mag.7}\currvar#2}\kern-.2em
   $\backslash$\kern-.2em\raise.9ex\hbox{\setfontsize{mag.7}\currvar#1}}

joe \uglyfrac{a}{b} blow

% using LaTeX's NFSS for doing current font smaller

\def\uglyfrac#1#2{\leavevmode\lower.4ex\hbox{\fontsize{7}{7}\selectfont #2}\kern-.2em
   $\backslash$\kern-.2em\raise.9ex\hbox{\fontsize{7}{7}\selectfont #1}}

joe \uglyfrac{a}{b} blow

You must log in to answer this question.

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