26

Is there a way to scale the font size of all text in a LaTeX document by a certain factor, something like \scalealltext{factor=0.95}?

Edit: Text should reflow, so as to fit (a bit) more text on a page and ultimately trim down the number of pages.

Edit2: Apart from wanting to apply it to a specific problem, my question is more general. So giving specific fonts for the specific document I had when this question was raised is IMO not of much use.

4
  • 2
    I don't think that the people you're submitting the document to will be fooled by this trick. :)
    – egreg
    Sep 5, 2012 at 13:24
  • @egreg: I am aware of that :-), but it is not for an official submission anyway. Sep 5, 2012 at 14:49
  • 2
    Please, add a minimal example with the class and font setting you're applying.
    – egreg
    Sep 5, 2012 at 15:03
  • If the goal is to fit everything in a certain number of pages, one can enlarge the paper size (say, +5mm and +7mm respectively, which gives almost the same ratio), the text area (in a somewhat proportionate way, ≈4mm) and just set “Fit to printable area” when printing. The font size will stay the same, but the page size will increase, thus giving the same effect of font size reduction relative to the page. Worked for me when a file with written ideas was slowly growing and I wanted to constrain it to 8 pages. Jan 26, 2016 at 22:17

5 Answers 5

31

You could load the relsize package and issue the command

\relscale{0.95} % or whatever scaling is desired

at the start of the document.

7
  • Including it just after \begin{document} indeed produces the expected result. Only the title is not scaled, don't know why, but not a big deal for me. Also, it seems the scaling works in steps as there is no difference between e.g. 0.82 and 0.84 but a big difference when going to 0.85 Sep 5, 2012 at 12:35
  • 3
    @Rabarberski - Depending on which font family you use (e.g., the default, Computer Modern), you may also want to load the cmsuper package. This should enable finer steps in the use of \relscale.
    – Mico
    Sep 5, 2012 at 12:51
  • 1
    @Rabarberski This happens when the fonts are available only on fixed sizes, such as the original Computer Modern fonts. Try \RequirePackage{fix-cm} before the \documentclass line.
    – egreg
    Sep 5, 2012 at 12:53
  • @Mico: cmsuper (or cm-super) could not be found by my Mixtek installation, although I see it is available on CTAN. Sep 5, 2012 at 13:02
  • 1
    @Rabarberski Indeed! With \relscale you get the best approximation in the available sizes \small, \footnotesize, \scriptsize, \tiny when the factor is less than 1 or \large and so on when the factor is greater than 1.
    – egreg
    Sep 5, 2012 at 13:18
8

it depends to the font if it is scalable or not and if there is a LaTeX support. It is easy if you can use OpenType fonts with xelatex or lualatex. With pdflatex you can scale down the complete output. But this influences also all lengths, like \textwidth:

\documentclass{article}
\usepackage{lipsum}
\AtBeginDocument{\pdfliteral { 0.95 0 0 0.95 0 0 cm }}% set TMatrix
\begin{document}
\lipsum
\end{document}
7
  • Scaling the complete output is not an option, as the goal is to reflow to text so that I can trim a document to one page less. I've edited my question to reflect this. Sep 5, 2012 at 11:51
  • What is the solution with xelatex and lualatex, by the way? I've just been looking for it in the fontspec documentation and couldn't see how to do it. Sep 5, 2012 at 12:09
  • 7
    \setmainfont[Scale=0.95]{...} or \addfontfeature{Scale=0.95}
    – user2478
    Sep 5, 2012 at 12:14
  • 2
    @Rabarberski: As I wrote, it depends to your used fonts and you told us nothing about that ...
    – user2478
    Sep 5, 2012 at 12:15
  • 1
    @Rabarberski: the log files always show what fonts are used. Or run pdffont or use the Adobe Reader or ...
    – user2478
    Sep 5, 2012 at 12:19
2

Why not add \linespread{0.95}, it reduces the space between two lines with 5%, so there will be more text on your page.

1

You could use the extsizes package:

\usepackage[20pt]{extsizes}

From https://www.ctan.org/tex-archive/macros/latex/contrib/extsizes?lang=en:

The standard Latex classes (article, report etc) support ten, eleven and twelve point text. These are the commonest sizes used in publishing. However, for certain applications there may be a need for other sizes. The extsizes classes (extarticle, extreport, extbook, extletter, and extproc) provide support for sizes eight, nine, ten, eleven, twelve, fourteen, seventeen and twenty points.

See for example change font size of moderncv.

0

I use KOMA-script.

\documentclass[a4paper,fontsize=9.5pt]{scrartcl}
\usepackage{lipsum}
\begin{document}
\section{Section}
\lipsum
\end{document}

Also see Change font size globally. With KOMA-Script: bad size for indexes and exponents.

5
  • This answer appears to presume that the original document font size was 10pt. However, did the OP give any indication that this is the case? At any rate, you may want to make more explicit the assumption(s) your proposed solution is based on.
    – Mico
    Jul 2, 2017 at 13:56
  • Well, I myself would be glad to know how to use "scale" rather than "pt" with KOMA-script. In my case, I wanted to scale up (rather than down) by a factor of about 1.8 or 2, and the relsize package gave warning messages that fonts are too large or similar for the scaled \section's.
    – chan1142
    Jul 2, 2017 at 14:09
  • In that case, you should consider posting a new query, in which you state the particulars of your document setup, e.g., the use of one of the KOMA-script document classes. Optional: provide a link to this query, and explain what's not working for you. Be sure to provide an MWE (minimum working example).
    – Mico
    Jul 2, 2017 at 14:15
  • I don't agree. It provides a means to scale all fonts though it may not look super beautiful to some keen eyes. I think KOMA-script provides a simple solution if you are ready to adjust the fontsize parameter. Why not?
    – chan1142
    Jul 2, 2017 at 15:31
  • You may have misunderstood what I wrote. You mentioned getting warning messages when using \relsize -- all I was trying to do was to encourage you to post a new query, to ask about the nature of these messages and how, possibly, to get rid of them. If you're not interested in finding out more about these things, then that's of course entirely your business. Nobody is going to tell you otherwise.
    – Mico
    Jul 2, 2017 at 16:26

You must log in to answer this question.

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