선택적 인수가 있는 명령에 대한 pdfstringdefDisableCommands(비머 각주)

선택적 인수가 있는 명령에 대한 pdfstringdefDisableCommands(비머 각주)

PDF 문자열의 비머 프레임 제목에서 , 등을 \cite제거 하려고 합니다 . \footnote를 사용하여 모든 프레임 제목에 대한 북마크를 생성하므로 \bookmark[page=\the\c@page,level=3]{\beamer@frametitle}프레임 제목에 이러한 명령이 나타날 때마다 문제가 발생합니다. 를 사용하여 이러한 문제를 수동으로 해결할 수 있다는 것을 알고 있지만 \texorpdfstring이러한 오류는 놓치기 쉽기 때문에 "그냥 작동하는" 기본값을 갖고 싶습니다.

\boldmath이는 and 의 기본 경우에는 괜찮지 \cite{key}만 다음과 같은 선택적 매개변수가 있는 명령에서는 작동하지 않습니다.

\footnote[frame]{footnote text}

나는 예를 들어 시도했다

\pdfstringdefDisableCommands{%
  \def\boldmath{}% easy case you'll find in many examples
  \def\cite{\@gobble}% supposedly does not work with optionals either
  \renewcommand<>{\footnote}[1][]{}%
}

하지만 그건 작동하지 않습니다.

최소한으로 작동하는 예(문제는 PDF에 있음)북마크!):

\documentclass{beamer}
\usepackage{hyperref,bookmark}
\makeatletter
\setbeamertemplate{frametitle}{\insertframetitle
  \bookmark[page=\the\c@page,level=3]{\beamer@frametitle}}
\makeatother

\begin{document}
\begin{frame}{Frametitle \footnote[frame]{Footnote}}
  Frame text
\end{frame}
\end{document}

이 파일에는 "프레임 제목 [프레임]각주"와 같은 북마크가 있습니다. 나는 "프레임 제목"만 원합니다. 그리고 저는 이 문제를 로컬이 아닌 전역적으로 래핑하여 해결하고 싶습니다 \texorpdfstring{\footnote[frame]{Footnote}}{}(이 방법은 작동하지만 모든 문제가 있는 프레임을 개별적으로 처리해야 함). 북마크 관련 문제

답변1

\documentclass{beamer}
\usepackage{hyperref,bookmark}
\usepackage{xparse}
\makeatletter
\setbeamertemplate{frametitle}{\insertframetitle
  \bookmark[page=\the\c@page,level=3]{\beamer@frametitle}}
\makeatother
\NewExpandableDocumentCommand\gobbleoptandarg{om}{}
\pdfstringdefDisableCommands{\let\footnote\gobbleoptandarg}%
\begin{document}
\begin{frame}{Frametitle \footnote[frame]{Footnote}}
  Frame text
\end{frame}
\end{document}

관련 정보