![Tikzpictures 和 parbox 在枚举环境中,如何将所有内容对齐到顶部?](https://linux22.com/image/433483/Tikzpictures%20%E5%92%8C%20parbox%20%E5%9C%A8%E6%9E%9A%E4%B8%BE%E7%8E%AF%E5%A2%83%E4%B8%AD%EF%BC%8C%E5%A6%82%E4%BD%95%E5%B0%86%E6%89%80%E6%9C%89%E5%86%85%E5%AE%B9%E5%AF%B9%E9%BD%90%E5%88%B0%E9%A1%B6%E9%83%A8%EF%BC%9F.png)
我开始展示我所得到的以及我想要实现的目标:
我的代码如下:
\begin{enumerate}[(i)]
\item \begin{tikzpicture}[scale=0.6,every node/.style={draw=black,circle}]
\node[text opacity=0, scale=0.8] (1) at (0,0) {$1$};
\node[text opacity=0, scale=0.8] (2) at (3,0) {$2$};
\node[text opacity=0, scale=0.8] (3) at (6,0) {$3$};
\draw[->] (1) to (2);
\draw[->] (2) to (3);
\end{tikzpicture}$\hfill$Connessioni seriali
\item \begin{tikzpicture}[scale=0.6,every node/.style={draw=black,circle}]
\node[text opacity=0, scale=0.8] (1) at (0,0) {$1$};
\node[text opacity=0, scale=0.8] (2) at (3,0) {$2$};
\node[text opacity=0, scale=0.8] (3) at (6,0) {$3$};
\draw[->] (2) to (1);
\draw[->] (2) to (3);
\end{tikzpicture}$\hfill$Connessioni divergenti
\item \begin{tikzpicture}[scale=0.6,every node/.style={draw=black,circle}]
\node[text opacity=0, scale=0.8] (1) at (0,0) {$1$};
\node[text opacity=0, scale=0.8] (2) at (3,0) {$2$};
\node[text opacity=0, scale=0.8] (3) at (6,0) {$3$};
\draw[->] (1) to (2);
\draw[->] (3) to (2);
\end{tikzpicture}$\hfill$Connessioni convergenti
\item
\begin{tikzpicture}[scale=0.6,every node/.style={draw=black,circle}]
\node[text opacity=0, scale=0.8] (1) at (0,0) {$1$};
\node[text opacity=0, scale=0.8] (2) at (3,0) {$2$};
\node[text opacity=0, scale=0.8] (3) at (6,0) {$3$};
\node (4) [below = 7mm of 2, text opacity=0, scale=0.8] {$4$};
\draw[->] (1) to (2);
\draw[->] (3) to (2);
\draw[->] (2) to (4);
\end{tikzpicture}$\hfill$
\textbox{6.5cm}{Connessioni convergenti con discendente sul nodo di convergenza}
其中文本框命令定义如下:
\newcommand{\textbox}[3][c]{\parbox[#1]{#2}{\strut#3\strut}}
有什么方法可以实现我想要的配置吗?TIA
答案1
我不仅必须使用[t]
,\textbox
而且还使用了\belowbaseline[...]{...}
包stackengine
将元素移到tikz
最后一项的较低位置。
\documentclass{article}
\usepackage{tikz,enumitem,stackengine}
\usetikzlibrary{arrows.meta,shapes,positioning}
\newcommand{\textbox}[3][c]{\parbox[#1]{#2}{\strut#3\strut}}
\begin{document}
\begin{enumerate}%[label=(i)]
\item \begin{tikzpicture}[scale=0.6,every node/.style={draw=black,circle}]
\node[text opacity=0, scale=0.8] (1) at (0,0) {$1$};
\node[text opacity=0, scale=0.8] (2) at (3,0) {$2$};
\node[text opacity=0, scale=0.8] (3) at (6,0) {$3$};
\draw[->] (1) to (2);
\draw[->] (2) to (3);
\end{tikzpicture}$\hfill$Connessioni seriali
\item \begin{tikzpicture}[scale=0.6,every node/.style={draw=black,circle}]
\node[text opacity=0, scale=0.8] (1) at (0,0) {$1$};
\node[text opacity=0, scale=0.8] (2) at (3,0) {$2$};
\node[text opacity=0, scale=0.8] (3) at (6,0) {$3$};
\draw[->] (2) to (1);
\draw[->] (2) to (3);
\end{tikzpicture}$\hfill$Connessioni divergenti
\item \begin{tikzpicture}[scale=0.6,every node/.style={draw=black,circle}]
\node[text opacity=0, scale=0.8] (1) at (0,0) {$1$};
\node[text opacity=0, scale=0.8] (2) at (3,0) {$2$};
\node[text opacity=0, scale=0.8] (3) at (6,0) {$3$};
\draw[->] (1) to (2);
\draw[->] (3) to (2);
\end{tikzpicture}$\hfill$Connessioni convergenti
\item \belowbaseline[-\baselineskip]{%
\begin{tikzpicture}[scale=0.6,every node/.style={draw=black,circle}]
\node[text opacity=0, scale=0.8] (1) at (0,0) {$1$};
\node[text opacity=0, scale=0.8] (2) at (3,0) {$2$};
\node[text opacity=0, scale=0.8] (3) at (6,0) {$3$};
\node (4) [below = 7mm of 2, text opacity=0, scale=0.8] {$4$};
%
\draw[->] (1) to (2);
\draw[->] (3) to (2);
\draw[->] (2) to (4);
\end{tikzpicture}}$\hfill$
\textbox[t]{6.5cm}{Connessioni convergenti con discendente sul nodo di convergenza}
\end{enumerate}
\end{document}