coming from here: former thread, I focus on one question and provide a MVE. My problem is: I want to color rows in a longtable with the same color via a macro, to differentiate between two different builds, triggered from outside (internal and public version). Doing this via rowcolor, only the first row is colored, others remain in default background color. I could use the command on every row, however I want only to have one command.
Thanks.
The MWE is:
\documentclass[a4paper,11pt,index=totoc]{scrreprt}
% --- out of style file
% \def\isRelease{1}
\usepackage{colortbl}
\usepackage{array}
\usepackage{longtable}
\usepackage{booktabs}
\usepackage[justification=centering,font=scriptsize,labelfont=bf,position=bottom]{caption}
\usepackage{xifthen}
\usepackage{color}
\newcommand{\headcol}{\rowcolor{black}}
\newcommand{\internCol}{\rowcolor{yellow}}
\newcommand{\startLongTable}%
{%
\renewcommand{\arraystretch}{1.2}%
\setlength\LTleft{0pt plus \textwidth}%
\setlength\LTright{0pt plus \textwidth}%
}
\newcommand{\tableRowEnd}%
{%
\\ \midrule%
}
\newcommand{\lastTableRowEnd}%
{%
\\ \addlinespace%
}
\newcommand{\preTableHeaderLine}{\arrayrulecolor{black}\specialrule{\heavyrulewidth}{\abovetopsep}{0pt}%
\arrayrulecolor{black}\specialrule{\belowrulesep}{0pt}{0pt}%
\arrayrulecolor{black}}
\newcommand{\postTableHeaderLine}{\arrayrulecolor{black}\specialrule{\aboverulesep}{0pt}{0pt}%
\arrayrulecolor{black}\specialrule{\lightrulewidth}{0pt}{0pt}%
\arrayrulecolor{black}}
\newcommand{\tableIntern}[2]%
{%
\ifdefined\isRelease%
#1%
\else%
\tableRowEnd%
\internCol#2%
\fi%
}
% --- --------------------------
\begin{document}
\startLongTable
\begin{longtable}{ >{\centering}p{0.1\textwidth-2\tabcolsep}
p{0.2\textwidth-2\tabcolsep}
p{0.4\textwidth-2\tabcolsep}
>{\centering}p{0.2\textwidth-2\tabcolsep}
>{\centering\arraybackslash}p{0.1\textwidth-2\tabcolsep}
}
\preTableHeaderLine
\headcol \color{white} Field & \color{white} Name & \color{white} Description & \color{white} Format & \color{white} \# \\
\postTableHeaderLine \addlinespace
\endhead
1 & Field1 & Name1 & A & 2 \tableRowEnd
2 & Field2 & Name2 & B & 3
\tableIntern{\lastTableRowEnd}
{
3 & Field3 & Name3 & C & 3 \tableRowEnd
4 & Field4 & Name4 & C & 4 \lastTableRowEnd
}
\bottomrule
\caption{stackoverflow MWE}
\label{table:stackoverflowMWE}
\end{longtable}
\end{document}