4

I'm making a journal publication in LaTeX and I've been trying to change the font of all my non-main texts to a sans serif font. Meaning, all the headings, titles, section titles, abstracts and so on are in sans serif while the main text is in a serif font.

I've only been able to change the section headings using \titlesec, but not much else.

8
  • Welcome to TeX.SX! Things to take into consideration: Does the journal allow sans serif fonts at all? Which journal? Do you have a working document to show us?
    – user31729
    May 25, 2016 at 20:20
  • 1
    Use one of the KOMA-Script classes. It is the deafult there.
    – user2478
    May 25, 2016 at 20:25
  • @ChristianHupfer I'm developing the publication with a prof so I have say over what fonts are used.
    – Alondra
    May 25, 2016 at 21:21
  • If you don't want to use @Herbert 's suggestion, titling can be used for the main title and titleps for the header/footer is probably best if using titlesec. (Not what I'd use, but I try to avoid titlesec.)
    – cfr
    May 25, 2016 at 22:04
  • 1
    I want to be cautious here, but it is usually the journal who decides on the typographical things, e.g. fonts, and how the frontmatter is arranged. Most journals have their on class package to be used, or if not, they will format/copy-edit your work after acceptance. Unless you are submitting something to a typesetting/graphical journal, I would not worry too much about such superfluous details.
    – Matsmath
    May 26, 2016 at 7:26

3 Answers 3

8
\usepackage{sectsty}

\begin{document}
\allsectionsfont{\sffamily}
[...]
\end{document}

This will put all your headings in a sans-serif font.

Output example:

sectsty example

4
\documentclass{scrartcl}
\usepackage{kantlipsum}
\title{A title}
\author{An author}
\date{\today}
\begin{document}
\maketitle
\begin{abstract}
  \kant[1]
\end{abstract}
\section{A section}
\subsection{A subsection}
\kant
\end{document}

enter image description here

If you want the abstract text itself in Sans Serif use \begin{abstract}\sffamily

3

LaTeX is a funny beast sometimes, since what should be a fairly simple thing can often end up more complicated than you expect. In this case, because the different parts of the document (title, abstract, headings, etc.) are constructed separately, you need to change each part separately. For some things (like the title parts) the hacky way to do this is just to put the formatting command inside the text itself, although this is not really good practice. The less hacky way is to use packages that provide interfaces to the relevant bits. Since you're using titlesec already, I've used titleps for the page headers; I've used the titling package for hooks into the title and the abstract package for hooks into the abstract. Of course all of this can be done without packages, but then you need to modify the internal commands of the document class, which is IMO much messier.

\documentclass{article}
\usepackage[sf,pagestyles]{titlesec} % make section headings \sffamily
% make headers \sffamily
\newpagestyle{main}[\sffamily]{
    \sethead{\thepage}{}{\sectiontitle}
    }
\pagestyle{main}
\usepackage{titling}
% make titling elements \sffamily
\pretitle{\begin{center}\sffamily\LARGE}
\preauthor{\begin{center}
            \large\sffamily \lineskip 0.5em%
            \begin{tabular}[t]{c}}
\predate{\begin{center}\sffamily\large}
\usepackage{abstract}
% make abstract title \sffamily
\renewcommand\abstractnamefont{\sffamily}
\usepackage{kantlipsum}
\title{A title}
\author{An author}
\date{\today}
\begin{document}
\maketitle
\begin{abstract}
\kant[1]
\end{abstract}
\section{A section}
\subsection{A subsection}
\kant
\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .