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

Marina
  • 51

1 Answers1

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