# Highlight smallest number in table

I would like to highlight the smallest number in each row. How would I go about doing this. In the following for example, would like to highlight 3 and 3.

\documentclass{article}
\usepackage{datatool}

\begin{filecontents*}{test2.csv}
apples, 17, 3
oranges, 3, 18
\end{filecontents*}

\begin{document}

\begin{tabular}{ll}
\bfseries Adam & \bfseries Steve & \bfseries Fruits%
{%
}%
\end{tabular}

\end{document}

• What about 3 --> \textcolor{red}{t3}? – Svend Tveskæg Aug 1 '13 at 9:59
• @SvendTveskæg perhaps the OP wish is for an automated way to detect that 3 is indeed the smallest row entry? – user4686 Aug 1 '13 at 14:11
• @jfbu Good point. (And of course t3 should be 3.) – Svend Tveskæg Aug 1 '13 at 14:16
• Related: tex.stackexchange.com/questions/33967/… (This question is for pgfplotstable, so not a duplicate, but if you're not locked to datatool, perhaps it can be of help anyway.) – Torbjørn T. Aug 5 '13 at 8:42

Since you only have two numerical columns, you can do something like:

\documentclass{article}

\usepackage{xcolor}
\usepackage{datatool}

\begin{filecontents*}{test2.csv}
apples, 17, 3
oranges, 3, 18
\end{filecontents*}

\begin{document}

\begin{tabular}{lll}
\bfseries Fruits & \bfseries Adam & \bfseries Steve%
{%
\\\Fruits &
}%
\end{tabular}

\end{document}


This produces:

If you have more than two numerical columns you can use \DTLgminall to compute the minimum for the row, like this:

\documentclass{article}

\usepackage{xcolor}
\usepackage{datatool}

\begin{filecontents*}{test2.csv}
apples, 17, 3
oranges, 3, 18
\end{filecontents*}

\begin{document}

\begin{tabular}{lll}
\bfseries Fruits & \bfseries Adam & \bfseries Steve%