带有文本的 LaTeX 节点不垂直对齐

Stu*_* NL 8 latex

我想垂直对齐两个节点中的文本。我目前的实现如下:

\begin{figure}
    \centering
    \begin{tikzpicture}
        \node[anchor=west] at (0,0) {depot};
        \node[anchor=west] at (2,0) {satellite};        
    \end{tikzpicture}
\end{figure}
Run Code Online (Sandbox Code Playgroud)

这会返回下图

在此输入图像描述

正如您所看到的,单词在垂直方向上没有很好地对齐。这是由 depot 中的“p”引起的。我应该向 \node 添加什么参数以使它们垂直对齐?

sam*_*ter 9

\strut可以“伪造”最大高度和深度的字母:

\documentclass{article}

\usepackage{tikz}

\begin{document}

\begin{figure}
    \centering
    \begin{tikzpicture}
        \node[anchor=west] at (0,0) {depot\strut};
        \node[anchor=west] at (2,0) {satellite\strut};        
    \end{tikzpicture}
\end{figure}


\end{document}
Run Code Online (Sandbox Code Playgroud)

或者如果您不需要west锚点,您可以使用

\documentclass{article}

\usepackage{tikz}

\begin{document}

\begin{figure}
    \centering
    \begin{tikzpicture}
        \node[anchor=base] at (0,0) {depot};
        \node[anchor=base] at (2,0) {satellite};        
    \end{tikzpicture}
\end{figure}


\end{document}
Run Code Online (Sandbox Code Playgroud)