1

I took some templates/macros that use \Large/\small... to configure the font size of my title page. The problem is that when I change the font size of the rest of the document using \documentclass[12pt]{memoir} instead of \documentclass[10pt]{memoir}, then the font size of the title template is increased, breaking the layout.

I tried to use \fontsize{10}{12}\selectfont to force a smaller font for the page title, but the problem is that it does not reduce the font size of \Large/\small… They are still Large/small compared to the document 12pt instead of the current 10pt.

How can I simply change locally the font size in such a way that \Large, \small… size is updated to match the new local font size?

enter image description here

MWE:

\documentclass[a4paper,12pt]{memoir}

\begin{document}

\section{Simple text}

\noindent Hello\\
{\small Hello $\leftarrow $ This one is smaller than previous line as expected}

\section{``Small'' text}

{\fontsize{10}{12}\selectfont \noindent Hello\\
  {\small Hello  $\leftarrow $ I expect this one to be smaller than previous line\dots and its bigger}}

\end{document}

EDIT

Concerning the solution proposed in the comment, \relsize{} looks great for new text, but it won't actually change the macros \Large, \tiny… So this solution won't apply when I want to convert an existing document (tikz picture, pre-made template...). Also, using stuff like \Large allow people to use consistent sizes across the whole document: it would be quite easy to have many different \relsize{...} in a same document if one is not very cautious.

I tried the solution proposed by @muzimuzhi in the comments. It works very well on page title (it does reset the layout in page title indeed... but not sure why when I put it on a new page but not inside a page title it does not change the layout), but it does not work great when used inside an existing text. It adds a huge space (and can push the text in the margin), as highlighted in red:

enter image description here

MWE:

\documentclass[a4paper,12pt]{memoir}
\usepackage{lipsum}
\begin{document}

\section{Simple text}

\noindent Hello\\
{\small Hello $\leftarrow $ This one is smaller than previous line as expected}

\lipsum[1]

\section{``Small'' text}

Text before: see the space (it even goes into the margin) {\makeatletter\let\newcommand\renewcommand\input{size10.clo} Hello\\
  {\small Hello  $\leftarrow $ I expect this one to be smaller than previous line\dots and it does work now!}} Text after.

\end{document}
11
  • 1
    \large etc will adapt to the documentclass option already so that would be the standard answer: using \fontsize{10}{12} is to explictly not following the documentclass option. for full control over font sizes and text widths you can test if the size options are used and specify a size in each case Commented Jun 14, 2021 at 19:46
  • 2
    Maybe a look at the relsize package is interesting for you (you could, instead of using \Larger, etc. use \relscale{1.2} to make the current font 20% larger than the current size).
    – Skillmon
    Commented Jun 14, 2021 at 19:59
  • 2
    Instead of \fontsize{10}{12}\selectfont, you can reload the corresponding font-size config file size10.clo. Note it not only changes commands like \large, but also lengths for page geometry or spacing. All the changes will be local. Commented Jun 14, 2021 at 20:19
  • @muzimuzhiZ Thanks a lot, it works great in page title (I used this answer for the syntax [1]). However, as you pointed out, it does change the page geometry in my title page... but not always: when I put {\makeatletter\let\newcommand\renewcommand\input{size10.clo} my text} outside of the page title it seems that the geometry is not changed: any idea why? Also, when used inside an existing text, it adds a huge space before (see my edit). Any idea how to make it work also for inline texts? [1] tex.stackexchange.com/questions/15835/…
    – tobiasBora
    Commented Jun 15, 2021 at 7:59
  • 1
    Also, using stuff like \Large allow people to use consistent sizes across the whole document: But you you seem to be asking for a solution which changes these macros in ways which make them inconsistent. So what would count as a satisfactory solution?
    – cfr
    Commented Mar 29 at 4:19

1 Answer 1

2

You can easily change the font size using the fontscale package. (Full disclosure: I am the package author.)

I show how to change the font size commands from \tiny to \normalsize to \Huge mid-document. Note that you typically only need to set the font sizes once in the preamble. This is just for demonstration.

\documentclass{article}
\usepackage{fontscale}
\usepackage{parskip,stix2}%looks nicer

\begin{document}

Package defaults:
\smallskip

\PrintSampleText[\PrintFontSizeCommand: \CurrentFontSize]

\bigskip
Set font sizes using a musical scale:
\smallskip

\fontscalesetup{musical,normalsize/size=10bp}

\PrintSampleText[\PrintFontSizeCommand: \CurrentFontSize]

\newpage
Set arbitrary font sizes:
\smallskip

\fontscalesetup
  {
    tiny=5,
    scriptsize=6,
    footnotesize=7,
    small=8,
    normalsize=9,
    large=10,
    Large=11,
    LARGE=12,
    huge=14,
    Huge=16
  }

\PrintSampleText[\PrintFontSizeCommand: \CurrentFontSize]

\end{document}

You must log in to answer this question.

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