3

The following MWE works as expected: the \dotfill "line" spans the entire tabular.

\documentclass{article}
% \usepackage{colortbl}
\begin{document}
\begin{tabular}{p{.45\linewidth}p{.45\linewidth}}
  aaaaaaaaaaaaaaaaaaaaaaaaaa & bbbbbbbbbbbbbbbbbbbbbbbbbb \\
  \multicolumn{2}{c}{\dotfill}
\end{tabular}
\end{document}

But, as soon as colortbl package is loaded, the dotted "line" is dramatically shortened.

Another very strange phenomenon is that the page size is not the same:

  • without colortbl, it is 595.276 x 841.89 pts (A4),
  • with colortbl, it is 612 x 792 pts (letter).

Note: this happens with an up to date TeX Live 2014, with the following list files (when colortbl is loaded):

 *File List*
 article.cls    2014/09/29 v1.4h Standard LaTeX document class
  size10.clo    2014/09/29 v1.4h Standard LaTeX file (size option)
colortbl.sty    2012/02/13 v1.0a Color table columns (DPC)
   array.sty    2014/10/28 v2.4c Tabular extension package (FMi)
   color.sty    2014/10/28 v1.1a Standard LaTeX Color (DPC)
   color.cfg    2007/01/18 v1.5 color configuration of teTeX/TeXLive
  pdftex.def    2011/05/27 v0.06d Graphics/color for pdfTeX
infwarerr.sty    2010/04/08 v1.3 Providing info/warning/error messages (HO)
 ltxcmds.sty    2011/11/09 v1.22 LaTeX kernel commands for general use (HO)
supp-pdf.mkii
 ***********
3

colortbl documents that there are severe restrictions on the use of stretch glue, and leaders such as \dotfill are essentially generalised glue in tex.

See Interaction between \hdotsfor and colortbl: Bug/Feature?

The page size thing is because pdftex.def sets the \pdfpageheight and width primitives that tells pdftex the page size that latex is using. by default that is US letter unless you use \documentclass[a4paper]{article}

See graphicx (or graphics) package distorts format

| improve this answer | |
  • For the first problem, thanks to your link, I managed by patching \dotfill macro with \hskip\z@\@plus 1filll in place of \hfill (either directly or via etoolbox' \patchcmd). I hope I won't be bitten by side effects. For the second problem, I beg your pardon for having blamed colortbl :) – Denis Bitouzé Dec 1 '14 at 19:47
  • @DenisBitouzé well I probably put the settings in pdftex.def (I can't remember, it may have been Sebastian:-) – David Carlisle Dec 1 '14 at 19:48
  • OK, so I won't blame colortbl but I will blame its author ;) BTW, now these two troubles have been identified (I don't pretend "by me"), is there a way to fix them for the future? – Denis Bitouzé Dec 1 '14 at 19:51
  • 1
    @DenisBitouzé the page size isn't something that needs fixing, it's just historical that latex defaults to US letter but in most of the world people set pdf generation to default to a4 and so you need [a4paper] to get things in sync. Not ideal but you can't erase history. for fill glue it just doesn't work in colortbl. so you can't use \hfill and there is not much I can do about that. You can use \hspace{0pt plus 1filll} if there is no coloured background and similarly you could define a lll version of \dotfill (which is safer than patching dotfill) if there is colour then its harder – David Carlisle Dec 1 '14 at 19:59
  • 1
    @DenisBitouzé oh yes I just mean in tabular cells yes. You could call it \dotfilll which is what I'd call it. by lll I mean using filll glue instead of fill glue. \dotfill stretches like 0pt plus 1fill so you want something the same that stretches like 0pt plus 1filll – David Carlisle Dec 1 '14 at 21:21

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.