我经常使用数学环境中的包中的 $x^{ \scalebox{0.55}{(n)} }_{i}$,效果很好\scalebox
。graphics
但是,我无法在图形标题中使用相同的序列:
\begin{figure}
test
\caption{test $x^{ \scalebox{0.55}{(n)} }_{i}$}
\end{figure}
错误信息如下:
! Argument of \@caption has an extra }.
<inserted text>
\par
l.20 ...ion{test $x^{ \scalebox{0.55}{(n)} }_{i}$}
Runaway argument?
\@captype {\Gscale@box {0.55}}\def \reserved@b {\Gscale@box {0.55}[0.\ETC.
! Paragraph ended before \@caption was complete.
\<to be read again>
\par
l.20 ...ion{test $x^{ \scalebox{0.55}{(n)} }_{i}$}
\scalebox
在标准文本中的数学环境之外使用时也会出现同样的错误。
有没有其他方法可以调整标题文本的部分大小,特别是在数学环境中?
%% ---------- 编辑:最小示例中的解决方案 ----------------------
\documentclass[letterpaper,10pt]{article} % usually I am working with IEEEtran
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\begin{document}
$x^{ \scalebox{0.55}{$(n)$} }_{i}$ % in standard text
\begin{figure} % using \protect as suggested by Herbert
test
\caption{test $x^{ \protect\scalebox{0.55}{$(n)$} }_{i}$}
\end{figure}
\begin{figure} % without \scalebox as suggested by egreg and tohecz
test
\caption{test $x^{ \scriptscriptstyle(\!n\!) }_{i}$}
\end{figure}
\end{document}
答案1
使用\protect
\caption{test $x^{\protect\scalebox{0.55}{(n)} }_{i}$}