我想\mathsmaller
在章节标题中使用,但它与 不兼容hyperref
。以下是 MWE:
\documentclass{book}
\usepackage{amsmath} %automatically loads ansbsy which gives \boldsymbol
\usepackage{relsize}
\usepackage{hyperref}
\begin{document}
$\mathcal{SQUARING}^{+}$%compiles
$\mathsmaller{SQUARING^{+}}$%compiles
$\mathsmaller{\mathcal{SQUARING}^{+}}$%compiles
\section{$\mathcal{SQUARING}^{+}$ }%compiles
%\section{Function $\mathsmaller{SQUARING}^{+}$ }%does NOT compile with hyperref
%\section{Function $\mathsmaller{\mathcal{SQUARING}^{+}}$}%does NOT compiles with hyperref
\end{document}
答案1
- 看看
\texorpdfstring
宏,用于分段标题。第二个参数——要写入 pdf 书签的材料——不应包含 TeX 类型的数学代码。 - 我个人认为结果看起来相当丑陋:)。
\documentclass{article}
\usepackage{amsmath}
\usepackage{relsize}
\usepackage{hyperref}
\begin{document}
$\mathcal{SQUARING}^{+}$%compiles
$\mathsmaller{SQUARING^{+}}$%compiles
$\mathsmaller{\mathcal{SQUARING}^{+}}$%compiles
% note the use of \texorpdfstring in `\section` directives
\section{%
\texorpdfstring{$\mathcal{SQUARING}^{+}$}% Code for text
{SQUARING+}% Code for PDF bookmark
}
\section{%
\texorpdfstring{$\mathsmaller{SQUARING}^{+}$}% Code for text
{SQUARING+}% Code for PDF bookmark
}
\end{document}
编辑 2022-01-26
% 3rd Version
\section{%
\texorpdfstring{$\mathsmaller{\mathcal{SQUARING}^{+}}$}% Code for text
{SQUARING+}% Code for PDF bookmark
}
% 4th Version
\section{%
\texorpdfstring{$\mathsmaller{\mathtt{SQUARING}^{+}}$}% Code for text
{SQUARING+}% Code for PDF bookmark
}