tikz 標籤中的特殊字符

tikz 標籤中的特殊字符

我有這個代碼:

\documentclass[tikz]{standalone}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage[frenchb]{babel}
\usetikzlibrary{decorations.text,}
\begin{document}
\sffamily
\begin{tikzpicture}[
    circle label/.style = {
        postaction={
            decoration={
                text along path,
                text = {#1},
                text align=center,
                reverse path,
            },
        decorate,
    }
    }
]
   \filldraw[white] (-5,-5) rectangle (5,5);
   \path[circle label={Text with spécial character}] (0,-1.2) arc (-90:360-90:1.2);
   \draw[dotted] (0,0) circle (1);
\end{tikzpicture}
\end{document}

我在列印包含特殊字元 (é) 的文字時遇到問題。是否可以有帶有特殊字元的標籤?如果是的話怎麼辦?

答案1

使用 {} 表示特殊字元。

\documentclass[tikz]{standalone}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage[frenchb]{babel}
\usetikzlibrary{decorations.text,}
\begin{document}
\sffamily
\begin{tikzpicture}[
    circle label/.style = {
        postaction={
            decoration={
                text along path,
                text = {#1},
                text align=center,
                reverse path,
            },
        decorate,
    }
    }
]
   \filldraw[white] (-5,-5) rectangle (5,5);
   \path[circle label={Text with sp{é}cial character}] (0,-1.2) arc (-90:360-90:1.2);
   \draw[dotted] (0,0) circle (1);
\end{tikzpicture}
\end{document}

在此輸入影像描述

相關內容