[LaTeX][PGF/TikZ] Undefined control sequence error for PGF intersections.

Liste des GroupesRevenir à ct tex 
Sujet : [LaTeX][PGF/TikZ] Undefined control sequence error for PGF intersections.
De : segfault (at) *nospam* tilde.green (Annada Behera)
Groupes : comp.text.tex
Date : 30. Aug 2024, 08:59:14
Autres entêtes
Organisation : tilde.green
Message-ID : <10c8b515e70ecda9ad95fc1529ff3b102da812e4.camel@tilde.green>
User-Agent : Evolution 3.52.2
Consider this minimal working example. I have two functions, f(x) = x
and g(x) = x+sin(x). I want to draw them with PGF and at the intersection
points, I want put black dots. Here is the TikZ code,

    \documentclass{standalone}
    \usepackage{tikz, amsmath}
    \usetikzlibrary{intersections}
    \begin{document}\begin{tikzpicture}
       
        % Plots
        \draw[very thick, smooth, samples=20, domain=-6.28:6.28]
            [red,  name path=line] (0,0) plot (\x, \x);
        \draw[very thick, smooth, samples=20, domain=-6.28:6.28]
            [blue, name path=sine] (0,0) plot (\x, {\x + sin(\x r)});
       
        % Drawing the dots
        \fill[name intersections={of=line and sine, name=i, total=\t}, black]
            \foreach \s in {1,...,\t} {(i-\s) circle (2pt)};
       
    \end{tikzpicture}\end{document}

Now this code works as expected. But I also wanted to draw dashed lines from
the intersections to each axes.

    % Axes
    \draw [<->](-6.28, 0) -- (6.28, 0);
    \draw [<->](0, -6.28) -- (0, 6.28);

    % Mark intersection points and draw dashed lines
    \foreach \n in {1,...,\t} {
        \path ({i-\n}) coordinate (i\n); %    <--- Error Here
        \fill[black]  (i\n) circle (2pt);
        \draw[dashed] (i\n) -- (i\n |- 0,0);
        \draw[dashed] (i\n) -- (0,0 -| i\n);
    }

In this part, pdflatex (my distro is TeX Live 2024) throws an error what
I don't understand,

    ! Undefined control sequence.
    \UseTextAccent  ...p \@firstofone \let \@curr@enc
                                                      \cf@encoding \@use@text@en...
    l.28     }

What is undefined? I am pretty sure the name=i in \fill command populates
the namespace with i-1, 1-2 and 1-3, because \fill has drawn them. I
have even tried to help the parser with extra braces, {i-\n} and {i\n}
but that also doesn't help. Anybody know the reason why I get the error
and how to fix them?


Date Sujet#  Auteur
30 Aug 24 * [LaTeX][PGF/TikZ] Undefined control sequence error for PGF intersections.8Annada Behera
30 Aug 24 +- Re: [LaTeX][PGF/TikZ] Undefined control sequence error for PGF intersections.1Stefan Ram
31 Aug 24 +- Re: [LaTeX][PGF/TikZ] Undefined control sequence error for PGF intersections.1Stefan Ram
31 Aug 24 +* Re: [LaTeX][PGF/TikZ] Undefined control sequence error for PGF intersections.3Stefan Ram
1 Sep 24 i`* Re: [LaTeX][PGF/TikZ] Undefined control sequence error for PGF intersections.2Annada Behera
1 Sep 24 i `- Re: [LaTeX][PGF/TikZ] Undefined control sequence error for PGF intersections.1Stefan Ram
2 Sep 24 +- Re: [LaTeX][PGF/TikZ] Undefined control sequence error for PGF intersections.1Ulrich D i e z
2 Sep 24 `- Re: [LaTeX][PGF/TikZ] Undefined control sequence error for PGF intersections.1Ulrich D i e z

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal