\eqref 位于 \section 内

\eqref 位于 \section 内

请考虑以下示例:

\documentclass{article}

\usepackage{amsmath}
\usepackage{hyperref}

\begin{document}

\begin{align}
 \label{func1a}
  U(X,Y)
  &= 2X + 5Y,\\
 \label{func1b}
  U(X,Y)
  &= (XY)^{0.5},\\
 \label{func1c}
  U(X,Y)
  &= \min(X,Y).
\end{align}

\section{The function~\eqref{func1a}}

\end{document}

这将产生以下警告:

Package hyperref Warning: Token not allowed in a PDF string (PDFDocEncoding):
(hyperref)                removing `\hbox' on input line 20.


Package hyperref Warning: Token not allowed in a PDF string (PDFDocEncoding):
(hyperref)                removing `\mathsurround' on input line 20.


Package hyperref Warning: Token not allowed in a PDF string (PDFDocEncoding):
(hyperref)                removing `\z@' on input line 20.


Package hyperref Warning: Token not allowed in a PDF string (PDFDocEncoding):
(hyperref)                removing `\unskip' on input line 20.


Package hyperref Warning: Token not allowed in a PDF string (PDFDocEncoding):
(hyperref)                removing `\@@italiccorr' on input line 20.

我该如何解决?

PS 这些警告是由于hyperref

答案1

hyperref能够应付\ref但不能\eqref;你可以这样教它:

\documentclass{article}

\usepackage{amsmath}
\usepackage{hyperref}
\pdfstringdefDisableCommands{\def\eqref#1{(\ref{#1})}}


\begin{document}

\begin{align}
 \label{func1a}
  U(X,Y)
  &= 2X + 5Y,\\
  \label{func1b}
  U(X,Y)
  &= (XY)^{0{.}5},\\
  \label{func1c}
  U(X,Y)
  &= \min(X,Y).
\end{align}

\section{The function~\eqref{func1a}}

\end{document}

在此处输入图片描述

相关内容