Outils pour utilisateurs

Outils du site


issue191:latex

Ceci est une ancienne révision du document !


I collect postage stamps. Stamps are collected and displayed in stamp albums much like printed photos used to be stored and displayed in photo albums. In stamp albums, each stamp issued by a country is allocated space. That space is usually indicated by a black line around it. Often there is a short description of the stamp’s contents, its colour, and other distinguishing marks. Sometimes, it is necessary to make a new page for the album to contain a special issue or an issue not included by the manufacturer of the album.

For shows and exhibitions, collectors will build a display around a particular theme or special interest; for example, the various cancellation marks issued by one post office for the last hundred years, or the variations in a particular issue due to differing manufacturing restraints in war time. These special displays require custom display pages. These custom pages can include space for both the stamps, and text describing the stamp’s special features or features of interest. These custom pages can be made in word processors which can be fairly straightforward or difficult, depending on the word processor. They can also be made in software designed for image editing or desktop publishing. Again this can be straightforward or difficult, depending on the software and the abilities of the user. We will attempt the same in Latex / Tex.

We will try to generate a page with a couple of places for special items. I will think of them as stamps but you can think of them as places for images of any kind or any other kind of content. Each place for the stamp will have a border around it of one point (a “point” is a typesetter’s measure, there are almost exactly 72 points to an inch). In addition to the boxes for the stamps (or images) there will be captions under the boxes. We also need to have one or more places where text can be inserted.

This work could be done with Latex tools we have already discussed: tables and graphics. Tables could be used for the boxes. Captions could be put into the row under the main box. Unlike word processors, tables in Latex can be placed beside one another. We could also make an image the desired shape and size, or even make only one image and use features in Latex to set the height and width of the box. Images can have captions of course. Rather than reusing some of what we have already learned, we are going to explore other features in Latex. We are going to play with Tex boxes, and the many ways this primitive tool can be controlled.

The starting point is the following: \documentclass{article} \usepackage{inputenc, graphicx} \begin{document}

\fbox{inside the fbox}

\end{document}

The fbox makes a box enclosing the text and puts a single line frame around it. The frame is 0.2pt thick, by default. The text is 3pt away from all four frame lines. It is easy to use, but it is difficult to specify the size of the fbox .

A better element to use is framebox. Its syntax is: \framebox[width][position]{text}. The [width] option dictates the width of the box and the [position] parameter sets the position of the text inside the box. Width uses standard length units, position uses l, c, r and s – the last is for stretched. Stretched is similar but not identical to fully justified.

To set the thickness of the frame, we need to use setlength and fboxrule before using framebox. To change the distance between the text and the frame, use fboxsep also with setlength.

This will generate a frame which is 25mm wide and 40mm high, with “Issue 8” in the center. Now we have to find the tools to position the frame in the correct location on the page. Using the code above will put the frame at the left margin.

Putting the framebox inside a minipage allows for much greater control of the position of the framebox. Here is the revised code – after adding a few more bits and pieces.

I have put comments in the code to help guide you. Anything that starts with a percent sign is a comment in Latex / Tex.

It is supposed to be possible to alter the thickness of the line around the box but I have not been able to do so when using framebox in a minipage. If I use fbox in a minipage, I can change the line’s thickness but then it is not possible to have a caption.

Next issue, I plan to show off some of Latex’s abilities to format mathematical expressions. Following that, I hope to show you some of its features for drawing chemical formulae.

As usual if you have any questions about Latex, send them in, and I will do my best to find answers for you. Have fun with Latex. It is a very powerful typesetting application with a steep learning curve.

issue191/latex.1680330654.txt.gz · Dernière modification : 2023/04/01 08:30 de d52fr