Coloured Tables for the Memoir Class

So long as that colour isn't yellow. I hate yellow.

Reading time: about 2 minutes (301 words).

If you’re a fan of LaTeX typography, you may have come across the Motion Mountain set of physics textbooks. This long term project has its own class file, which has been tweaked and honed over many years, has seen many of its pages grace many typography showcases (not to mention commercial successes and other recognitions). One particular stylistic choice that piqued my interest was the use of coloured rules inside the \table{} environment.

There colortbl package (available on CTAN), with albeit hideous examples, allows for the inclusion of colour into tables; usually to highlight cells, but with a bit of finesse can be persuaded to alter the rule colour also.

Memoir is by far the most comprehensive class I’ve come across that should be the default document choice for those wishing to typeset large and complex documents. Simply adding colortbl into the preamble of ones document will allow access to the capability needed to obtain coloured table rules, but this is not the only option available. Memoir incorporates the extensions from booktabs, which provides much needed enhancements to the default table environment. Since booktabs has some rudimentary support for colortbl, Memoir already has latent colour capability from the ported legacy code—it just needs to be enabled.

Add this to your preamble:

    \makeatletter
    \def\rulecolor#1#{\CT@arc{#1}}
    \def\CT@arc#1#2{%
      \ifdim\baselineskip=\z@\noalign\fi
      {\gdef\CT@arc@{\color#1{#2}}}}
    \let\CT@arc@\relax
    \makeatother

And set table rules via \rulecolor{color}. With a little bit of tweaking, your tables will scrub up quite well.

A Memoir class table with coloured horizontal rules
A Memoir class table with coloured horizontal rules