0

I am using the following code borrowed from here and modified accordingly to write down the steps of an algorithm:

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

I want to have numbered list instead of bullet points. How can this be done? I am not able to use the enumerate environment as the code is not compiling.

1 Answer 1

1

Quick 'n' dirty...

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

enter image description here

2
  • @ Dr. Manuel Kuehner, can you please tell how the font size of the numbers can be reduced? I want to have the font size as here .
    – Aim
    Commented Jun 13, 2021 at 5:51
  • Using the normal font size commands, e. g. \tiny{#1. } Commented Jun 13, 2021 at 6:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .