![如何排版水平“翻转”的 \nicefrac?](https://linux22.com/image/361594/%E5%A6%82%E4%BD%95%E6%8E%92%E7%89%88%E6%B0%B4%E5%B9%B3%E2%80%9C%E7%BF%BB%E8%BD%AC%E2%80%9D%E7%9A%84%20%5Cnicefrac%EF%BC%9F.png)
该命令\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