I have the following MWE:




freq   ,R1,R2,R3,R4,R5,R6,R7,R8,R9,C
100\,Hz, 0, 1, 2, 3, 4, 5, 6, 7, 8,10\,nF



  longtable=>{\raggedleft}p{4.5em}!{\color{white}\vrule width 0.8pt}%
            >{\raggedleft}p{2.0em}!{\color{white}\vrule width 0.8pt}%
            >{\raggedleft}p{2.0em}!{\color{white}\vrule width 0.8pt}%
            >{\raggedleft}p{2.0em}!{\color{white}\vrule width 0.8pt}%
            >{\raggedleft}p{2.0em}!{\color{white}\vrule width 0.8pt}%
            >{\raggedleft}p{2.0em}!{\color{white}\vrule width 0.8pt}%
            >{\raggedleft}p{2.0em}!{\color{white}\vrule width 0.8pt}%
            >{\raggedleft}p{2.0em}!{\color{white}\vrule width 0.8pt}%
            >{\raggedleft}p{2.0em}!{\color{white}\vrule width 0.8pt}%
            >{\raggedleft}p{2.0em}!{\color{white}\vrule width 0.8pt}%
                          p{3.0em}!{\color{white}\vrule width 0.8pt},
  table head=\arrayrulecolor{white}\hline\rowcolor{tch}
    {\color{white}\bf Frequency} &
    {\color{white}\bf R1} &
    {\color{white}\bf R2} &
    {\color{white}\bf R3} &
    {\color{white}\bf R4} &
    {\color{white}\bf R5} &
    {\color{white}\bf R6} &
    {\color{white}\bf R7} &
    {\color{white}\bf R8} &
    {\color{white}\bf R9} &
    {\color{white}\bf Cap},
    late after head=\\\endhead\rowcolor{tc1l},
    late after line=\csvifoddrow{\\\hline\rowcolor{tc1l}}
{\freq & \ra & \rb & \rc & \rd & \re & \rf & \rg & \rh & \ri & \c}


This produces the following result:

nice, but blurry result

However, I need something like shown in the following picture. I don't know how to create it based on the cell's row and column number. How would I best go about this (hoping to be able to do this with csvsimple)?

enter image description here

  • Use pgfplotstable. – TeXnician Aug 14 '18 at 16:46
  • No way to continue to use csvsimple? I've just gotten familiar with csvsimple and now I should look into yet another package? – Hansel Aug 14 '18 at 16:47
  • There might be (probably something with tikzmarks or something similar), but the simple in the name of csvsimple is not that wrong. You could maybe try to manually insert a kind of color/cellcolor macro at the start of each cell which only adjusts in the row and column you want it to, but it it probably is a very large effort. – TeXnician Aug 14 '18 at 16:54
  • OK, I guess I'll look into pgfplotstable. – Hansel Aug 14 '18 at 17:27

I have edited this answer in light of TeXnician's comment. Previously I did not have an answer, just a suggestion. In order to show that the suggestion actually accomplishes the desired result, here is the code using the datatool package. Maybe something like this can be done with csvsimple, but as TeXnician rightly points out, the 'simple' in csvsimple makes me suspect that it cannot.

Note: in the code that follows, test.csv is the same as in the example above except that the cells with a \, in them are in quotation marks so that they can be read as part of a csv file.




 {\ifthenelse{\equal{\theCol}{1}}{}{&}{\color{white}\bf\theHead}} \\\hline%



  • 1
    Welcome to TeX.SX! This is a good idea, but has one drawback: The differing colors. You use cellcolor once, but this highlighted row has four different color intensities. – TeXnician Aug 15 '18 at 6:16
  • Wow this is really cool. it works like a charm. It doesn't really matter to me how to do this, I don't need to use csvsimple. I just dreaded the coding so I highly appreciate the time you've taken to do so. – Hansel Aug 18 '18 at 6:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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