我希望度數符號周圍的框與 上指數周圍的框一樣x
。我以為\mbox{}
會這樣做,但在這種情況下似乎沒有。
代碼:
\documentclass{article}
\usepackage{siunitx}
\let\OldSIUnitSymbolDegree\SIUnitSymbolDegree
\renewcommand{\SIUnitSymbolDegree}{\fboxsep=0pt\fbox{\mbox{\ensuremath{\OldSIUnitSymbolDegree}}}}
\begin{document}
\ang{60} \SI{60}{\degree}
$x^{\fboxsep=0pt\fbox{$\scriptstyle 2$}}$ % <-- want a tight box like this
\end{document}
答案1
你需要把盒子裡面上標並允許緊排,類似
\documentclass{article}
\usepackage{siunitx}
\renewcommand\SIUnitSymbolDegree
{\ensuremath{^{\fboxsep=0pt\fbox{\ensuremath{\kern-\scriptspace\scriptstyle\circ\kern-2\scriptspace}}}}}
\begin{document}
\ang{60} \SI{60}{\degree}
\end{document}