我制作了一个只有一列的简单表格,我想模仿伪代码。
我的代码是这样的:
\begin{table}[!h]
\caption{Algorithm for CNN Architecture}
\label{tab:fonts}
\centering
\begin{tabular}{l}
\hline
Input: DEM\\
\hspace{5mm} Conv 3x3, ReLU\\
\hspace{10mm} MaxPool 2x2\\
\hspace{10mm} Conv 3x3, ReLU\\
\hspace{15mm} MaxPool 2x2\\
\hspace{15mm} Conv 3x3, ReLU\\
\hspace{20mm} MaxPool 2x2\\
\hspace{20mm} Conv 3x3, ReLU\\
\hspace{20mm} Up-conv 2x2\\
\hspace{15mm} Copy\\
\hspace{15mm} Dropout, then conv 3x3, ReLU\\
\hspace{15mm} Conv 3x3, ReLU\\
\hspace{15mm} Up-conv 2x2\\
\hspace{10mm} Copy\\
\hspace{10mm} Dropout, then conv 3x3, ReLU\\
\hspace{10mm} Conv 3x3, ReLU\\
\hspace{10mm} Up-conv 2x2\\
\hspace{5mm} Copy\\
\hspace{5mm} Dropout, then conv 3x3, ReLU\\
\hspace{5mm} Conv 3x3, ReLU\\
\hspace{5mm} Conv 1x1, sigmoid\\
Output: Predicted Mask\\
\hline
\end{tabular}
\end{table}
我想要的是这样的:
先感谢您!
答案1
欢迎来到 TeX.SE!这是基于您的表格的提议。不过,可能还有更优雅的方式来排版此表格。答案是使用tikzmark
来标记C
您想要连接的,然后使用覆盖 Ti钾Z 图片在它们之间绘制箭头。
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{tikzmark}
\begin{document}
\begin{table}[!h]
\caption{Algorithm for CNN Architecture}
\label{tab:fonts}
\centering
\begin{tabular}{l}
\hline
Input: DEM\\
\hspace{5mm} \tikzmarknode{C1}{C}onv $3{\times}3$, ReLU\\
\hspace{10mm} MaxPool $2{\times}2$\\
\hspace{10mm} \tikzmarknode{C2}{C}onv $3{\times}3$, ReLU\\
\hspace{15mm} MaxPool $2{\times}2$\\
\hspace{15mm} \tikzmarknode{C3}{C}onv $3{\times}3$, ReLU\\
\hspace{20mm} MaxPool $2{\times}2$\\
\hspace{20mm} Conv $3{\times}3$, ReLU\\
\hspace{20mm} Up-conv $2{\times}2$\\
\hspace{15mm} \tikzmarknode{C3'}{C}opy\\
\hspace{15mm} Dropout, then conv $3{\times}3$, ReLU\\
\hspace{15mm} Conv $3{\times}3$, ReLU\\
\hspace{15mm} Up-conv $2{\times}2$\\
\hspace{10mm} \tikzmarknode{C2'}{C}opy\\
\hspace{10mm} Dropout, then conv $3{\times}3$, ReLU\\
\hspace{10mm} Conv $3{\times}3$, ReLU\\
\hspace{10mm} Up-conv $2{\times}2$\\
\hspace{5mm} \tikzmarknode{C1'}{C}opy\\
\hspace{5mm} Dropout, then conv $3{\times}3$, ReLU\\
\hspace{5mm} Conv $3{\times}3$, ReLU\\
\hspace{5mm} Conv $1{\times}1$, sigmoid\\
Output: Predicted Mask\\
\hline
\end{tabular}
\begin{tikzpicture}[overlay,remember picture]
\foreach \X in {1,2,3}
{\draw[red,-latex,shorten >=2pt,shorten <=2pt] (C\X.south) -- (C\X'.north);}
\end{tikzpicture}
\end{table}
\end{document}