24

I'd like to use a smaller title. I'm using the scrartcl documentclass from the KOMA-Script bundle. I can change it's color font but not it's size.

\setkomafont{title}{\normalfont\bfseries\small}

Everything works exept the size.

1
  • 1
    Welcome to TeX.sx!. The scr collection of classes are based on some careful design decisions, and in particular, the documentation notes that the \setkomafont command will not change the size of titles (which are \huge be default). However, you can write \title{\large My title} instead. Commented Nov 15, 2012 at 14:09

5 Answers 5

20

The documentation (scrguien) says about the title (I highlighted the relevant part):

The title is output with a very large font size. Besides the change of size, the settings for the element title also take effect. By default these settings are identical to the settings for the element disposition (see table 3.2, page 51). The default settings may be changed using the commands \setkomafont and \addtokomafont (see section 3.6, page 51). The font size is, however, not affected (see table 3.2, page 59).

The reason why the change of font size performed with \setkomafont won't have effect is because scrartcl.cls uses

\titlefont\huge \@title\par

so any modification to the font size made with \setkomafont (applied through \titlefont) will be overwritten by the \ḩuge command after \titlefont.

Here's a possible solution using the etoolbox package to patch the internal command \@maketitle to change the default \huge (instead of \small use the desired size):

\documentclass{scrartcl}
\usepackage{etoolbox}

\setkomafont{title}{\normalfont\bfseries}
\makeatletter
\patchcmd{\@maketitle}{\titlefont\huge}{\titlefont\small}{}{}
\makeatother

\title{The Title}
\author{The Author}

\begin{document}

\maketitle

\end{document}

enter image description here

As lockstep mentions, the above solution will produce the desired solution if the titlepage option is false (which is the default). If the titlepage option is set to true, one can patch \maketitle with the help of the xpatch package:

\documentclass[titlepage]{scrartcl}
\usepackage{xpatch}

\setkomafont{title}{\normalfont\bfseries}
\makeatletter
\xpatchcmd{\maketitle}{\titlefont\huge}{\titlefont\small}{}{}
\makeatother

\title{The Title}
\author{The Author}

\begin{document}

\maketitle

\end{document}

Here's some code that will work whether titlepage is set to true or false:

\documentclass{scrartcl}
\usepackage{xpatch}

\setkomafont{title}{\normalfont\bfseries}
\makeatletter
\xpatchcmd{\maketitle}{\titlefont\huge}{\titlefont\small}{}{}
\xpatchcmd{\@maketitle}{\titlefont\huge}{\titlefont\small}{}{}
\makeatother

\title{The Title}
\author{The Author}

\begin{document}

\maketitle

\end{document}

Another option (mentioned by Andrew Swann in a comment), but I am not sure if this will have undesired side effects, is to use the font size switch directly in the argument of \title:

\documentclass{scrartcl}

\setkomafont{title}{\normalfont\bfseries}

\title{\small The Title}
\author{The Author}

\begin{document}

\maketitle

\end{document}
6
  • I'd recommend xpatch and not regexpatch for this kind of patches (the latter is still unstable).
    – egreg
    Commented Nov 15, 2012 at 18:20
  • @egreg good to know. I've made the change. Thank you. Commented Nov 15, 2012 at 23:34
  • Could you check your answers still work? I'm running Version 3.1415926 (TeX Live 2013) on OS X Mavericks, and the MWE produces title text of the same size as usual. Substituting \Large or even \tiny makes no difference to the output. Thanks.
    – JGC
    Commented Mar 9, 2014 at 18:34
  • 2
    @GonzaloMedina This solution does not work any more, at least the ones with etoolbox or xpatch.
    – Keks Dose
    Commented Mar 19, 2014 at 18:07
  • 1
    @KeksDose Thanks for the heads up! I'll take a look at this and propose an updated answer. Commented Mar 20, 2014 at 12:19
5

A simple solution by H. Voß in one of its books:

\addtokomafont{title}{\let\huge\Large}
1
  • this is a clever hack :)
    – azimut
    Commented May 8 at 21:35
3

I don't have a complete answer, but turning on \tracingpatches helped me see that the patch command wasn't working because it isn't matching on the second argument in the \patchcmd command. So I simplified the change:

\setkomafont{title}{\normalfont\bfseries}
\makeatletter
\patchcmd{\@maketitle}{\huge}{\Large}{}{}
\makeatother

This simplification works where there is no titlepage option is true, but from looking at the scrartcl.cls file, I suspect this will change size for \part commands as well.

Perhaps someone who knows what they're doing could please produce a robust version? Thanks.

3

I've now found another approach that works, namely renewing the \maketitle command. For example:

\makeatletter
\renewcommand\maketitle{
   \begin{center}
     {\large\bfseries\@title\par\vspace{0.3em}}
     {\scshape\@author, \@date}
   \end{center}
}
\makeatother

This reduces the size of the title, author and date, puts the latter two on the same line, and puts them in small caps.

You'll need someone more expert than I am to comment where patching or renewing is a more appropriate solution.

0

Since Gonzalo's excellent solution and accepted answer stopped working around 2014, here's an update for anyone with the same question.

As of TeXLive 2024, the relevant line in scrartcl.cls (both for \maketitle and \@maketitle) is the following:

{\usekomafont{title}{\huge \@title \par}}%

Thus we can update Gonzalo's solution.

Here's some code that will work whether titlepage is set to true or false:

\documentclass{scrartcl}
\usepackage{xpatch}

\setkomafont{title}{\normalfont\bfseries}
\makeatletter
\xpatchcmd{\maketitle}{\usekomafont{title}{\huge \@title\par}}%
  {\usekomafont{title}{\small \@title\par}}{}{}
\xpatchcmd{\@maketitle}{\usekomafont{title}{\huge \@title\par}}%
  {\usekomafont{title}{\small \@title\par}}{}{}
\makeatother

\title{The Title}
\author{The Author}

\begin{document}

\maketitle

\end{document}

screenshot of a maketitle with the title in small font instead of huge

You must log in to answer this question.

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