Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Is there a simple way to set the default font for all tables in a document?

share|improve this question

2 Answers 2

up vote 11 down vote accepted

Either amend the definition of \table directly or use the floatrow package and its \floatsetup macro. (Note: floatrow by default also centers the content of floats.)

\documentclass{article}

\makeatletter
\g@addto@macro{\table}{\sffamily}
\makeatother

\begin{document}

\begin{table}
(Table contents)
\end{table}

Some text outside a table.

\end{document}

\documentclass{article}

\usepackage{floatrow}
\floatsetup[table]{font=sf}

\begin{document}

\begin{table}
(Table contents)
\end{table}

Some text outside a table.

\end{document}
share|improve this answer
    
Thanks, I've got the captions under more control. –  Darling Oct 7 '11 at 9:14

The memoir document class provides a means to set a default formatting for floats (if this is what you mean by "tables") via the \setfloatadjustment{<float>}{<adjustment>} macro. This would add <adjustment> to <float> whenever it is used. For example,

\setfloatadjustment{figure}{\centering}
\setfloatadjustment{table}{\small\centering}

Alternatively, you could use the etoolbox package to patch certain commands/environments. By patching here, it could append code to the start/end of an environment that would change (say) the font/alignment, as in the above setup.

share|improve this answer
    
I've been looking at the memoir class as I'm currntly using the book class and it seems like the next step. Is it worth the leap? –  Darling Oct 7 '11 at 9:13
    
I can recommend it. I've been using memoir for quite some time now. –  Werner Oct 7 '11 at 9:17

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.