Tikz의 한 줄 위의 텍스트가 작동하지 않습니다.

Tikz의 한 줄 위의 텍스트가 작동하지 않습니다.

이전 게시물에 있는 이 코드가 있습니다.자르코의 답변이제 문제는 다음에서 볼 수 있듯이여기에 이미지 설명을 입력하세요첨부된 그림은 라벨입니다. 코드가 작동해야 하므로 내 Latex 버전이나 다른 것과 관련이 있어야 합니다. (코드를 사용하여 아래 이미지를 생성하고 있습니다)

\documentclass[12pt, margin=3mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{angles, arrows.meta,    % new
                quotes}                 % new
\definecolor{lava}{rgb}{0.81, 0.06, 0.13}
\definecolor{myblue}{rgb}{0.0, 0.30, 0.60}
%\usepackage{gensymb} % better is to use siunitx

\begin{document}
    \begin{tikzpicture}[
ang/.style = {draw, Straight Barb-Straight Barb, anchor=west,
              angle radius = 8mm, angle eccentricity=1},
arr/.style = {cap=round,-Straight Barb},
dot/.style = {circle, fill, minimum size=3pt,inner sep=0pt},
every edge quotes/.style = {auto, font=\footnotesize, sloped},
every label/.style       = {inner sep=1pt},
                        ]
% axis
\draw[arr]  (-2.7,0)--(3.6,0)   node[below] {$\Re$}; % x axis
\draw[arr]  (0,-2.7)--(0,3) node[left]  {$\Im$}; % y axis
% circle
\draw       (0,0) circle (2.5cm);
% defining radius points
\node (n1) [dot,label= 45:$V_m$] at (90:2.5) {};
\node (n2) [dot,label= 45:$P$]   at (45:2.5) {};
\node (n3) [dot,label=-45:$V_m$] at ( 0:2.5) {};
% vector
\coordinate (O) at (0,0);
\path[draw=lava, ultra thick, arr] 
    (O) to ["$V_m\mathrm{e}^{j\theta}$"]  (n2.center);
% projections
\path[draw=myblue, very thick, arr] 
    (O) to ["$V_m \cos(\phi)$" ']   (n2.center |- O); % projection on x axis
\path[draw=myblue, very thick, arr]
    (O) to ["$V_m \sin(\phi)$"]     (n2.center -| O); % projection on y axis
% angle
\pic [ang, "$\omega t+\phi$"] {angle = n3--O--n2};
    \end{tikzpicture}
\end{document}  

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

답변1

아래 코드와 같이 레이블에 위와 아래를 추가하여 문제가 해결되었습니다.

\documentclass[12pt, margin=3mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{angles, arrows.meta,   
                quotes}                
\definecolor{lava}{rgb}{0.81, 0.06, 0.13}
\definecolor{myblue}{rgb}{0.0, 0.30, 0.60}
\usepackage{steinmetz}
\usepackage{siunitx}     % new
\usepackage{amsmath,amsthm, amssymb, latexsym}
\renewcommand{\Re}{\operatorname{Re}}
\renewcommand{\Im}{\operatorname{Im}}

\begin{document}
    \begin{tikzpicture}[
ang/.style = {draw, Straight Barb-Straight Barb, anchor=west,
              angle radius = 8mm, angle eccentricity=1},
arr/.style = {cap=round,-Straight Barb},
dot/.style = {circle, fill, minimum size=3pt,inner sep=0pt},
every edge quotes/.style = {auto, font=\footnotesize, sloped},
every label/.style       = {inner sep=1pt},
                        ]
                        
 \def\Rad{3.25}                       
                        
% axis
\draw[arr]  (-\Rad-.3,0)--(\Rad+.5,0)   node[above] {$\Re$}; % x axis
\draw[arr]  (0,-\Rad-.3)--(0,\Rad+.5) node[left]  {$\Im$}; % y axis
% circle
\draw       (0,0) circle (\Rad cm);
% defining radius points
\node (n1) [dot,label= 45:$V_m$] at (90:\Rad) {};
\node (n2) [dot,label= 45:$P$]   at (45:\Rad) {};
\node (n3) [dot,label=-45:$V_m$] at (0:\Rad) {};
% vector
\coordinate (O) at (0,0);
\path[draw=lava, ultra thick, arr] 
    (O) to ["$V_m\mathrm{e}^{j\theta}$" above]  (n2.center);
% projections
\path[draw=myblue, very thick, arr] 
    (O) to ["$V_m \cos(\phi)$" below]   (n2.center |- O); % projection on x axis
\path[draw=myblue, very thick, arr]
    (O) to ["$V_m \sin(\phi)$" above ]     (n2.center -| O); % projection on y axis
% angle
\pic [ang, "$\footnotesize{\omega t+\phi}$"] {angle = n3--O--n2};
    \end{tikzpicture}
\end{document}

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

관련 정보