我想知道为什么我不能直接使用 ß:。decoration={text={heißer Dampf}
如果我这样做,pdflatex 会抛出一个错误:“Package inputenc 错误:无效的 UTF-8 字节”。我不明白为什么它不适用于装饰文本。解决方法是用 {\ ss} 替换 ß,但这并不令人满意。装饰文本和 UTF8 的实现有什么问题?
\documentclass{standalone}
\usepackage[utf8]{inputenc}%Die Textdateien sind mit Unicode-Kodierung
\usepackage{pgf,tikz}
\usetikzlibrary{mindmap,shadows,positioning,fit,petri,backgrounds,shapes,arrows,through,calc,decorations.text,decorations.markings,intersections,fpu,circuits.ee.IEC,babel}
\begin{document}
\begin{tikzpicture}
[node distance=3cm and 3cm,on grid,auto,align=center,thick,
Schritt/.style={rectangle,
draw=black,inner sep=5pt,
execute at begin node=\hspace{0pt},%allow first word to break
},
Pfeil/.style={>=latex, ultra thick,->,bend angle=35, bend left, postaction=decorate,
decoration={raise=4pt, text align=center, text along path}}
]
\begin{scope}
\node (Mitte) {};%Hilfsnode für die Mitte
\node[Schritt] (Schritt1) [above=of Mitte] {großer Dampferzeuger};
\node[Schritt] (Schritt2) [right=of Mitte] {Turbine};
\node[Schritt] (Schritt3) [below=of Mitte] {Kondensator};
\node[Schritt] (Schritt4) [left=of Mitte] {Kesselwasser-\\speisepumpe};
\draw [Pfeil,decoration={text={hei{\ss}er Dampf}}] (Schritt1) to (Schritt2);
\draw [Pfeil,decoration={text={warmer Dampf},reverse path}] (Schritt2) to (Schritt3);
\draw [Pfeil,decoration={text={Wasser},reverse path}] (Schritt3) to (Schritt4);
\draw [Pfeil,decoration={text={Wasser}}] (Schritt4) to (Schritt1);
\end{scope}
\end{tikzpicture}
\end{document}
答案1
装饰逐个标记工作,由于 ß 在 utf8 中由两个字节组成,因此它被拆分。如果您用括号保护它,它就会起作用:
\documentclass{standalone}
\usepackage[utf8]{inputenc}%Die Textdateien sind mit Unicode-Kodierung
\usepackage{pgf,tikz}
\usetikzlibrary{mindmap,shadows,positioning,fit,petri,backgrounds,shapes,arrows,through,calc,decorations.text,decorations.markings,intersections,fpu,circuits.ee.IEC,babel}
\begin{document}
\begin{tikzpicture}
[node distance=3cm and 3cm,on grid,auto,align=center,thick,
Schritt/.style={rectangle,
draw=black,inner sep=5pt,
execute at begin node=\hspace{0pt},%allow first word to break
},
Pfeil/.style={>=latex, ultra thick,->,bend angle=35, bend left, postaction=decorate,
decoration={raise=4pt, text align=center, text along path}}
]
\begin{scope}
\node (Mitte) {};%Hilfsnode für die Mitte
\node[Schritt] (Schritt1) [above=of Mitte] {großer Dampferzeuger};
\node[Schritt] (Schritt2) [right=of Mitte] {Turbine};
\node[Schritt] (Schritt3) [below=of Mitte] {Kondensator};
\node[Schritt] (Schritt4) [left=of Mitte] {Kesselwasser-\\speisepumpe};
\draw [Pfeil,decoration={text={hei{ß}er Dampf}}] (Schritt1) to (Schritt2);
\draw [Pfeil,decoration={text={warmer Dampf},reverse path}] (Schritt2) to (Schritt3);
\draw [Pfeil,decoration={text={Wasser},reverse path}] (Schritt3) to (Schritt4);
\draw [Pfeil,decoration={text={Wasser}}] (Schritt4) to (Schritt1);
\end{scope}
\end{tikzpicture}
\end{document}