4

still got no answer to this question... hopefully someone can help me. it shouldn´t be to difficult to answer, I guess:

can someone help me to activate the german language for this file?

until now, if there is "ä" or "ö" or "ü" in the text, I only get error-massages and the normal babel packages doesnt seem to work, but I´m an absolute beginner to this program.

The TikZ-file looks like this:

\documentclass[border=2mm]{standalone}
\usepackage    {tikz}
\usetikzlibrary{decorations.text}

%newly added but also doesnt fix the problem: \usepackage[utf8]{inputenc} % this is needed for umlauts \usepackage[ngerman]{babel} % this is needed for umlauts \usepackage[T1]{fontenc} % this is needed for correct output of umlauts in pdf

\newcommand\mytext[5] % inner radius, outer radius, start angle, end angle, text {% \path[decorate, decoration={text along path, text=#5, text align=center}] (#3:0.5#1+0.5#2) arc (#3:#4:0.5#1+0.5#2); }

\begin{document} \footnotesize

\begin{tikzpicture}[line join=round,line cap=round]
    % radii
    \def\ra{1.5}
    \def\rb{2.5}
    \def\rc{3.5}
    \def\rd{5.5}
    \def\re{6.5}
    % circles
    \foreach\i in {\ra,\rb,\rc,\rd,\re}
    {%
        \draw[thick] (0,0) circle (\i);
    }
    % lines
    \foreach\a/\i in {  0/\rd/,  30/0,    60/\rb,  90/0,   120/\rd, 150/0,%
        180/\rb,  210/\rd, 240/\ra, 270/\rd, 300/\rd, 330/\rd}
    {%
        \draw[thick] (\a:\i) -- (\a:\re);
    }
    % labels (and some german letters to generate the error-message)
    \mytext{1}  {\ra} {90} {30}{1üüüü}
    \mytext{1}  {\ra}{150} {90}{1öööö}
    \mytext{0}  {\ra}{390}{150}{1ääää}
    %
    \mytext{\ra}{\rb} {90} {30}{2}
    \mytext{\ra}{\rb}{150} {90}{2}
    \mytext{\ra}{\rb}{240}{150}{2}
    \mytext{\ra}{\rb}{390}{240}{2}
    %
    \mytext{\rb}{\rc} {60} {30}{3}
    \mytext{\rb}{\rc} {90} {60}{3}
    \mytext{\rb}{\rc}{150} {90}{3}
    \mytext{\rb}{\rc}{180}{150}{3}
    \mytext{\rb}{\rc}{240}{180}{3}
    \mytext{\rb}{\rc}{390}{240}{3}
    % and so on

    \mytext{\rc}{\rd} {60} {30}{4}
    \mytext{5.5}{2.75} {90} {60}{4}
    \mytext{4}{\rd} {90} {60}{4}
    \mytext{5}{2.75}{150} {90}{4}
    \mytext{4.5}{\rd}{150} {90}{4}
    \mytext{3.5}{\rd}{150} {90}{4}
    \mytext{\rc}{\rd}{180}{150}{4}
    \mytext{\rc}{\rd}{240}{180}{4}
    \mytext{\rc}{\rd}{390}{240}{4}


    % ...

    \mytext{\rd}{\re} {30} {0}{5}
    \mytext{\rd}{\re} {60} {30}{5}
    \mytext{\rd}{\re} {90} {60}{5}
    \mytext{\rd}{\re}{120} {90}{5}
    \mytext{\rd}{\re}{150}{120}{5}
    \mytext{\rd}{\re}{180}{150}{5}
    \mytext{\rd}{\re}{210}{180}{5}
    \mytext{\rd}{\re}{240}{210}{5}
    \mytext{\rd}{\re}{270}{240}{5}
    \mytext{\rd}{\re}{300}{270}{5}
    \mytext{\rd}{\re}{330}{300}{5}
    \mytext{\rd}{\re}{360}{330}{5}

\end{tikzpicture}

\end{document}

I don't know much about this whole program yet and I'm just getting started with it.

Thanks for your help! :)

Tiv
  • 65
  • Why do you not use "\usepackage[ngerman]{babel}" ? – Plergux Apr 25 '21 at 10:04
  • Note that babel has nothing to do with German letters. Which encoding is your file saved in? – daleif Apr 25 '21 at 10:14
  • 1
    if you want help with an error messagem show the exact error from the log and provide a test file that reproduces the error. Currently your code is incomplete so we can not run it and you have not said what error you got so it is very hard to help – David Carlisle Apr 25 '21 at 10:23
  • related: https://tex.stackexchange.com/questions/67549/whats-the-difference-between-ngerman-and-german-in-babel – SebGlav Apr 25 '21 at 10:40
  • just changed the question + added the full code, so hoping these informations might help you to figure out where´s the mistake. thanks a lot :) – Tiv Apr 26 '21 at 07:36
  • Try to compile your document with XeLaTeX or LuaLaTeX. – Zarko Apr 26 '21 at 07:43
  • Im using TeXstudio 3.1.1 you think its because of that? do I have to install s.th. else? – Tiv Apr 26 '21 at 07:53

1 Answers1

2

With pdflatex, the parser for the text along path gets thoroughly confused with accented characters, that should be braced. But it turns out that the confusion remains if two consecutive accented are found so they must be doubly braced.

\documentclass[border=2mm]{standalone}
\usepackage[T1]{fontenc}    % this is needed for correct output of umlauts in pdf
\usepackage[ngerman]{babel} % this is needed for umlauts

\usepackage{tikz} \usetikzlibrary{decorations.text,babel}

\newcommand\mytext[5] % inner radius, outer radius, start angle, end angle, text {% \path[ decorate, decoration={text along path, text={#5}, text align=center} ] (#3:0.5#1+0.5#2) arc (#3:#4:0.5#1+0.5#2); }

\begin{document}

\begin{tikzpicture}[line join=round,line cap=round]
    % radii
    \def\ra{1.5}
    \def\rb{2.5}
    \def\rc{3.5}
    \def\rd{5.5}
    \def\re{6.5}
    % circles
    \foreach\i in {\ra,\rb,\rc,\rd,\re}
    {%
        \draw[thick] (0,0) circle (\i);
    }
    % lines
    \foreach\a/\i in {  0/\rd/,  30/0,    60/\rb,  90/0,   120/\rd, 150/0,%
        180/\rb,  210/\rd, 240/\ra, 270/\rd, 300/\rd, 330/\rd}
    {%
        \draw[thick] (\a:\i) -- (\a:\re);
    }
    % labels (and some german letters to generate the error-message)
    \mytext{1}  {\ra} {90} {30}{1{{ü}}{{ö}}{{ä}}{{ö}}}
    \mytext{1}  {\ra}{150} {90}{fl{ü}gel}
    \mytext{0}  {\ra}{390}{150}{1{ä}}
    %
    \mytext{\ra}{\rb} {90} {30}{2}
    \mytext{\ra}{\rb}{150} {90}{2}
    \mytext{\ra}{\rb}{240}{150}{2}
    \mytext{\ra}{\rb}{390}{240}{2}
    %
    \mytext{\rb}{\rc} {60} {30}{3}
    \mytext{\rb}{\rc} {90} {60}{3}
    \mytext{\rb}{\rc}{150} {90}{3}
    \mytext{\rb}{\rc}{180}{150}{3}
    \mytext{\rb}{\rc}{240}{180}{3}
    \mytext{\rb}{\rc}{390}{240}{3}
    % and so on

    \mytext{\rc}{\rd} {60} {30}{4}
    \mytext{5.5}{2.75} {90} {60}{4}
    \mytext{4}{\rd} {90} {60}{4}
    \mytext{5}{2.75}{150} {90}{4}
    \mytext{4.5}{\rd}{150} {90}{4}
    \mytext{3.5}{\rd}{150} {90}{4}
    \mytext{\rc}{\rd}{180}{150}{4}
    \mytext{\rc}{\rd}{240}{180}{4}
    \mytext{\rc}{\rd}{390}{240}{4}


    % ...

    \mytext{\rd}{\re} {30} {0}{5}
    \mytext{\rd}{\re} {60} {30}{5}
    \mytext{\rd}{\re} {90} {60}{5}
    \mytext{\rd}{\re}{120} {90}{5}
    \mytext{\rd}{\re}{150}{120}{5}
    \mytext{\rd}{\re}{180}{150}{5}
    \mytext{\rd}{\re}{210}{180}{5}
    \mytext{\rd}{\re}{240}{210}{5}
    \mytext{\rd}{\re}{270}{240}{5}
    \mytext{\rd}{\re}{300}{270}{5}
    \mytext{\rd}{\re}{330}{300}{5}
    \mytext{\rd}{\re}{360}{330}{5}

\end{tikzpicture}

\end{document}

enter image description here

As noted in the comment by vi pa, it's better to use

text={#5}

so you'll not get into troubles if the text contains commas.

egreg
  • 1,121,712