I'd like to have a dotted rule like \midrule
from the booktabs package.
I took code from the booktabs.sty, simplified it and have:
\documentclass{article}
\usepackage{array}
\usepackage{booktabs}
\makeatletter{}
\def\dotrule{\noalign{\ifnum0=`}\fi
\@aboverulesep=\aboverulesep
\global\@belowrulesep=\belowrulesep
\global\@thisruleclass=\@ne
\@BTdotted}
\def\@BTdotted{%
{\CT@arc@\hrule\@height\@thisrulewidth}%
\futurenonspacelet\@tempa\@BTendrule}
\makeatother{}
\begin{document}
Text
\begin{tabular}{lr}\toprule
Huu& Haa \\\dotrule
\end{tabular}
\end{document}
And now I'm stuck replacing the central \hrule\@height\@thisrulewidth
with something that makes not a line, but dots. I've been struggling with \leaders
, but didn't get it. Maybe somebody has an idea.
I found lots of similar questions, of course. But the trick is to have a command with parameters of the booktabs package!
\hrule
is a primitive which inserts an 'rule' in the vertical list and the computation of the length of the rule is done by TeX very late. On the other side, leaders need a box (and are able to fill that box). But we can't construct a horizontal box of the width of the array during the construction of the array...\multispan
but you will have to give the total number of columns of the array as argument of your command\midrule
. We can also compute the width of the array (with PGF/Tikz) and store it in theaux
file in order to use it in the next run.plain TeX
is a format (that is to say a set of constructions with TeX primitives which is, in some way, pre-compiled). LaTeX is another format. When you use LaTeX, you don't use plain TeX: you use TeX.