0

I'm running MikTeX on Windows 10 and I would like to use Roboto Condensed for the title of the article and section/subsection headings, and to have Source Sans Pro as the main text font.

Naturally, I was erring towards the roboto and the sourcesanspro packages. However, I've tried several combinations of their options, as well as switching their order, but I'm getting a bit crazy... I can get one package to affect the "titles" without affecting the main text font.

Minimal (non-)working example:

\documentclass[]{article}

%opening
\title{My Title}

\usepackage[condensed]{roboto}
\usepackage[default,nosfdefault]{sourcesanspro}

\begin{document}

\maketitle

\section{This is a section}

Normal text. Text Text.

\end{document}
2
  • 2
    Combining two sans faces is pretty icky. Why would you want to do this to your document or your readers? Some kind of typographic vengeance? – cfr Aug 18 '17 at 0:35
  • I'm aware of the recommendation, and I usually stick to serif for the text body. But this is a short document to students, that is mostly read online. I find that Source Sans Pro is a good font that is both legible on screen and in print, and since I use Roboto+Source Sans for my slides, I thought about keeping consistency for this short document. – Peutch Aug 18 '17 at 14:32
2

Warning: Typographic Hazard! Keep out of the reach of children. Not to be taken seriously. In case of accidental usage, seek urgent aesthetic assistance.

Combining two sans-serif fonts is not to be recommended in general or in particular. The main body of a document should usually use a serif face unless the document is a special exception, such as slides. In that case, it should generally use a single sans-serif face.

However, this site is not graphics se and is concerned with the purely technical question of implementing whatever typographical desiderata people happen to have, regardless of the worth of those desiderata. This answer is offered with the purpose of ensuring that users of TeX and friends can produce results just as spin-chillingly monstrous as their MS-wielding intimates and acquaintances.

Caveat emptor.

The roboto package could be rather better designed. For example, it provides a default option and a sfdefault option, but no apparent way to turn these options off. You can say, for example, default=false, sfdefault=false, but it won't make any difference - your document will still be all in sans Roboto. It also fails to use the standard ways of declaring fonts, including \DeclareTextFontCommand (except for figure switching, for some reason) and \DeclareRobustCommand. It does not declare \sfdefault in a standard way. It uses \def for no obvious reason.

However, be all that as it may, you can simply load it first, let the next package override it and then use its commands to configure your title and headings.

\documentclass{article}
\title{My Title}
\usepackage{titling}
\usepackage[condensed]{roboto}
\usepackage[default]{sourcesanspro}
\renewcommand\maketitlehooka{\robotocondensed}
\makeatletter
\renewcommand\section{\@startsection {section}{1}{\z@}%
  {-3.5ex \@plus -1ex \@minus -.2ex}%
  {2.3ex \@plus.2ex}%
  {\normalfont\robotocondensed\Large\bfseries}}
\renewcommand\subsection{\@startsection{subsection}{2}{\z@}%
  {-3.25ex\@plus -1ex \@minus -.2ex}%
  {1.5ex \@plus .2ex}%
  {\normalfont\robotocondensed\large\bfseries}}
\renewcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}%
  {-3.25ex\@plus -1ex \@minus -.2ex}%
  {1.5ex \@plus .2ex}%
  {\normalfont\robotocondensed\normalsize\bfseries}}
\renewcommand\paragraph{\@startsection{paragraph}{4}{\z@}%
  {3.25ex \@plus1ex \@minus.2ex}%
  {-1em}%
  {\normalfont\robotocondensed\normalsize\bfseries}}
\renewcommand\subparagraph{\@startsection{subparagraph}{5}{\parindent}%
  {3.25ex \@plus1ex \@minus .2ex}%
  {-1em}%
  {\normalfont\robotocondensed\normalsize\bfseries}}
\makeatother
\begin{document}
\maketitle
\section{This is a section}
Normal text.
Text Text.
\end{document}

how not to combine fonts

Somebody will show you how to use titlesec instead. I considered doing this, but considered that pushed the limits of morality too far. I wouldn't use it myself, so I really shouldn't recommend it to others.

1
  • Thank you! see my comment above regarding the double-sans combo. – Peutch Aug 18 '17 at 14:30

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.