Outils pour utilisateurs

Outils du site


issue222:latex

Welcome or welcome back to FCM and to Latex. I realized a short time ago I have been presenting packages with specific functions. I have neglected to mention how to start Latex documents so that ‘packages’ can be used. Latex documents can be made in any application that will generate plain text (ASCII) files. I use TexStudio in Linux; there are other applications which work well; there are online applications many people like. (A text editor is sufficient if the user is familiar with Latex commands.)

Every Latex command starts with a back-slash. Every Latex file starts with: \documentclass[options]{class name}. Unless I state otherwise, I start with \documentclass[11pt,letterpaper]{article}. This is the first command in the preamble. It is the only required command in the preamble. The document itself starts with \begin{document} and finishes with \end{document}. All document contents must be written between these two commands. If there are no specific instructions, Latex ignores all whitespace except for one space between words and two new lines between paragraphs. If you need to use any other commands in order to duplicate the work I do, I will tell you in my column.

This time, I am going to explore packages available in the K and L topics at ctan.org. Well… not K since it contains only one package other than those using Tex / Latex in Korean, Kurdish and Kurmanji.

There are about 40 packages in the L topic. The languages represented are Latin, Latvian, Lithuanian. There is a topic called lang-invented which contains two packages, one for Tengwar script and one for Arka. I am surprised there is not one for Klingon.

There is a long list of packages in the Layout topic, all have to do with the placement of items on pages. One I have discussed previously is the widows-and-orphans package. It identifies widows and orphans in a document: single lines of text at the bottom or top of a page which belong to text on the previous or next page. Once identified, the document author can then make suitable adjustments.

A package called booklets can be helpful to people making small publications or making signatures for books. The documentation says “the pages of documents processed by the booklet package will be reordered and scaled so that they can be printed as four pages per physical sheet of paper, two pages per side of the sheet.” It continues “the default orientation is that the original document is in a portrait orientation and the pages are printed rotated onto a landscape sheet. Folding the sheet in half will produce a half-sized document, again with portrait orientation.”

The document class Leaflet is somewhat similar to booklet. It produces a two-page leaflet. The contents are printed in three fully justified columns. If printed two-sided in landscape mode, the paper can be folded to make a leaflet. The size of the sheet of paper is controlled through the options in the documentclass declaration in the first line of the document preamble. There are very detailed descriptions of the coding of this document class in the documentation. To use the default settings, simply change the documentclass to “leaflet”.

Another layout package that is of interest is hanging. As you might guess, it will set up hanging indents. An ordinary indent moves the start of line one of a paragraph a set space to the right of the left paragraph margin. A hanging indent starts line one at the left paragraph margin and moves (indents) the rest of the paragraph a set amount. Traditionally the default indent was five spaces. The hanging indent package allows the user to set the indent space at whatever distance the page designer wishes.

First (of course) the page designer must have usepackage{hanging} in the document preamble. In the body of the document, this package allows you to set a hanging indent either for single paragraphs or for a group of paragraphs using either hangingpara (one paragraph), or the hangingparas environment for a group of paragraphs. Both commands take two options: a measure of the length of the indent and a number of lines to be affected by the hanging command. The length of the indent can be any unit accepted by Latex, so in, cm, mm, em, etc. I also tried a negative number for the size of the indent. It indents the right side of the paragraph from the paragraph margin on the right side. The hangingparas is an environment so it starts with \begin{hanagingparas} and closes with \end{hangingparas}. Otherwise the two commands are the same.

This package also allows for hanging punctuation. I do not know what hanging punctuation might be used for. If this sounds interesting to you, read the documentation that comes with the hanging package.

The Leading package is very useful for many documents. The term “leading” is pronounced to rhyme with “sledding”, or pronounced as if it were spelled “ledding”. Leading is the distance between two successive baselines of text. Word processors usually set leading as a percentage of the font size. If leading is equal to the font size, it is usually called “tight”. If leading is less than type size, the lines of text will overlap. At least one word processor defaults to font size +2 points. Font sizes are usually expressed in points. (A point is almost exactly 1/72 of an inch or 0.035cm.) When setting type, the size and the leading are written 11/13: font size 11pt, leading 13pt. This gives 2pt of space between the bottom of one line of text and the top of the next line of text.

The leading package allows the page designer to control the line spacing rather than using the Latex default. Of course the larger the value of the leading the more space required for the document. Sometimes leading is adjusted so make sure a document fills a page but does not overflow onto another page. Magazines, newspapers and journals almost always use consistent type sizes and leading. Sometimes certain features, like call outs, use different type sizes and leading to separate them from the main articles. Headings are normally made larger than body text and the leading is also increased. As the author points out in the short documentation for this package, using the leading instruction fixes its size. If the font size is changed later then the leading size may need to be adjusted.

In complex or complicated documents, sometimes it is helpful to get a view of how the various pieces fit together. There is a package called Layouts which will help with this. It enables the display of a document’s layout, usually at 50% of the real size, but this is adjustable. There is extensive 55-page documentation available. Page layout parameters can all be changed using the \setlength command, for example: \setlength{parameter}{length}. Length units can be any unit accepted by Latex. If you want to know what the current parameters and their lengths are, use the \pagevalues command.

I have shown an example of the layouts package output without text to keep the image simple. You can and probably should use it with the parameters set to your desired lengths and with all the necessary contents. The layouts package will help you determine if your choices make an attractive document. Few people will read by choice what they consider to be a poorly designed or ugly document. One warning: you must use the \setuplayouts command after the begin{document} command and before any commands which might affect the text block, for example, font sizes or margins. The author recommends putting it immediately after the begin{document} command.

In the L topic, there are many packages having to do with letters. There is a package called gcard which produces a greeting card from a sheet of paper. When folded in half two times the sheet becomes a front cover, left and right inside pages and a back cover. The package establishes four environments, one for each “page” in the card. The sequence of commands is:

\begin{frontcover} Some text for the front cover \end{frontcover}

The same structure is used for insideleft, insideright and backcover. Any page environments not set up are left blank when the file is compiled. According to the author this is a very simple package which should not interfere with any other package. That means you can use fonts, colours and graphics to make printed cards attractive. As I said, this package is designed for printing cards on paper. It does not make e-cards.

The last package for this time is called Coloredbelts. The author wanted a way to insert simulated coloured belts into documents like judo or karate or taekwondo belts. These could be useful to indicate levels of attainment or simply to add visual interest to a document.

This is a fun package to play with. There is four-page documentation for this package. It lists the available colour names and has a few examples. The size of the belt can be changed with width and height options. Since the belts are inline objects they can be affected by commands used to change font size. There is a nice graphic illustrating the possibilities in the documentation. Because the belts are SVG images in individual PDF files, each belt can also be rotated or scaled.

There are many more packages linked to the L topic. Perhaps I will come back to this area in the future. For this time, enjoy your work with Latex. Let me know if there is some situation which requires some help, or if you want to know will Latex do this.

issue222/latex.txt · Dernière modification : 2025/11/02 18:53 de d52fr