TikZ: 각도 라이브러리 사용

TikZ: 각도 라이브러리 사용

라이브러리 를 사용하려고 하는데 angles다른 방법으로 노드를 지정한 경우 어떻게 적용해야 할지 모르겠습니다.

예제에서 벡터 그리기 및 노드 이름 지정은 명령 draw을 실행하는 동일한 명령 에서 수행됩니다 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}

세타는 색상이 아니라는 뜻입니다.


Harish Kumar가 답변한 것처럼 라이브러리 를 로드 quotes하고 큰따옴표를 넣어도 \theta여전히 다음 메시지가 나타납니다.

! 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 $'''.

큰따옴표가 같은 문제를 일으킨다는 것을 믿지 못하는 사람들을 위해 이것이 사실임을 보여주는 비디오를 해설했습니다.

https://www.dropbox.com/s/44zhedz2psg1vrk/2014-05-08%2018.08.46.mp4

답변1

quotes구문을 사용하려면 라이브러리를 로드해야 합니다 quotes. 이를 통해 레이블, 핀, 가장자리 노드 및 그림 텍스트에 대한 따옴표 구문이 활성화됩니다.

"$\theta$"또한 (not ) 과 같은 큰따옴표입니다 ''$\theta$''. 일부 편집기(예: Emacs)는 자동 "으로 ``또는'' (단어의 시작 또는 끝에 삽입되는지 여부에 따라) 변환합니다. 그러나 이 경우 우리는실제큰 따옴표. Emacs에서 이를 입력하려면 큰따옴표 키를 누르십시오.두 배연속해서. 두 번째는 이전에 삽입된 두 개의 작은 따옴표를 여기에 필요한 작은 큰 따옴표로 변환합니다.

\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}

여기에 이미지 설명을 입력하세요

답변2

따옴표 라이브러리를 포함해도 문제가 해결되지 않으면 제안된 바벨 라이브러리를 로드하는 것이 좋습니다.여기. 나는 똑같은 문제가 있었고 그것은 나를 위해 트릭을 만들었습니다.

\usetikzlibrary{angles,quotes}
\usetikzlibrary{babel}

답변3

영어가 아닌 일부 언어가 포함된 문서에서 라이브러리를 사용하면 quote바벨을 재정의하는 데 문제가 있습니다.'' . 예를 들어 (약간 수정됨사용자11232답변):

\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}

오류가 발생합니다.

! Argument of \language@active@arg" has an extra }.
<inserted text> 
                \par 
l.26     pic[my angle,"$\theta$"]
                                  {angle = P1--O--P2};
? x

이 경우 babel위 MWE의 프리앰블에서 라이브러리를 활성화하면 사라지고 다음과 같은 결과가 나타납니다.

여기에 이미지 설명을 입력하세요

이 문제는 여기의 많은 질문/답변에서 논의되었습니다. 또한 OP MWE는 매우 까다로운 계산이므로 결과를 얻는 데 시간이 걸립니다. 문제에 대한 더 나은 접근 방식이 존재합니다(그러나 여기서는 이것이 문제가 되지 않습니다).

관련 정보