Outils pour utilisateurs

Outils du site


issue188:latex

Ceci est une ancienne révision du document !


We have learned a lot about individual tools and techniques. It is time to practice some of those tools and techniques (and learn some new ones) to make things. This issue’s project is a small poster. It could be used to advertise a garage sale, or a lost pet, or announce a community meeting, or whatever you like. We will include an image, use different font sizes, and play with other settings.

Remember what we are going to generate is a standard PDF file. It can be printed on your own printer or given to someone else to print. Instant print shops will often accept PDF files on USB sticks as input for their work. This is one way to get around Microsoft Word's domination of text files.

Of course, the first thing we need to do is design the poster. I suggest you do that with paper and pencil, without the use of a computer. Ideas seem to flow faster when there is a direct physical connection between hand and paper. Our poster is going to have the photo of our lost pet at the top, taking up about one-third of the page. There will be a large heading centred on the page, maybe above the photo, maybe below the photo. Then there will be some text describing the animal: name, color, collar, etc.

Here is the code for the first attempt (shown right).

And here is the result. The image is okay but the text is much too small. We need the title to be very large, and the rest of the text large enough to fill the page. For help in instances like this, I do not turn to CTAN. CTAN is wonderful if you want to know if there is a package that will do some task or if you need help to use a particular package. What we need to know is how to change font sizes. For task-oriented help, I start with The Not So Short Introduction to Latex by Oetiker, Partl, Hyna and Schlegl.

When I did a search for “font size”, I discovered there are a few ways to set the font size. The first way is to set the base font size in the documentclass instruction. However, only three sizes are available for documentclass - article: 10pt, 11pt and 12pt. Looking further, we come to Section 5.2: “LATEX chooses the appropriate font and font size based on the logical structure of the document (sections, footnotes, . . . ). In some cases, one might like to change fonts and sizes by hand.” This looks promising. Here is our poster text with the font size keyword Huge added (top right).

We could also establish a “Huge” environment with \begin{document} \begin{Huge} and then add \end{Huge} before \end{document}. Both of these changes increase the size of the type to about 25pt. This is an improvement, but it is not large enough. We need the text to be larger.

When I went online and asked about larger font sizes, some people suggested using the “beamer” document class install of “article”. Beamer is an old document class for producing slides for presentations, very useful, but not what we want. In addition, changing document classes also changes many other things than just font size. Others suggested using the memoir document class. It looks more promising. However there is a 615-page book for this class, not something I want to tackle while I am trying to put this project together. From Stefan Kottwitz at linux.org comes this simple and elegant solution.

\documentclass[a4paper,10pt]{article} \usepackage{fix-cm} \begin{document} \fontsize{60}{70}\selectfont Huge text \end{document}

When I tried the fontsize{48}{60} property without usepackage{fix-cm}, I got a warning saying the default font does not have that size (60pt), the largest available (24.9pt) was used. Adding the fix-cm package means a variety of Type 1 fonts can be used. Their sizes can be adjusted as needed. The selectfont property must be used after any font property is changed, or there will be an error when compiling. Incorporating these two lines into our poster code gives us what we want.

I tried several font size values in order to get the text to fill the page. The full code for the poster becomes (shown right).

Latex. In the meantime, experiment with making single page posters. One suggestion is to play with the setlength properties in the preamble to discover what they do – singly, and in combination with each other.

issue188/latex.1672738456.txt.gz · Dernière modification : 2023/01/03 10:34 de auntiee