Outils pour utilisateurs

Outils du site


issue225:latex

Ceci est une ancienne révision du document !


Another month has gone by and another FCM has been published. This time I am going to work with a few of the many packages under the “P” topic at ctan.org. There are around forty different topics starting with “P”, so I had no trouble finding a few that will work, and that seem useful to at least some of you who read this column. As usual, I will ignore topics for languages. This includes: Persian, Piedmontese, Polish and Portuguese. I will also exclude any packages which are not part of the default installation of Latex. Remember there are over five thousand default packages so this restriction is not very limiting. In the Page Select topic, there are three packages which can control the pages that will be used in the final document. The pagesel package allows for all pages to be “printed” (the default), or just odd numbered pages, or just even numbered pages, or specific pages. Page selections can be made using the same syntax that is commonly used when printing to a printer: comma-separated page numbers, or dashes to indicate page ranges. These can be combined. The examples from the documentation show [1, 4, 9], [7-10,3], [odd,3-6], [-4,3,even,7-8]. The last two examples indicate the priority of the key words over specific page numbers. [odd,3-6] prints 3 and 5, [-4,3,even,7-8] -4 indicates pages from the start to page 4 so 3 is included, but even indicates only even numbered pages will be printed, so pages 2, 4 and 8. Selecting pages for printing before the PDF is compiled means steps in the compiling process that rely on page numbers will be affected. Tables of contents, indices, cross-references, footnotes, end notes, etc, will all be affected.

Page section tools could be useful to hide information from viewers of the final document. For example, a teacher might find it useful to put all the questions for a test on odd-numbered pages and all the correct answers on even-numbered pages. There are two other page selection packages, selectp and selectpage. Both were uploaded to CTAN in 1987. I suggest you use pagesel from 2020 if you want to experiment. There are twelve packages that will allow text to be typed in parallel columns. These are useful in scholarly publications for translations or for adding commentary to text. The paracol package by Nakashima and Kurtz has 315 pages of documentation plus a 64-page user manual. The documentation is written using the package. One column is English and the other is the Latex document used to generate the English. If nothing else, this is quite a feat of writing. I suppose it could be argued the actual documentation is only half of 315 pages. However I find it very helpful if the documentation shows both the Latex code and the result of that code.

The way to get started is to put usepackage{paracol} in the preamble. Then start the document and start with the command begin{paracol}{2} to generate two columns. (It is just as easy to set up and use more than two columns.) The command to move from one column to another is switchcolumn. Switchcolumn can also have a number as an option in brackets. If no number is indicated, then the next input will be placed in the column that is next. For example, starting in the left column, the switchcolumn command automatically moves the next input from left column to right column. If currently in the right column, then the next input goes into the left column. Switchcolumn followed by an asterisk (*) will synchronize the columns, matching the length of text to the longest column in the input block before the asterisk. Graphics, tables and other features may be incorporated into the switchcolumn environment. These features are set up as floats in Latex. You may need a few iterations in order to understand how to use them in a column environment, especially if the floated items require more than one column of horizontal space. If this package sounds interesting to you, I suggest you read the User Manual and work through some examples yourself. I have generated a little example which accompanies this column. I used some paragraphs from the beginning of this article, and used LibreOffice to translate them into French. The code is shown (right) with this article. I removed most of the text.

The paracol package is intended to be used by academics. Many packages in Latex do not have serious intentions. For example, the shapepar package is designed to bring some levity to documents. It allows the user to typeset text to a particular shape instead of a standard paragraph with flush left, ragged right and left indent. The example shows the first paragraph in a circle. There are other possible shapes and other possible options. The shapepar package can show a shape with a cutout in it. The thirteen-page document is somewhat long on technical details, and somewhat short on practical use. There are two examples of the creative use of shapepar but no code to go with them. A close reading of the documentation plus some (many?) practice documents would help a user understand how to use shapepar effectively. This package is obviously not meant for pages of technical or educational documents. It would be fun for invitations, diplomas, certificates and other documents with small quantities of text. Returning to educational packages, would you like to be able to add illustrations of atoms to your chemistry and physics homework? The bohr package adds the ability to draw Bohr diagrams to Latex documents. You may remember Bohr diagrams show atoms in “solar system” configurations with a central nucleus surrounded by electrons going around it like planets around the sun. The current version is limited to elements up to atomic number 112. (Atomic numbers, i.e. elements, are currently at 118.)

The syntax is very simple. usepackage(bohr) in the preamble and then bohr{atomic number}{atomic name}. The six-page documentation gives several other options to control the appearance of each model. The package is not limited to atoms. It can draw ions which will show the distribution of electrical charge in a compound. Important Note: The user has to supply appropriate correct values, the package does not have a database with these values.. As you might imagine the P topics include physics. There are many packages in the physics area. Packages for mechanics, optics, high energy physics, quantum theory, string diagrams, Feynman diagrams, thermodynamics, and more, are available. Some packages are for specific institutions. Presentation packages are also in the P topic. Tex/Latex is not restricted to PDFs which resemble books and journals. Tex/Latex can generate PDFs which resemble presentation files. The main package for this kind of work is called “beamer”. There are more that seventy packages available which either work with beamer or which attempt to make similar documents. If you need to generate slide shows but have no wish to use a commercial package, I suggest you experiment with Latex Beamer.

Beamer is a document class like article and book. The class was last updated in 2025 August. All (or almost all) of the packages discussed in these columns will work in beamer files. There is no need to learn a new set of commands simply because the document class is now a presentation. Because beamer files are Tex/Latex files, converting from a presentation to a text document, or vice versa, is easy. The final output of a beamer document is a PDF file which can be shown on-screen, uploaded to a web site, or given directly to participants. Documentation for beamer is extensive: 234 pages. In addition to the documentation available at CTAN, there are many other sources of information and guidance for beamer. I will explore the beamer class in one or more columns in the future. For now (above) is a code snippet and an illustration (top left) to get started. Next issue I am going to explore modifying an existing package. As I said in a previous issue I am not happy with the default formatting for the jwjournal package, so I am going to manipulate it in order to get a journal environment I like.

issue225/latex.1770018183.txt.gz · Dernière modification : 2026/02/02 08:43 de d52fr