[Tex/LaTex] Tabular: set a line between each row in \newenvironment

environmentslongtablerulestables

I have created a particular table with 3 columns using \newenvironment.
Now I want to put a line between each row and from the 2th to the 3th column.
I know it is possible to add \cmidrule{2-3} at the end of each row, but I would write something in the environment that I've created to achieve the same result and then add only \\ at the end of each row.
Could you suggest me some command to add during the declaration of the environment?

EDIT 1:
The problem is a little bit more complex. This is my environment:

\newenvironment{propRules}[2]{
\begin{longtable}{r{>{$\displaystyle}c<{$}}{>{$\displaystyle}l<{$}}}
\toprule
\multicolumn{2}{c}{\texttt{#1}} & \multicolumn{1}{c}{\texttt{#2}} \\
\midrule
\endfirsthead
\multicolumn{3}{l}{\footnotesize\itshape
Continue from previous page} \\
\toprule
\multicolumn{2}{c}{\texttt{#1}} & \multicolumn{1}{c}{\texttt{#2}} \\
\midrule
\endhead
\midrule
\multicolumn{3}{r}{\footnotesize\itshape
Continue in the following page} \\
\endfoot
\bottomrule
\endlastfoot 
}
{\end{longtable}}

I want to modify my environment in a such way that there will be a line between the table's rows: in particular that line must be only between the second and the third column.
Moreover, since that table could be broken in more pages (longtable), the line at the end of the last row in a page must not be shown because there is already the \midrule line.

EDIT 2:
I solved with \newcommand\tncr{\tabularnewline\cmidrule{2-3}} but I still have the problem of the line at the end of the last row in a page: it must not be shown because there is already the \midrule line.

Any suggestions?

EDIT 3:
This is a MWE:

\documentclass[a4paper,10pt]{article} 
\usepackage[english]{babel}
\usepackage[utf8]{inputenc} 
\usepackage{amsmath} 

\usepackage{longtable}  % for table in more than one page
\usepackage{booktabs}   % top, mid, bottom rule in tabular
\usepackage{array}      % personalize column in tabular 
\usepackage{multirow}   % multirow, multicolumn in tabular


% column with math env in display style
\newcolumntype{L}{>{$\displaystyle}l<{$}} 
\newcolumntype{C}{>{$\displaystyle}c<{$}}
\newcolumntype{R}{>{$\displaystyle}r<{$}}

%%% LONGTABLE DECLARATION %%%%%%%%%
\newenvironment{tablebig}[2]{
\setlength\LTleft{0pt}  % to obtain {\textwidth}
\setlength\LTright{0pt} % to obtain {\textwidth}
\begin{longtable}{rCL}
\toprule 
\multicolumn{2}{c}{\texttt{#1}} & \multicolumn{1}{c}{\texttt{#2}} \\
\midrule
\endfirsthead
% new page heading
\multicolumn{3}{l}{\footnotesize\itshape
Continue from previous page} \\
\toprule
\multicolumn{2}{c}{\texttt{#1}} & \multicolumn{1}{c}{\texttt{#2}} \\
\midrule
\endhead
% end page foot
\midrule
\multicolumn{3}{r}{\footnotesize\itshape
Continue in the following page} \\
\endfoot
% final foot
\bottomrule
% \multicolumn{3}{r}{\footnotesize\itshape
% Conclusion from previous page} \\ 
\endlastfoot 
% corpo della tabella
}
{\end{longtable}}



\begin{document}

\title{MWE}

\maketitle

\section{Section}
Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text  
Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text 
Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text 

Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text 

Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text  
Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text 
Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text 
Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text 

Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text  
Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text 
Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text 
Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text 

Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text  
Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text 
Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text 
Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text 

Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text  
Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text 


% line between rows
\newcommand\tncm{\tabularnewline\cmidrule{2-3}}

\begin{tablebig}{First Column}{Second Column}
test & test & test \tncm
test & test & test \tncm
test & test & test \tncm
test & test & test \tncm
test & test & test \tncm
test & test & test \tncm
test & test & test \tncm
test & test & test \tncm
test & test & test \tncm
test & test & test \tncm
test & test & test \tncm
test & test & test \tncm
test & test & test \tncm
test & test & test \tncm
test & test & test \tncm
test & test & test \tncm
test & test & test 
\end{tablebig}

\end{document}

If you compile it you can note that at the end of the first page there are two lines: the line producted by \tncm and the line produced by \midrule. In other cases the double line is at the beginning of the second page.
How can get around it?

Best Answer

You can redefine cmidrule so that the page break always occurs after a \cmidrule:

\makeatletter
\def\cmidrule{\noalign{\ifnum0=`}\fi
   \penalty\@M%
    \@ifnextchar[{\@cmidrule}{\@cmidrule[\cmidrulewidth]}}
\makeatother

Now you can adapt the solution of David Carlisle:

% end page foot
\noalign{\vskip-\cmidrulesep}
\midrule
\multicolumn{3}{r}{\footnotesize\itshape
Continue in the following page} \\
\endfoot

Here the complete MWE:

\documentclass[a4paper,10pt]{article} 
\usepackage[english]{babel}
\usepackage[utf8]{inputenc} 
\usepackage{amsmath} 

\usepackage{longtable}  % for table in more than one page
\usepackage{booktabs}   % top, mid, bottom rule in tabular
\usepackage{array}      % personalize column in tabular 
\usepackage{multirow}   % multirow, multicolumn in tabular
\makeatletter
\def\cmidrule{\noalign{\ifnum0=`}\fi
   \penalty\@M%
    \@ifnextchar[{\@cmidrule}{\@cmidrule[\cmidrulewidth]}}
\makeatother
% column with math env in display style
\newcolumntype{L}{>{$\displaystyle}l<{$}} 
\newcolumntype{C}{>{$\displaystyle}c<{$}}
\newcolumntype{R}{>{$\displaystyle}r<{$}}

%%% LONGTABLE DECLARATION %%%%%%%%%
\newenvironment{tablebig}[2]{
\setlength\LTleft{0pt}  % to obtain {\textwidth}
\setlength\LTright{0pt} % to obtain {\textwidth}
\begin{longtable}{rCL}
\toprule 
\multicolumn{2}{c}{\texttt{#1}} & \multicolumn{1}{c}{\texttt{#2}} \\
\midrule
\endfirsthead
% new page heading
\multicolumn{3}{l}{\footnotesize\itshape
Continue from previous page} \\
\toprule
\multicolumn{2}{c}{\texttt{#1}} & \multicolumn{1}{c}{\texttt{#2}} \\
\midrule
\endhead
% end page foot
\noalign{\vskip-\cmidrulesep}
\midrule
\multicolumn{3}{r}{\footnotesize\itshape
Continue in the following page} \\
\endfoot
% final foot
\bottomrule
% \multicolumn{3}{r}{\footnotesize\itshape
% Conclusion from previous page} \\ 
\endlastfoot 
% corpo della tabella
}
{\end{longtable}}



\begin{document}

\title{MWE}

\maketitle

\section{Section}
Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text  
Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text 
Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text 

Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text 

Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text  
Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text 
Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text 
Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text 

Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text  
Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text 
Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text 
Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text 

Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text  
Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text 
Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text 
Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text 

Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text  
Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text 


% line between rows
\newcommand\tncm{\tabularnewline\cmidrule{2-3}}

\begin{tablebig}{First Column}{Second Column}
test & test & test \tncm
test & test & test \tncm
test & test & test \tncm
test & test & test \tncm
test & test & test \tncm
test & test & test \tncm
test & test & test \tncm
test & test & test \tncm
test & test & test \tncm
test & test & test \tncm
test & test & test \tncm
test & test & test \tncm
test & test & test \tncm
test & test & test \tncm
test & test & test \tncm
test & test & test \tncm
test & test & test 
\end{tablebig}

\end{document}
Related Question