moderncv의 섹션 제목에 있는 TikZ

moderncv의 섹션 제목에 있는 TikZ

나는 아주 무작위로 실험을 하고 있었고 섹션 제목에 TikZ를 삽입하는 것에 대해 궁금해했습니다.

를 사용하면 article

\documentclass{article}
\usepackage{tikz}
\newcommand{\my}{\tikz\draw (0,0) circle (5pt);}

\begin{document}
\section{Introduction \protect\my}
\end{document}

공장.

하지만 를 사용하면 moderncv

\documentclass{moderncv}
\usepackage{tikz}
\moderncvstyle{classic}
\newcommand{\my}{\tikz\draw (0,0) circle (5pt);}

\begin{document}
\section{Introduction \protect\my}
\end{document}

작동하지 않습니다.

왜?

답변1

, 및 로드 hyperref사이 에 충돌이 있습니다 .tikzmoderncvhyperref

해결 방법에는 \texorpdfstring명령을 정의하는 데 사용하는 것이 포함됩니다.

이 같은:

\texorpdfstring{tikz code}{alternative (empty)}

MWE는 다음과 같아야 합니다.

\documentclass{moderncv}
\usepackage{tikz}
\moderncvstyle{classic}
\newcommand{\my}{\texorpdfstring{\tikz\draw (0,0) circle (5pt);}{}}
\firstname{John}
\familyname{Doe}

\begin{document}
\section{Introduction \protect\my}
\end{document}

관련 정보