Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I tried to use the longtable with the row color and I just simply can get it to work. When I try to do:

\documentclass[10pt, landscape]{report}
    %Packages
        \usepackage[utf8]{inputenc} 
        \usepackage[english, ngerman]{babel}
        \usepackage{booktabs}
        \usepackage{array}
            \newcounter{rowno}
            \setcounter{rowno}{0}
        \usepackage{longtable}
        \usepackage[table]{xcolor}  
    \begin{document} 
    \rowcolors{1}{gray!40!white}{blue!10!white} 
            \begin{longtable}{>{\stepcounter{rowno}\therowno.}c c l c l l l l }
            \hiderowcolors
            \multicolumn{1}{c}{No.} & Article & Word & Type & 3. Person & Präteritum & Perfect & Translation \\
            \toprule
            \endfirsthead
            \showrowcolors
            \hiderowcolors
            \multicolumn{1}{c}{No.} & Article & Word & Type & 3. Person & Präteritum & Perfect & Translation \\
            \toprule 
            \endhead
            \showrowcolors
            & --- & abdecken & verb & deckt ab & deckte ab & abgedeckt & to cover, \\ \midrule
            & --- & abholen & verb & holt ab & holte ab & abgeholte & to collect or pick up \\ \midrule 
    \end{longtable}
    \end{document}

I am getting every row to be the same color - gray. I tried doing different things with it but to no avail.

enter image description here

Did anyone dealt with something like that and have a solution?

share|improve this question
    
give a complete example which shows what you see –  Herbert Jan 29 '13 at 18:34
    
What do want to do with {\stepcounter{rowno}\therowno.}? Please make your given code compilable, so add used packages, document class and \end{document}. –  Kurt Jan 29 '13 at 18:59
    
The \stepcounter{rowno}\therowno gives an automatic count to the rows in the table (there are ~240 entries in it) –  ulek Jan 29 '13 at 19:06

2 Answers 2

it is a problem with your setting of \show/hiderowcolors. This works:

\documentclass[10pt, landscape]{report}
    %Packages
        \usepackage[utf8]{inputenc} 
        \usepackage[english, ngerman]{babel}
        \usepackage{booktabs}
        \usepackage{array}
            \newcounter{rowno}
            \setcounter{rowno}{0}
        \usepackage{longtable}
        \usepackage[table]{xcolor}  
    \begin{document} 
    \rowcolors{3}{gray!40!white}{blue!40!white!80} 
            \begin{longtable}{>{\stepcounter{rowno}\therowno.}c c l c l l l l }
            \multicolumn{1}{c}{No.} & Article & Word & Type & 3. Person & Präteritum & Perfect & Translation \\\toprule
            \endfirsthead
            \multicolumn{1}{c}{No.} & Article & Word & Type & 3. Person & Präteritum & Perfect & Translation \\
            \toprule 
            \endhead
            & --- & abdecken & verb & deckt ab & deckte ab & abgedeckt & to cover, \\
            & --- & abholen & verb & holt ab & holte ab & abgeholte & to collect or pick up\\             & --- & abholen & verb & holt ab & holte ab & abgeholte & to collect or pick up\\             & --- & abholen & verb & holt ab & holte ab & abgeholte & to collect or pick up\\ \bottomrule 
    \end{longtable}
    \end{document}

enter image description here

share|improve this answer
    
Actually it appears that \midrule was the problem. When I removed the \show/hidecolors I got nowhere fast, however after removing the `\midrule' everything works fine –  ulek Jan 29 '13 at 19:26

Actually it appears that \midrule was the problem. When I removed the \show/hidecolors I got nowhere fast, however after removing the \midrule everything works fine

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.