1

Here is my attempt so far to create a LaTeX document with centered text that looks as large as it can be.

Code:

\documentclass{article}
\usepackage[a4paper,landscape]{geometry}
\pagenumbering{gobble}
\begin{document}
\vspace*{\fill}
\begin{center}
  \Huge
  \begin{minipage}{15mm}
    \fontsize{1024}{1024}\selectfont
    Foo
  \end{minipage}
\end{center}
\vfill
\end{document}

Output:

enter image description here

The font is too small compared to the page? How can I increase the font size further that it appears to cover the entire page? Setting larger and larger fonts like 2048, 3000, etc. do not seem to have any effect. Please help me to set a really large font size.

4 Answers 4

2

Like this?

enter image description here

\documentclass{article}
\usepackage[a4paper,landscape,showframe]{geometry}
\pagenumbering{gobble}
\usepackage{graphicx} % <-- added
\begin{document}
\vspace*{\fill}
\begin{center}
\resizebox{\linewidth}{!}{Foo}
\end{center}
\vfill
\end{document}
1

You need a font that is scalable (default cm font is not). Here, I use \usepackage{lmodern} though the cm alternative would be \usepackage{fix-cm}. I also tweak some other things.

Another thing to consider if you want to fill the page is to add a margin option to the geometry invocation, such as margin=5pt.

If you use a non-scalable font, the only choice is to scale the image (which is different than using a scalable font).

\documentclass{article}
\usepackage{lmodern}
\usepackage[a4paper,landscape]{geometry}
\pagenumbering{gobble}
\begin{document}
\vspace*{\fill}
\centerline{\fontsize{500}{500}\selectfont Foo}
\vfill
\end{document}

enter image description here

1

If you use OpenType/TrueType (otf/ttf) fonts, and fontspec package [Scale=...] option and compile with xelatex or lualatex, you can scale up to around 140 times. There is a maximum size, though (if the size exceeds maximum, around Scale=150, it is reset to 10pt). There is no non-zero minimum size.

With article class, default page size, default font size,

Scale=80 produces a page like this:

scale80

At 337% zoom to see ordinary letter in yellow:

scale80 with 337 zoom

Scale=140 page:

scale140

MWE

\documentclass{article}
\usepackage{xcolor}
\usepackage{fontspec}
\setmainfont{Noto Serif}
\newfontfamily\fbig{Noto Serif}[Colour=blue,Scale=80]
\newfontfamily\fnorm{Noto Sans}[Colour=yellow]
\newfontfamily\fbigger{Noto Serif}[Colour=red,Scale=140]
\begin{document}
\noindent{\fbig a\kern-0.4em}{\fnorm a}
\newpage
\noindent\fbigger a
\end{document}
4
  • Completely unrelated: I noticed that between September 2019 and March 2021 you didn't apply syntax highlighting to your posts (presumably because you didn't like the new highlighter), but now you do. If I come across such a post incidentely (as happened today) do you mind if I edit to switch the highlighting on?
    – Marijn
    Sep 24, 2021 at 13:06
  • @Marijn No probs. Go ahead. (I didn't know about syntax - still a lot to learn.)
    – Cicada
    Sep 24, 2021 at 13:47
  • @Marijn What highlighting do you mean? I used to mistakenly believe that none was compulsory for code (until someone remarked in a comment to the effect that it wasn't), but, from what I could see, putting it in or leaving it out makes no difference on my setup (Firefox on Windows). Perhaps I haven't activated a setting or something.
    – Cicada
    Sep 24, 2021 at 14:39
  • If you remove none it should highlight, but it can take some time in the preview to take effect, or some more changes are needed to the code/other parts of the post, it is a bit unclear (to me) when exactly the highlighting is applied. But once you post the edit then the effect is immediate.
    – Marijn
    Sep 24, 2021 at 14:43
0

If you run your code through pdflatex, it'll say you:

LaTeX Font Warning: Font shape `OT1/cmr/m/n' in size <1024> not available
(Font)              size <24.88> substituted on input line 9.

[1{/home/romano/texlive2021/texmf-var/fonts/map/pdftex/updmap/pdftex.map}]
(./lalla.aux)

LaTeX Font Warning: Size substitutions with differences
(Font)              up to 999.12pt have occurred.

which is quite a hint on what happened. You are using the default fonts, which are not fully scalable. If you add \usepackage{lmodern} what you have is:

Overfull \hbox (1459.6197pt too wide) in paragraph at lines 11--12
[]\OT1/lmr/m/n/1024 Foo

(well, that it would not fit in 15mm was quite clear...) and your output file is

enter image description here

;-)

You must log in to answer this question.

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