Tikzpictures 和 parbox 在枚举环境中,如何将所有内容对齐到顶部?

Tikzpictures 和 parbox 在枚举环境中,如何将所有内容对齐到顶部?

我开始展示我所得到的以及我想要实现的目标:

在此处输入图片描述

我的代码如下:

\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}

在此处输入图片描述

相关内容