I am currently using csvsimple
(in pdfLaTeX) to generate a table from a csv file:
\documentclass{article}
\usepackage{xcolor}
\usepackage{csvsimple}
\usepackage{siunitx}
\usepackage{booktabs}
\usepackage{tabularx}
\usepackage{float}
\begin{document}
\def\myasdf{1.5cm}
\begin{table}[htbp]
\sisetup{round-mode=places, round-precision=4}
\centering
\csvreader[tabular=l|p{\myasdf}p{\myasdf}p{\myasdf}p{\myasdf}p{\myasdf}p{\myasdf},
table head=\toprule Test Sequence & A & B & C & D & E & F\\ \midrule,
head to column names,
late after last line=\\\bottomrule]
{csvs/data.csv}%
{liu2021_vimeo90k_weighted_ex5a-v1_325000=\liuexFivea,
liu2021_vimeo90k_weighted_ex1a-v1_825000=\liuexOnea,
drdbnet_vimeo90k_weighted_ex16a-v1_375000=\drdbSixteena,
drdbnet_vimeo90k_weighted_ex12b-v3_682917=\drdbTwelveb}%
{\csvcoli & \num{\liuexFivea} & \num{\liuexOnea} &%
\num{\drdbSixteena} & \num{\drdbTwelveb} & \num{\yadif} & \num{\zhu}
}\\
\caption{Example Caption}
\label{tab:table1}
\end{table}
\end{document}
How can I adapt this code to highlight in each row the maximum value(s)? I don't care if it's by making the text bold, changing the cell background color, or any other way.
So far I found
- how to color the whole row (csvsimple)
- how to do it with a completely different approach (datatools) that would require me to figure out all the other details again
- how to do it with pgfplotstable
- how to find the minimum (pgfplotstable)
I would prefer not having to learn how to use a new package though, since my table already looks how I want it to and I know how to adapt the table I have for similar uses. Is there a way to do this highlighting with csvsimple?
Best Answer
A simple csv file
610711.csv
:A solution with
expl3
code: