
Ich versuche, die angles
Bibliothek zu verwenden, bin mir aber nicht sicher, wie ich sie anwenden soll, wenn die Knoten mit anderen Methoden angegeben wurden.
In den Beispielen erfolgt das Zeichnen der Vektoren und das Benennen der Knoten mit demselben draw
Befehl, der den Befehl ausgibt angles
.
\documentclass[tikz]{standalone}%
\usetikzlibrary{calc}
\usetikzlibrary{intersections}
\usetikzlibrary{angles}
\begin{document}
\begin{tikzpicture}
\coordinate (O) at (0, 0);
\path[name path = para] (-1, -2.5) parabola bend (2, 2) (4, 0);
\draw (O) -- (5, 0) coordinate (P1);
\path[name path = circ] (O) circle[radius = .75bp];
\path[name intersections = {of = para and circ}];
\coordinate (A) at (intersection-1);
\coordinate (B) at (intersection-2);
\draw[-latex, red] (A) -- ($(B)!1cm!(A)$) coordinate (P2);
\path (P1) -- (O) -- (P2)
pic[''$\theta$'', draw, -latex, red, angle radius = .5cm,
angle eccentricity = 1.2] {angle = P1--O--P2};
\end{tikzpicture}
\end{document}
Es sagt mir, dass Theta keine Farbe ist.
Auch wenn ich die quotes
Bibliothek lade und Anführungszeichen setze \theta
, wie Harish Kumar geantwortet hat, erhalte ich immer noch die Meldung:
! Missing \endcsname inserted.
<to be read again>
\theta
l.41 angle eccentricity = 1.2, font = \tiny]
{angle = P1--O--P2};
! Missing \endcsname inserted.
...
l.41 ...y = 1.2, font = \tiny] {angle = P1--O--P2}
;
! Package xcolor Error: Undefined color ```$\theta $'''.
Für diejenigen, die mir nicht glauben, dass doppelte Anführungszeichen dasselbe Problem verursachen, habe ich ein Video kommentiert, das zeigt, dass dies der Fall ist.
https://www.dropbox.com/s/44zhedz2psg1vrk/2014-05-08%2018.08.46.mp4
Antwort1
Sie müssen quotes
die Bibliothek laden, um die Syntax zu verwenden quotes
. Dadurch wird die Anführungszeichen-Syntax für Beschriftungen, Pins, Randknoten und Bildtexte aktiviert.
Außerdem handelt es sich um doppelte Anführungszeichen wie "$\theta$"
(nicht ''$\theta$''
). Einige Editoren (wie Emacs) konvertieren automatisch "
in ``
oder ''
(je nachdem, ob sie am Anfang oder Ende eines Wortes eingefügt werden), da dies nach dem Kompilieren des Dokuments die richtige Ausgabe erzeugt. In diesem Fall möchten wir jedochtatsächlichdoppelte Anführungszeichen. Um diese in Emacs einzugeben, drücken Sie einfach die Anführungszeichen-Tastezweimalnacheinander. Der zweite wandelt die zuvor eingefügten zwei einfachen Anführungszeichen in ein einfaches doppeltes Anführungszeichen um, was hier benötigt wird.
\documentclass[tikz,varwidth]{standalone}%
\usetikzlibrary{calc}
\usetikzlibrary{intersections}
\usetikzlibrary{angles}
\usetikzlibrary{quotes}
\begin{document}
\begin{tikzpicture}
\coordinate (O) at (0, 0);
\path[name path = para] (-1, -2.5) parabola bend (2, 2) (4, 0);
\draw (O) -- (5, 0) coordinate (P1);
\path[name path = circ] (O) circle[radius = .75bp];
\path[name intersections = {of = para and circ}];
\coordinate (A) at (intersection-1);
\coordinate (B) at (intersection-2);
\draw[-latex, red] (A) -- ($(B)!1cm!(A)$) coordinate (P2);
\path (P1) -- (O) -- (P2) pic["$\theta$", draw,-latex, red, angle radius = 0.5cm, angle eccentricity = 1.2] {angle = P1--O--P2};
\end{tikzpicture}
\end{document}
Antwort2
Wenn das Einbinden der Anführungszeichen-Bibliothek immer noch nicht funktioniert, empfehle ich, die Babel-Bibliothek wie vorgeschlagen zu laden.Hier. Ich hatte genau das gleiche Problem und bei mir hat es geholfen.
\usetikzlibrary{angles,quotes}
\usetikzlibrary{babel}
Antwort3
Die Verwendung quote
der Bibliothek in Dokumenten mit einigen nicht-englischen Sprachen hat Probleme mit deren Babels-Neudefinition von ''
. Zum Beispiel (leicht modifiziertBenutzer11232Antwort):
\documentclass[tikz, margin=3mm]{standalone}%
\usetikzlibrary{angles,
% babel, % <-- example works if you enable this library
calc,
intersections,
quotes}
\usepackage[slovene]{babel}
\begin{document}
\begin{tikzpicture}[
> = stealth,
angle radius = 5mm,
my angle/.style = {draw, -latex,
angle eccentricity=1.3,
font=\large} % angle label position!
]
\draw (0,0) coordinate (O) --
(4,0) coordinate (P1);
\draw[very thin, dashed, name path = para] (-1,-2.5) parabola bend (2,2) (4,0);
\draw[very thin, name path = circ] (O) circle[radius = .75bp];
%
\path[name intersections = {of = para and circ, by={A,B}}];
%
\draw[-latex, red] (A) -- ($(B)!1cm!(A)$) coordinate (P2);
%
\path (P1) -- (O) -- (P2)
pic[my angle,"$\theta$"] {angle = P1--O--P2};
\end{tikzpicture}
\end{document}
gibt Fehler aus:
! Argument of \language@active@arg" has an extra }.
<inserted text>
\par
l.26 pic[my angle,"$\theta$"]
{angle = P1--O--P2};
? x
Dies verschwindet, wenn ich babel
die Bibliothek in der Präambel des obigen MWE aktiviere, und führt zum folgenden Ergebnis:
Ich möchte anmerken, dass dieses Problem hier in vielen Fragen/Antworten diskutiert wurde. Außerdem ist die OP MWE-Berechnung sehr anspruchsvoll, es dauert eine Weile, bis ein Ergebnis vorliegt. Für dieses Problem gibt es bessere Ansätze (aber das ist hier keine Frage).