如何排版水平“翻转”的 \nicefrac?

如何排版水平“翻转”的 \nicefrac?

该命令\nicefrac{a}{b}显示为a / b 。是否有针对b \ a的类似命令?

答案1

使用包中的 reflectbox 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}

在此处输入图片描述

答案2

您可以选择更多方案:

% 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

相关内容