# Enumerating Items within a Longtable w/ Section Numbers

I am using longtable and enumitem and was hoping to enumerate items inside a longtable. I am making a template for RFQ and need to enumerate all points with the section/subsection number. I had a MWE example, which is shown below, and an example that does not work. I would like to use enumitem's label function to identify items while keeping consistent formatting (i.e., such as used in the rest of the document) which is why the MWE is not robust enough to be sufficient. I tried making a counter and then defining a label but it does not compile. I am open to other solutions. Thanks, all!

Here is where I got my idea: Automatic table row numbers

\documentclass{article}

\usepackage{longtable}
\usepackage{enumitem}
\setenumerate[1]{label=\thesection.\arabic*.}
\setenumerate[2]{label*=\arabic*.}

%% Counters
\newcounter{magicrownumbers}
\newcommand\rownumber{\stepcounter{magicrownumbers}\arabic{magicrownumbers}}

\begin{document}
\begin{center}
\renewcommand{\arraystretch}{1.2}
\begin{longtable}{| l | l|}

\hline
\multicolumn{1}{|c|}{\textbf{Description}} & \multicolumn{1}{c|}{\textbf{File Types}} \\
\hline

\multicolumn{2}{c}%
{{\bfseries \tablename\ \thetable{} -- continued from previous page}} \\
\hline
\multicolumn{1}{|c|}{\textbf{Description}} & \multicolumn{1}{c|}{\textbf{File Types}}\\ \hline

\hline
\multicolumn{2}{|r|}{{Continued on next page}} \\ \hline
\endfoot

\hline
\endlastfoot

\thesection.\rownumber. Controls One-line & Visio or AutoCAD 2015 \\ %%<-- Works by has issues when text takes two lines
\begin{enumerate}[label = {\thesection.\rownumber.}] \item Mechanical Layout \end{enumerate} & AutoCAD 2015  \\ %%<----Doesn't work

\end{longtable}
\end{center}
\end{document}

• longtable environments are centered already, so no need of using \begin{center}...\end{center}, but actually, I can't compile your 'MWE' – user31729 Apr 11 '17 at 3:44

A version with an automatic row counting and a specialized enumerate environment.

In my point of view, the enumerate environment does nothing healthy there.

\documentclass{article}

\usepackage{longtable}
\usepackage{enumitem}
\usepackage{array}
\usepackage{chngcntr}

\newlist{rownumbers}{enumerate}{2}

\setlist[rownumbers,1]{label=\thesection.\arabic*,resume}
\setlist[rownumbers,2]{label*=\arabic*}

% Counter is named rownumbersi !!!!
\counterwithin{rownumbersi}{table}

%% Counters

%\setenumerate[1]{label=\thesection.\arabic*.}
%\setenumerate[2]{label*=\arabic*.}
%\newcounter{magicrownumbers}
%\newcommand\rownumber{\stepcounter{magicrownumbers}\arabic{magicrownumbers}}
\newcommand\rownumber{\stepcounter{rownumbersi}\therownumbersi}

\newcolumntype{N}[1]{>{\raggedleft\rownumber}p{#1}}
\newcolumntype{L}[1]{>{\raggedright}p{#1}}
\newcolumntype{R}[1]{>{\raggedleft}p{#1}}
\newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}}

\begin{document}
\renewcommand{\arraystretch}{1.2}
\begin{longtable}{|L{5cm} | L{2in}|}

\hline
\multicolumn{1}{|c|}{\textbf{Description}} & \multicolumn{1}{c|}{\textbf{File Types}} \\
\hline

\multicolumn{2}{c}%
{{\bfseries \tablename\ \thetable{} -- continued from previous page}} \\
\hline
\multicolumn{1}{|c|}{\textbf{Description}} & \multicolumn{1}{c|}{\textbf{File Types}}\\ \hline

\hline
\multicolumn{2}{|r|}{{Continued on next page}} \\ \hline
\endfoot

\hline
\endlastfoot

%\thesection.\rownumber. Controls One-line & Visio or AutoCAD 2015 \\ %%<-- Works by has issues when text takes two lines
\begin{rownumbers}
\item Mechanical Layout
\item Foo
\item Some stuff
\end{rownumbers} & AutoCAD 2015  \tabularnewline %%<----Doesn't work

\end{longtable}
\end{document}


• That was exactly as needed! Thank you soooo much! – Bryan Manning Apr 11 '17 at 17:27
• @BryanManning: Alright, happy TeXing then! ;-) – user31729 Apr 11 '17 at 17:28
• I noticed a small problem, I want to assign one element of a row with another, thus, I would need only one item inside the \begin{rownumbers} ... \end{rownumbers}. What ends up happening is I get 1.1 for each value and using [resume] does not seem to help since each bullet point is at the same level. Could I amend the environment to take the row number instead of the sub-section number? – Bryan Manning Apr 11 '17 at 17:48
• @BryanManning: That's changing the question ;-) – user31729 Apr 11 '17 at 17:50
• Would you like me to resubmit the question? I might've mistyped after a few hours of failure. :P – Bryan Manning Apr 11 '17 at 18:15