Ceci est une ancienne révision du document !
Once again we will venture into the world of Latex. For those who are new to this series, in each issue I explore another facet of Latex, one of the offshoots of a remarkable, freely available, open source, typesetting software package called Tex. Developed and written by Stanford University professor Donald Knuth, it was released in 1978. Professor Knuth wanted to have a typesetting program which would print his documents with the same look no matter what operating system was used. This was imperative in mathematics and computer science - which uses complex and complicated formulas. Tex has been expanded since 1978 to make it possible for anyone to produce well designed, high quality, books (either printed or electronic) with minimal knowledge of typesetting. Tex documents look the same not only independent of operating systems but also independent of when they are generated. In the 1970s and 1980s memory and storage were both expensive. Tex was designed to be modular so the user only loaded into memory the modules needed for one particular document. For example, if a document does not have a table, then do not load the table module.
Typesetting instructions always start with a backslash followed by a keyword. The keyword may have options which are surrounded by square brackets and/or content which is surrounded by curly brackets. Latex is a document production system which uses Tex as its base. It may be the most popular document production system based on Tex but there are others including PdfTex, XeTex, and Luatex. Each system has its own supporters, its own strengths and weaknesses. Some macros (packages) are usable in only one or more systems, some macros work in all.
This time, we will explore a few more of the many packages available at ctan.org. (CTAN is the Comprehensive Tex Archive Network). CTAN is also the web home base for the international TUG: Tex Users Group. I encourage all users of Latex to become members of TUG if possible.
I have worked my way through the alphabetical list of topics to “F”. The number of packages that start with F is enormous. I picked just a few for this issue. The first one I will explore this time is fancyhdr, developed in 1994 and last revised in 2025 January. The user manual is 131 pages in English, it is also available in Italian. There are “training slides” available in German. It is discussed in vol 1 of The Latex Companion. Instructions for users are on the first 85 pages of the manual, the remaining pages cover implementation and change logs. This seems like a lot of information about headers and footers, document features most of us take for granted or ignore. To use the fancyhdr package issue these two commands:
\usepackage[options]{fancyhdr}
\pagestyle{fancy}
There are many commands which are part of the fancyhdr package, they can be typed within the preamble to the document, before the begin{document} command. Some can also be typed in the body of the document. Read and make use of the examples in the documentation. Here is the code for the first graphic (next page, top left).
\usepackage{fancyhdr}
\pagestyle{fancy}
\usepackage{lipsum} % inserts paragraphs of nonsense text
\fancyhead[L]{Left Header} % Upper or lower case and text for the header
\fancyhead[R]{Right Header}
\pagenumbering{arabic} % four other options available
\fancyfoot[c]{page \thepage} % thepage means the current page
\begin{document}
\lipsum[1-4]
The next package I will take a look at is fancypar, offering five predefined decorative styles for text paragraphs according to the documentation. Again, I encourage you to read the documentation. (This manual is only 19 pages, with lots of example code and images of results.) Here is the code for the second graphic (top right):
\usepackage[x11names]{xcolor}
\usepackage[linecolor=Chocolate1!100!white!80]{fancypar}
\usepackage{lipsum}
\begin{document}
\NotebookPar{This time we will play ...} \fancyparsetup{spiral=false,interheight=4pt,intercolor=Cornsilk3}
\NotebookPar{This time we will play …}
I dropped the paragraph text out of the code because it is just sample text. You can see the results in an image. This package allows for great customization. Be warned, if you use a color name that is not recognized, the color defaults to black. If you want more (much more) information about supported color schemes and color models, read the documentation for the xcolor package.
Next, I will work with a package that could be useful for people who need assistance with layout and positioning. It is called fgruler (foreground ruler), and it puts a rule on a selected page, or all pages, at a fixed position. It can be loaded either with
usepackage[options]{fgruler}
or
\usepackage{fgruler}
\setfgruler{package options}
The setfgruler command can also be used in the body of a document. Options include
unit=cm (metric ruler – default) or unit=in (inches)
type=upperleft, upperright, lowerleft, lowerright plus five others
There are ten other option=value pairs available. Most options have several values attached to them.
Fgruler can also be used to insert a ruler into the text with the \ruler command with its three options as shown in the code below. Again, there are a significant number of possibilities for the position, direction, length, color and style of the inserted ruler.
The documentation is among the best I have read so far for a Latex package. There are lots of snippets of code and the corresponding examples. There are no pages in the documentation which describe the various behind-the-scenes commands used to make this package. Instead, there are seven pages of examples and illustrations followed by 28 individual pages with 28 sets of commands and results.
Here is the code. Again I deleted most of the text to save space. (shown above)
\usepackage[x11names]{xcolor} %Required if you want colours other than black
\usepackage{fgruler}
\begin{document}
\setfgruler{unit=cm,type=upperleft,hshift=3cm,vshift=3cm,color=blue} %Inserts rulers on top and left edges the full width of paper, shifted down and to the right 3cm
This time we will play with …
\ruler[cm]{rightdown}{10cm} %Inserts ruler in text 10cm long.
I spent a short time with the fncychap package. It has seven predefined styles for chapter level headings. In addition, the user can also modify the existing styles or generate new ones with the information available in the documentation. What is not mentioned but which should be obvious is the chapter level heading is available in the document class “book”, not in document class “article”. The book document class defaults to two-sided printing which brings its own benefits and costs.
I wanted to generate labels using Latex. The flabels package initially was attractive. However it is designed to generate a specific label for the spines of A4-sized binders. So I looked for some other package to demonstrate. Since I worked as a teacher and continue to do volunteer teaching, I chose the fancyhandout package.
Fancyhandout makes a new class of document. It uses three levels of headings, section, subsection and subsubsection, which are not numbered. As you can see from the sample, there are default colors for various items. These can be customized. The geometry package is used to generate margins of 2.25cm. These can be altered using the geometry package commands. Various other changes can be made and are explained in the documentation.
Here (previous page) is the code that generated the sample [above]. It is longer than I usually show, I hope it will be helpful. I can already anticipate using this package in my volunteer teaching.
Because my system has a limited number of F packages, I have decided to look at how to install new packages to an existing Latex system in the next issue. Hope you can join me for that important topic.