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}

在此处输入图片描述

相关内容