2

I wonder why I can't use the ß directly at this point: decoration={text={heißer Dampf}. If I do that, pdflatex throws me an error: "Package inputenc Error: Invalid UTF-8 byte". I can't understand why it doesn't work with the decoration texts. The workaround is to replace the ß with {\ ss}, but it's unsatisfactory. What is the problem with the implementation of the decorative texts and 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 Answer 1

3

decorations works token by token, and as the ß consists of two bytes in utf8 it is split. It works if you protect it with a brace:

\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}
8
  • Or use \ss instead of ß. Commented Jan 26, 2021 at 19:37
  • @HenriMenke the question already mentions \ss. Commented Jan 26, 2021 at 19:55
  • @HenriMenke the OP had \ss in the question but wanted to use the character. (pgf could actually detect that the token it has stripped off is \UTFviii@two@octets and grab the next two bytes as if they were braced... Commented Jan 26, 2021 at 19:56
  • It is still unsatisfactory. It doesn't matter whether I write {ß} or {\ ss}. Fact ist the ß needs special treatment. I cannot see why it is technically possible to write the ß directly in connection with a normal label {großer Dampferzeuger} and, on the other hand, I have to make sure that I treat the ß specially with the text decorations. I haven't tried it, but it will probably be similarly problematic with other special characters: äöüá and so on. What is the technical reason why you cannot implement this simple text input within the text decorations? Is it a decoration library problem?
    – Michael.H
    Commented Jan 27, 2021 at 8:51
  • @Michael.H As David wrote, it should be technical possible, but someone must implement it. Make a feature request at the tikz/pgf github. Beside this: it is not simple text input, ß is a rather complicated command with pdflatex. With lualatex where ß is a simply char your code would work out of the box. Commented Jan 27, 2021 at 9:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .