2

I found out that the hhline does not print lines when the argument is greater than 9 as in \hhline{|*14{-}|}. It works well when doing instead \hhline{|*9{-}*5{-}|} as the following file shows:

\documentclass{article}

\usepackage{hhline}
\usepackage{colortbl}

\begin{document}

\begin{center}
\small\sf
\begin{tabular}{|c|c|c|c|c|c|c|c|c|} \hhline{|*9{-}|}
\rowcolor[gray]{.8} & & \multicolumn{7}{c|}{Year} \\ \hhline{|*9{-}|}
a & a & a & a & a & a & a & a & a \\ \hhline{|*9{-}|}
\end{tabular} 
\end{center}

\begin{center}
\small\sf
\begin{tabular}{|c|c|c|c|c|c|c|c|c|c|c|c|c|c|} \hhline{|*9{-}*5{-}|}
\rowcolor[gray]{.8} & & \multicolumn{12}{c|}{Year} \\ \hhline{|*9{-}*5{-}|}
a & a & a & a & a & a & a & a & a & a & a & a & a & a \\ \hhline{|*9{-}*5{-}|}
\end{tabular} 
\end{center}

\begin{center}
\small\sf
\begin{tabular}{|c|c|c|c|c|c|c|c|c|c|c|c|c|c|} \hhline{|*14{-}|}
\rowcolor[gray]{.8} & & \multicolumn{12}{c|}{Year} \\ \hhline{|*14{-}|}
a & a & a & a & a & a & a & a & a & a & a & a & a & a \\ \hhline{|*14{-}|}
\end{tabular} 
\end{center}

\end{document}

Is this the expected behavior ?

4

The expected thing is to put the number in {...} as in \hhline{|*{14}{-}|}. If you do only \hhline{|*14{-}|}, LaTeX actually thinks that you want to replicate 1 time the string 4, and not 14 times the string -.

The fact that it works correctly on one-digit numbers is a bit misfortunate since people then think it's the correct syntax; but it is not.

As a side note, please do not use \sf, use \sffamily instead. Reasons are explained in the question: Does it matter if I use \textit or \it, \bfseries or \bf, etc.

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.