如何在文字上對齊節點錨點?

如何在文字上對齊節點錨點?

我目前正在嘗試在 TikZ 圖上實現註釋,我在其中指出了一個限制值(見下圖)。 極限值

\documentclass[tikz]{standalone}
\begin{document}
\begin{tikzpicture}
    \draw [stealth-,thin] (0,0.9)-- +(16pt,0pt) node[right,font=\footnotesize] 
            {Limiting value: $\lim\limits_{x\rightarrow 0}\omega=0$};
\end{tikzpicture}
\end{document}

我遇到的問題是,當我繪製一條連接到節點的線時,我的西錨點並沒有完全居中於文本,而是整個節點。

問題:如何才能使錨點對齊,使箭頭很好地居中於文字而不是整個節點?

答案1

\smash一種方法是在您不想影響節點位置的文字上使用。或者,您可以分兩步驟放置節點:

在此輸入影像描述

代碼:

\documentclass{article}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}
    \draw [stealth-,thin] (0,0.9)-- +(16pt,0pt) node[right,font=\footnotesize] 
            {Limiting value: \smash{$\lim\limits_{x\rightarrow 0}\omega=0$}};
\end{tikzpicture}

\medskip
\begin{tikzpicture}
    \draw [stealth-,thin] (0,0.9)-- +(16pt,0pt) node[right,font=\footnotesize] (A) {Limiting value:};
    \node [anchor=west,font=\footnotesize, inner sep=0pt] at (A.east) {$\lim\limits_{x\rightarrow 0}\omega=0$};
\end{tikzpicture}
\end{document}

相關內容