
私はかなりランダムに実験していて、セクションの見出しにいくつかの 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
これはとの間に矛盾がありtikz
、moderncv
は をロードしますhyperref
。
解決策としては、 を使用し\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}