1

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? I am using Roboto Slab Light in the text but in the tables and captions the font is the Roboto Slab.

Here is an example

\documentclass{article}

\usepackage[rm,light]{roboto}
\usepackage[T1]{fontenc}

\title{example}
\date{September 2018}

\usepackage{natbib}
\usepackage{graphicx}

\begin{document}

\maketitle

\section{Introduction}
Text text text.

\begin{table}[h]
    \centering
    \begin{tabular}{c|c}
       text  & text \\
       text  & text
    \end{tabular}
    \caption{Caption}
    \label{tab:my_label}
\end{table}

\end{document}

enter image description here

1

As a workaround you could add \mdseries to your table:

\documentclass{article}

\usepackage[rm,light]{roboto}
\usepackage[T1]{fontenc}


\begin{document}


\section{Introduction}
Text text text.

\begin{table}[h]
    \centering\mdseries
    \begin{tabular}{c|c}
       text  & text \\
       text  & text
    \end{tabular}
    \caption{Caption}
    \label{tab:my_label}
\end{table}

\end{document}

*EDIT

to automatically apply this to all tables, you can use the @egreg's nice solution from https://tex.stackexchange.com/a/286772/36296

\documentclass{article}

\usepackage[rm,light]{roboto}
\usepackage[T1]{fontenc}

\usepackage{etoolbox}
\makeatletter
\appto\@floatboxreset{%
  \ifx\@captype\andy@table
    \mdseries
  \fi
}
\def\andy@table{table}
\makeatother

\begin{document}


\section{Introduction}
Text text text.

\begin{table}[h]
    \centering
    \begin{tabular}{c|c}
       text  & text \\
       text  & text
    \end{tabular}
    \caption{Caption}
    \label{tab:my_label}
\end{table}

\end{document}

enter image description here

  • Thank you! That works! But is there a way to make it in the main.tex so I don't have to change it every time? – Marina Sep 28 '18 at 15:40
  • @Marina You could try the following trick: tex.stackexchange.com/a/2594/36296 – user36296 Sep 28 '18 at 15:51
  • I tried it but it doesn't work – Marina Sep 28 '18 at 16:17
  • @Marina Please see my edit – user36296 Sep 28 '18 at 16:26

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.