# Different versions of same font in document

I'm trying to make the default text of my document "Roboto Light", while trying to make the section headers "Roboto". However, using the sectsty package, the following will give me the \bfseries of Roboto in the sections, not the \mdseries (which is standard Roboto, and what I want). It looks like this:

\usepackage{sectsty}
\sectionfont{\fontfamily{roboto}}
\subsectionfont{\fontfamily{roboto}}
\usepackage[sfdefault,light]{roboto}


Which looks like this:

When I want the sections to look like this:

Which I accomplished doing this. This, however, results in a wrong default text:

\usepackage[sfdefault]{roboto}
\usepackage{sectsty}
\sectionfont{\mdseries\Large}
\subsectionfont{\mdseries\large}


Trying something like this just gives me a message:

\usepackage[sfdefault,light]{roboto}
\usepackage{sectsty}
\sectionfont{\fontfamily{roboto}\mdseries\Large}
\subsectionfont{\fontfamily{roboto}\mdseries\large}


Font shape 'T1/roboto/m/n' undefined(Font) using 'T1/cmr/m/n' instead

Which results in a completely different font. How can I accomplish this task?

The option light makes \mddefault to be l rather than m.

You just have to explicitly choose the m series:

\documentclass{article}
\usepackage[
sfdefault,
light,
]{roboto}
\usepackage{sectsty}

\allsectionsfont{\fontseries{m}\selectfont}

\begin{document}

\section{Opgave 1}

\subsection{Subsection}

Text follows

\end{document}


• Worked perfectly! I'm totally new to LaTeX, so I'm sorry if this was obvious. – Requaero Mar 1 '17 at 12:36
• @Requaero No, not obvious at all! Each font package has its own peculiarities. – egreg Mar 1 '17 at 12:37
• Note that when fontspec is used with LuaTeX or XeTeX, there are additional ways to choose fonts (particularly if they are Open Type). I only mention this because others will find the question via search. – user103221 Mar 1 '17 at 16:44