Текст над строкой в ​​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}

введите описание изображения здесь

Связанный контент