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.

Using scrartcl as my document class, tables are set in a slightly larger font size than my normal text (12pt vs. 11pt I suppose). How can I change the font size for tables document wide? At the moment I just add a \small to all my tables.

share|improve this question
2  
Are you sure something else isn't doing this? The KOMA classes don't change the fontsize of tables AFAIK. –  Alan Munn Jun 7 '11 at 19:42
2  
As Alan said, this is not the expected bahaviour with the default settings, can you please add to your question a minimal working example illustrating the change in the font size that you mentioned? –  Gonzalo Medina Jun 7 '11 at 20:36
add comment

4 Answers

up vote 3 down vote accepted
\makeatletter
\renewenvironment{table}{%
  \if@tablecaptionabove\let\caption\captionabove
  \else\let\caption\captionbelow\fi
  \small\@float{table}%
}{%
  \end@float
}
\makeatother
share|improve this answer
1  
Unfortunately this does not work for me. Is it possible that some of the packages I use, such as longtable, colortable, or caption interfere with that? –  Ingo Jun 7 '11 at 19:56
1  
Please provide a minimal example. The source was copied from the scrartcl.cls. –  Marco Daniel Jun 8 '11 at 5:08
add comment

The solution by Marco, redefining the table environment and inserting \small is a good approach. However, it doesn't work yet. Of course it could not be tested, since no example has been given.

The macro \@floatboxreset calls \normalsize. This can be redefined using \small instead or just omitting \normalsize. To not affect other floats, also this can be done within the table redefinition. I called \normalsize at the end of the environment.

So, here's a compilable example which works as desired:

\documentclass[10pt]{scrartcl}
\makeatletter
\renewenvironment{table}{%
  \if@tablecaptionabove\let\caption\captionabove
  \else\let\caption\captionbelow\fi
  \renewcommand* {\@floatboxreset}{%
    \reset@font\@setminipage}
  \small\@float{table}%
}{%
  \end@float\normalsize
}
\makeatother
\begin{document}
Text in 10pt

\begin{table}[!htbp]
\begin{tabular}{l}
Text in 9pt
\end{tabular}
\end{table}

Text in 10pt
\end{document}

I returned to this question because I dealt with a very similar topic on LaTeX-Community.org today.

share|improve this answer
1  
You don't have to call \normalsize at the end of the environment. It is because \small will be local to the group closed by \end. Also for the [!htbp], I guess what you really want is [!h]. –  Yan Zhou Jun 19 '11 at 22:32
    
@Yan Zhou: I guess so, originally I didn't use \normalsize, just edited and added it because \@floatboxreset used it. Should not hurt. ;-) And [!htbp] or [!h] doesn't matter, it's just an example and it did it. I don't like to show [!h] because in my opinion just h is usually too less. –  Stefan Kottwitz Jun 19 '11 at 22:44
add comment

You can use the environment hook provided by etoolbox. The following code will change the table contents to \tiny (well \tiny may be better for the demonstration purpose though no one will really use it).

The hook is plugged at tabular. Use \AtBeginEnvironment{table}{\tiny} has no effect. And indeed if it has effect, you won't really want it, since it will chang the caption too. You may want to customize the caption by another package like caption or ccaption`, rather than change it here.

Since you won't really use a dozen kinds of tabular environment, so call \AtBeginEnvironment for those you use will be enough (for the sake of good typographic practice you should not use more than two type of tables, one for short, one for long).

\documentclass{article}
\usepackage{etoolbox}

\AtBeginEnvironment{tabular}{\tiny}

\begin{document}
  Some text in normal text.
  \begin{table}[ht]
    \caption{A table}
    \begin{tabular}{c}
      Some text in  table size
    \end{tabular}
  \end{table}
\end{document}
share|improve this answer
add comment

The approached mentioned here are quite useful. Here is another short way to do that, just redefine the table environment as below:

 \makeatletter
 \renewenvironment{table}
     {\@float{table} \small}
     {\end@float}
 \makeatother
share|improve this answer
add comment

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.