我正在使用以下代码借用自这里并进行相应修改,写下算法的步骤:
\documentclass{article}
\usepackage{booktabs}
\newcommand{\tabitem}{~~\llap{\textbullet}~~}
\begin{document}
\begin{table}
\centering
\begin{tabular}{l}
\toprule
\multicolumn{1}{l}{\textbf{Algorithm} }
\\
\midrule
\tabitem This is step 1 \\
\tabitem This is step 2 \\
\tabitem This is step 3 \\
\tabitem This is step 4 \\
\hline
\end{tabular}
\end{table}
\end{document}
我想要编号列表而不是项目符号。该怎么做?我无法使用环境,enumerate
因为代码未编译。
答案1
快速又肮脏......
\documentclass{article}
\usepackage{booktabs}
\newcommand{\tabitem}[1]{~~\llap{#1.}~~}% <-- Modified
\begin{document}
\begin{table}
\centering
\begin{tabular}{l}
\toprule
\multicolumn{1}{l}{\textbf{Algorithm} }
\\
\midrule
\tabitem{1} This is step 1 \\
\tabitem{2} This is step 2 \\
\tabitem{3} This is step 3 \\
\tabitem{4} This is step 4 \\
\hline
\end{tabular}
\end{table}
\end{document}