
\mathbb
tcolorbox 정리의 제목에 를 사용하면 오류 메시지가 나타납니다 . MWE는 다음과 같습니다.
\documentclass{article}
\usepackage{amsfonts}
\usepackage{tcolorbox}
\tcbuselibrary{theorems}
\newtcbtheorem{boxtheorem}{Theorem}{}{thm}
\begin{document}
\begin{boxtheorem}{This is the problem: $\mathbb{N}$}{}
This is fine: $\mathbb{N}$
\end{boxtheorem}
\end{document}
다음은 네 가지 오류 메시지입니다.
! Undefined control sequence.
\GenericError ...
#4 \errhelp \@err@ ...
! Undefined control sequence.
\GenericError ...
\let \@err@ ...
! Undefined control sequence.
\GenericError ...
\@empty \def \MessageBreak...
! Undefined control sequence.
\GenericError ...
\endgroup
MiKTeX 2.9를 사용합니다. 새로 설치되며 모든 패키지와 형식이 업데이트됩니다. 놀랍게도 그게 문제인 것 같습니다. 다른 컴퓨터에서 이전 패키지를 사용하여 동일한 문서를 컴파일하면 문제가 없습니다. 하지만 오래된 패키지에 의존하는 것은 장기적으로 지속 가능하지 않기 때문에 최신 패키지로 문제를 해결하는 방법을 찾아야 합니다. 누구든지 나를 도와줄 수 있나요?
답변1
업데이트
2016/11/18에 출시된 버전 3.96 부터 tcolorbox
버그가 수정되었습니다.
원래 답변
다음은 나쁜 버그입니다 tcolorbox
. 매크로는 대신에 \tcb@gettitle
수행합니다 .\edef
\protected@edef
많은명령은 실패할 뿐만 아니라 \mathbb
( \emph
예를 들어 를 생각해 보세요).
잘못된 매크로를 다시 정의하여 문제를 해결할 수 있습니다.
\documentclass{article}
\usepackage{amsfonts}
\usepackage{tcolorbox}
\tcbuselibrary{theorems}
\newtcbtheorem{boxtheorem}{Theorem}{}{thm}
\makeatletter
\def\tcb@gettitle#1{\protected@edef\@currentlabelname{#1}}
\makeatother
\begin{document}
\begin{boxtheorem}{This is the \emph{problem}: $\mathbb{N}$}{}
This is fine: $\mathbb{N}$
\end{boxtheorem}
\end{document}
답변2
명령을 강력하게 만들 수 있습니다.
\documentclass{article}
\usepackage{amsfonts}
\usepackage{tcolorbox}
\tcbuselibrary{theorems}
\newtcbtheorem{boxtheorem}{Theorem}{}{thm}
\usepackage{etoolbox}
\robustify\mathbb
\begin{document}
\begin{boxtheorem}{This is the problem: $\mathbb{N}$}{}
This is fine: $\mathbb{N}$
\end{boxtheorem}
\end{document}