LaTeX/Themes

Newcomers to LaTeX often feel disappointed by the lack of visual customization offered by the system. Actually this is done on purpose: the LaTeX philosophy takes a point at doing the formatting while the writer focuses on the content.

In this chapter, we will show what we can achieve with some efforts.

Introduction
In the following we will write the theme, a package that will only change the appearance of the document, so that our document will work with or without the theme.

Note that if it may look eye-candy, this is absolutely not a model of typography. You should not use such theme for serious publications. This is more a technological example to exhibit LaTeX capabilities.

Package configuration
Nothing much to say here. This is a direct application of the Creating Packages chapter.

We load the required packages.
 * is used to prevent page break right after a sectioning command.
 * is used to draw the fancy material.

We define a color option, you may use as much as you want. Defining colors with specific names makes it very flexible. We also use an option to toggle the fancy reflection effect which might be a little too much!

Header and footer
We use TikZ to draw a filled semicircle.

is used to set header and footer. We take care of using the style and to start from scratch by erasing the previous header and footer with.

Table of contents
We redefine commands used by.

Sectioning
This is definitely the most complex part. It is not that hard since the code is almost the same for, and.

We use to make sure there is no line break right after a sectioning command. We enclose the command in a group where we set a font size since the space we need is which depends on the font size.

Starred commands will not set the counters (LaTeX detault behaviour). You can choose to handle starred command differently by resetting the counters for instance.

We preceed the section printing by a. We make sure to end the section printing by a command to make sure following text gets printed properly.

For we make use of the  option to change the appearance accordingly.

To handle the PDF bookmarks properly we need the following lines at the end of the definitions.

Finally, for only, we want it to print in the header, so we call the  command. Here we changed the behaviour of the starred command over the original LaTeX version, since we define and use the command.