在 TikZ 环境中的节点中两个标签之间垂直排版等号

在 TikZ 环境中的节点中两个标签之间垂直排版等号

我有一张简单图的图表。其中一个顶点的标签是垂直排版的 $(a^{\prime}, \, b^{\prime}) = (a+n, bn)$。它看起来正是我想要的。我担心的是,我使用了三个节点来执行此操作,并多次猜测它们之间的间距“应该”是多少。有没有办法用一个节点来做到这一点?

\documentclass[10pt]{amsart}
\usepackage{amssymb}
\usepackage{mathtools}

\usepackage{tikz}
\usetikzlibrary{calc,intersections}




\begin{document}

\noindent \hspace*{\fill}
\begin{tikzpicture}

%A part of a line is drawn; ellipses are drawn on both sides of the line segment. Three points on it are labeled.
\draw (-8.5,0) -- (-6.25,0);
%
\node[anchor=north, inner sep=0, font=\scriptsize] at (-3,0){$\ldots$};
%
\draw[fill] (-8.5,0) circle (1.5pt);
\node[anchor=north, inner sep=0, font=\scriptsize] at ($(-8.5,0) +(0,-0.25)$){$(a, \, b)$};
\draw[fill] (-7.5,0) circle (1.5pt);
%A "pin" is drawn between this second point and its label.
\coordinate (label_for_Vertex_2) at ($(-7.5,0) +(0,-0.75)$);
\draw[draw=gray, line width=0.8pt, shorten <=1mm, shorten >=1mm] (-7.5,0) -- (label_for_Vertex_2);
\node[anchor=north, inner sep=0, font=\scriptsize] at (label_for_Vertex_2){$(a+1, \, b-1)$};
\draw[fill] (-6.5,0) circle (1.5pt);
%A "pin" is drawn between this third point and its label.
\coordinate (label_for_Vertex_3) at ($(-6.5,0) +(0,-1.5)$);
\draw[draw=gray, line width=0.8pt, shorten <=1mm, shorten >=1mm] (-6.5,0) -- (label_for_Vertex_3);
\node[anchor=north, inner sep=0, font=\scriptsize] at (label_for_Vertex_3){$(a+2, \, b-2)$};

\draw (-0.5,0) -- (3,0);
\draw[fill] (0,0) circle (1.5pt);
\node[anchor=south, inner sep=0, font=\scriptsize] at ($(0,0) +(0,0.25)$){$\left(\dfrac{0}{1}\right)$};
\node[anchor=north, inner sep=0, font=\scriptsize] at ($(0,0) +(0,-0.25)$){$(a^{\prime}, \, b^{\prime})$};
\node[anchor=north, inner sep=0, rotate=90, font=\scriptsize] at ($(0,0) +(0,-0.75)$){$=$};
\node[anchor=north, inner sep=0, font=\scriptsize] at ($(0,0) +(0,-1)$){$(a+n, \, b+n)$};
%
\draw[fill] (3,0) circle (1.5pt);
\node[anchor=south, inner sep=0, font=\scriptsize] at ($(3,0) +(0,0.25)$){$\left(\dfrac{1}{1}\right)$};
\node[anchor=north, inner sep=0, font=\scriptsize] at ($(3,0) +(0,-0.25)$){$(a^{\prime} + 1, \, b^{\prime} - 1)$};


\end{tikzpicture}
\hspace{\fill}


\end{document}

答案1

是的,当然。我重点关注图表的右侧。它可以重写为

\draw (-0.5,0) -- (3,0);
\draw[fill] (0,0) circle (1.5pt)
 node[above=0.25cm] {$\left(\dfrac{0}{1}\right)$}
 node[below=0.25cm] {$\begin{array}{c}
 (a^{\prime}, \, b^{\prime})\\
 \rotatebox[origin=c]{90}{$=$}\\
 (a+n, \, b+n)
 \end{array}$};
%
\draw[fill] (3,0) circle (1.5pt)
node[above=0.25cm] {$\left(\dfrac{1}{1}\right)$}
node[below=0.25cm]{$(a^{\prime} + 1, \, b^{\prime} - 1)$};

这里不需要任何 calc 语法,对齐由传统的 负责。通用节点样式在viaarray的选项中设置。tikzpicturenodes={inner sep=0, font=\scriptsize}

\documentclass[10pt]{amsart}
\usepackage{amssymb}
\usepackage{mathtools}

\usepackage{tikz}
\usetikzlibrary{calc,intersections,positioning}




\begin{document}

\noindent \hspace*{\fill}
\begin{tikzpicture}[nodes={inner sep=0, font=\scriptsize}]

%A part of a line is drawn; ellipses are drawn on both sides of the line segment. Three points on it are labeled.
\draw (-8.5,0) -- (-6.25,0);
%
\node[anchor=north,] at (-3,0){$\ldots$};
%
\draw[fill] (-8.5,0) circle (1.5pt)
node[below=0.25cm] {$(a, \, b)$};
\draw[fill] (-7.5,0) circle (1.5pt);
%A "pin" is drawn between this second point and its label.
\coordinate (label_for_Vertex_2) at ($(-7.5,0) +(0,-0.75)$);
\draw[draw=gray, line width=0.8pt, shorten <=1mm, shorten >=1mm] (-7.5,0) -- (label_for_Vertex_2);
\node[anchor=north] at (label_for_Vertex_2){$(a+1, \, b-1)$};
\draw[fill] (-6.5,0) circle (1.5pt);
%A "pin" is drawn between this third point and its label.
\coordinate (label_for_Vertex_3) at ($(-6.5,0) +(0,-1.5)$);
\draw[draw=gray, line width=0.8pt, shorten <=1mm, shorten >=1mm] (-6.5,0) -- (label_for_Vertex_3);
\node[anchor=north] at (label_for_Vertex_3){$(a+2, \, b-2)$};

\draw (-0.5,0) -- (3,0);
\draw[fill] (0,0) circle (1.5pt)
 node[above=0.25cm] {$\left(\dfrac{0}{1}\right)$}
 node[below=0.25cm] {$\begin{array}{c}
 (a^{\prime}, \, b^{\prime})\\
 \rotatebox[origin=c]{90}{$=$}\\
 (a+n, \, b+n)
 \end{array}$};
%
\draw[fill] (3,0) circle (1.5pt)
node[above=0.25cm] {$\left(\dfrac{1}{1}\right)$}
node[below=0.25cm]{$(a^{\prime} + 1, \, b^{\prime} - 1)$};


\end{tikzpicture}
\hspace{\fill}
\end{document}

在此处输入图片描述

可以进行进一步的优化。

相关内容