| Deutsch English Français Italiano |
|
<10c8b515e70ecda9ad95fc1529ff3b102da812e4.camel@tilde.green> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!weretis.net!feeder9.news.weretis.net!news.quux.org!tilde.green!.POSTED.103.160.128.7!not-for-mail
From: Annada Behera <segfault@tilde.green>
Newsgroups: comp.text.tex
Subject: [LaTeX][PGF/TikZ] Undefined control sequence error for PGF
intersections.
Date: Fri, 30 Aug 2024 13:29:14 +0530
Organization: tilde.green
Sender: segfault@tilde.green
Message-ID: <10c8b515e70ecda9ad95fc1529ff3b102da812e4.camel@tilde.green>
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Injection-Info: tilde.green; posting-account="segfault@tilde.green"; posting-host="103.160.128.7";
logging-data="1942930"; mail-complaints-to="admins@tilde.green"
User-Agent: Evolution 3.52.2
Bytes: 2800
Lines: 52
Consider this minimal working example. I have two functions, f(x) =3D x
and g(x) =3D 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}
=20
% Plots
\draw[very thick, smooth, samples=3D20, domain=3D-6.28:6.28]=20
[red, name path=3Dline] (0,0) plot (\x, \x);
\draw[very thick, smooth, samples=3D20, domain=3D-6.28:6.28]=20
[blue, name path=3Dsine] (0,0) plot (\x, {\x + sin(\x r)});
=20
% Drawing the dots
\fill[name intersections=3D{of=3Dline and sine, name=3Di, total=3D\=
t}, black]
\foreach \s in {1,...,\t} {(i-\s) circle (2pt)};
=20
\end{tikzpicture}\end{document}
Now this code works as expected. But I also wanted to draw dashed lines fro=
m
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=20
\cf@encoding \@use@te=
xt@en...
l.28 }
What is undefined? I am pretty sure the name=3Di 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?