# How do I change the font type of a table? LATEX

I want to make the font type of a table to be the same that I am using in the text, how do I do that? How do I change the font in a table?

• Welcome to TeX.SE. Please tell us which document class you employ, which text font(s) you use, and which font(s) you would like to use for table-related material.
– Mico
Aug 10 '17 at 18:01
• the document class that I am using is 'book' and the font that I'm using is the 'default' and I'd like to use the \sf font in the table. Thank you for your quick reply
– WagS
Aug 10 '17 at 18:04
• And which part of the table environment should be typeset using the sans-serif font: The table header (also called the caption), the tabular material, the footnotes, or all of the above?
– Mico
Aug 10 '17 at 18:05
• I want to set this font in the tabular material
– WagS
Aug 10 '17 at 18:07
• \begin{table}\sffamily\begin{tabular} ...\end{tabular}\end{table} ? probably global setting in document preamble for all tables? Aug 10 '17 at 18:10

if you have only one table, the simplest way is

\begin{table}
\sffamily
\begin{tabular} ...

\end{tabular}
\end{table}


otherwise put in preamble

\usepackage{etoolbox}
\AtBeginEnvironment{table}{\sffamily}


note, this change font family only im tabular material. in caption is defined by caption set up.

Here's a solution in case you want everything in the table, including the \caption, to be typeset using the sans-serif font: Simply insert the following instructions in the preamble:

\makeatletter
\renewenvironment{table}%
{\renewcommand\familydefault\sfdefault
\@float{table}}
{\end@float}
\makeatother


A full working example:

\documentclass{book}
\usepackage{lipsum} % for filler text

\makeatletter
\renewenvironment{table}%
{\renewcommand\familydefault\sfdefault
\@float{table}}
{\end@float}
\makeatother

\begin{document}
\lipsum*[1]

\begin{table}[h!]
\caption{Hello World}
\begin{tabular}{@{}p{\textwidth}@{}}
\hline
\lipsum*[2]\\
\hline
\end{tabular}
\end{table}

\lipsum*[3]
\end{document}

• nice solution, (+1), however I would rather use my suggestion with \captionsetup[table]{font=sf} :) Aug 10 '17 at 18:54
• @Zarko - I wanted to present a solution that doesn't depend on any specific packages (e.g., caption) being loaded as well. :-) However, if the caption is not supposed to use the sans-serif font face, then my answer won't be what the OP needs...
– Mico
Aug 10 '17 at 19:51

I found the following solution with the floatrow package to work well with KOMA classes. It allows you to change the font for all of your tables:

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


Simply add this to your preamble. You can also combine this with other configurations, for example, to reduce the fontsize of tables:

floatsetup[table]{font={footnotesize,sf}}