"Perfect layout" in OOo Writer


Many thanks to RoryOF and FJCC from the OOo community forums for helping me with the grammar! (and with good suggestions too) Remaining errors are my responsibility.

Introduction

Writing books is a complex science, editing them a complex art. In this article I'll try to talk about the "art of editing" showing the tools (and the tricks) available in OOo Writer to make the "perfect looking book".

Yes, fanatic supporters of LaTeX (a system that I used, use and respect): it is possible to use Writer to create documents with a professional look. In some points you will need to work a little more (on other points much less), but it is possible.

But before starting, some general considerations:

  • The appearance of the book is less important than its contents, so it is wise to leave the formatting for the end.

  • The book formatting should concern the writer only if the writer will also be the editor (using for example one of those "self editing" on-line services): if the task of editing will be performed by another person(s) nothing the writer might insert by way of formatting will be left there in the published work. The writer only need to worry about the document's structure to simplify the editor's work.

  • This article takes for granted that the reader is familiar with the Style concept and how this concept is implemented in Writer. That is, this article assumes the reader is able to define/edit Styles (paragraph, character or page), that the reader understands the concept behind Linked Styles, that he/she knows how to create Page Headers and Footers, etcetera. If this is not the case, please read the documentation before continuing.

There are several interesting tutorials in the OOo community forums. You can also use the Writer's guide.

The book structure

A finished book is made of a distinct separation of component parts of the book by means of a "hierarchy" of Styles. For example

  1. Part (is for grouping chapters)

  2. Chapter (is for grouping sections)

  3. Section (groups blocks of normal text)

  4. Normal text (the main text)

  5. Special paragraphs (remarks, etcetera)

With OOo Writer building this kind of structure is really simple: it is only necessary to use a series of Paragraph Styles and assign a "Level" to each of them. The particular configuration of each style is not important during the writing process, only at the end when the final formatting is undertaken.

When the writer is also the editor

When the book content is ready, it is time to put everything in the right place and with the correct appearance.

Again, I urge the reader to consult the OOo Writer documentation.

General considerations

  • No more than 70 characters per line. Long lines with a lot of text are difficult to read. (The Old typesetting rule-of-thumb is: line length should be 2 – 2.5 times the length of the 26 letters A-Z of the font used)

  • A4 (or US Letter) is generally a bad idea. The standard size for books is around the A5 format (or half US Letter). A4 is normally used for manuals and other texts that make use of notes and/or images outside the margins: in this case the page must be big enough to permit big margins, not big text areas.

  • Give some thought to Page Headers… but do not exaggerate! Inserting some fields in the Page Header/Footer (like page number and chapter title) is a good idea, but please do not build a new book in the header. By default, the paragraph styles used by Writer in the Header/Footer has two "tabs": one in the middle of the page with centred alignment and one in the right of the page with right alignment. It is only a matter of inserting a couple of "tabs" and the fields will be perfectly separated.

  • Generally speaking the use of graphics in the Header/Footer is not a good idea: seeing the same graph on each page could be tiresome. In manuals and other business documentation it could be a good idea to have a small logo, but nothing else.

  • Think about those who will read the book!

Problems and solutions

Below is a list of possible problems (and their solutions) that the writer/editor could face in search of a "perfect layout", classified by how difficult the "solutions" are.

Simple problems

Page registry

Take a "good looking book" from the shelf of a book store and analyse it. Open it on any part that shows two facing pages full of text and compare the text lines on one page with the lines on the other: they are aligned and the number of lines in both pages is the same. If in one of those pages there is a larger object (a heading, for example), the lines before and after the object are aligned with the corresponding lines on the other page.

The convention is to not worry about the widow and orphan lines, the convention is to make lines on facing pages perfectly aligned.

Obtaining this effect with Writer is quite easy… if you know where the correct option is hidden. Edit the Page Style in use, at bottom right in the Page tab there is a check box labelled "Register-true": when checked it is possible to select a "Reference style". It is recommended to use the body text paragraph style you use in your document as the reference style.

Do you wonder what is this? Using the metric of the Reference Style selected, Writer builds a "grid" on the page and uses that grid to distribute all the text lines on the page: if the facing pages use the same grid (the grid defined by the reference style), the lines on both pages will be "aligned".

Problem solved.

Elements outside the margin

Finally, you used that A4 page to "hang" elements outside the margin, didn't you? Well, Insert → Frame, anchored to paragraph or to character (NOT as character), drag the frame to the desired position: inside the frame you can insert any kind of content like text, tables, figures…

Images surrounded by text

Insert the image as usual, with anchoring "to character" or "to paragraph" and drag it to the desired position. Now right click over it → Wrap → Optimal page wrap. If you wish the text to follow the image's shape and not an imaginary rectangle surrounding the image, in the same context menu select the option "Contour" (if you are not satisfied with the contour automatically generated by Writer, also in the same menu select "Edit contour"). To adjust the distance to text, right click on the image → Picture → Wrap tab.

You can accurately set the image position with a right click on it → Picture → and to the bottom of the "Type" tab, under "Position" select "Paragraph area" or "Paragraph text area" options.


Tables surrounded by text

Insert the table in a frame and do the same as you did for figures.

Pair kerning

This property expands or reduces the space between two characters to enhance their visual appearance, for example TA or Va. Many fonts include the needed information to perform this process automatically. Writer can use this information when the option is selected in the corresponding Paragraph/Character style (Position tab). In the latest OOo versions, this option is selected by default. 

High quality mathematical expressions

OOo Math has some limitations: few attributes, problems with pair kerning… if Math is not enough for you the "solution" is an extension called OOoLatex: with this extension it is possible to insert LaTeX expressions as high quality images.

You need a running LaTeX system, of course. This on Linux is simple, on Windows or Mac… don't ask me!

Drop caps

It is best not to be over enthusiastic with these, but some people like them… oh well. Right click over the paragraph → Paragraph → Drop Caps tab → Display drop caps.

Note:

  • A 3 line Drop cap in the first paragraph of a new chapter looks OK.  The remainder of the word of the Drop cap or the next word should usually be Small Caps or Capitals, as looks best.

  • This effect will show only if the paragraph has more than one line.

  • It is possible to assign to the leading character a particular Character Style that uses, for example, a different font.

  • If you like to use this on every first paragraph of every chapter, you can define a Paragraph Style linked with "Body text" that follows the Heading Style and is followed by Body text, and configuring the character for this new paragraph style. This Paragraph Style should not have indenting.

Not-so-difficult problems

Ligatures

Some editors use them. Some editors don't. Some people (like me) like them. Some people do not worry about them. 

With ligatures, everything is about aesthetics. In the following image you can see some of the most common ligatures and the "no ligature" counterpart.

Problem is: OOo does not support automatic ligatures, nor will it support them in the foreseeable future: 3.2 will include partial support for opentype fonts, a font format that contains information about ligatures —among other things—, but OOo will not be able to use that information.

(MSOffice does not support them either… at least for now: it seems that version 2010 will include partial support for ligatures). 

LaTeX has partial support for ligatures (I've never been able to teach LaTeX to use the "Qu" ligature) and XeTeX has the same support the otf font in use has. The only "WYSIWYG" (what you see is what you get) program I know that can use automatic ligatures is kword: that's the program I used for the first line on the previous image. Sadly, in its present state kword lacks several important features (Page Styles, Linked Styles… Stability) so it is not recommended to use it for complex documents.

But we are talking about Writer: what can we do? First of all, use a font that contains the needed ligatures (Linux Libertine, Junicode) and then, at the very end of the writing process perform the old "search and replace all" trick: insert the ligature as symbol (from the same font used in the text body! Do not mix typefaces!), copy it to the clipboard, open the "Search and Replace" menu, search for the pair of characters and replace them with the ligature.

Yes, life is cruel!…

An important note: depending on your graphic system, it is possible that the inserted ligature will look smaller than the normal text. If you zoom enough or print you will see that this is not the case and that the apparent difference is only a display problem.

Another point to consider: inserting the ligature as a symbol will "break" the spell-check for the corresponding word, that's why I recommend to do the replacement only at the end after the text is complete.

Images and figures NOT surrounded by text

For this, LaTeX is the best: you start with a \begin{figure}, continue with \includegraphics{…}, maybe with \caption{…} and end with \end{figure}. That's all: LaTeX do its magic and the figure ends in the right position by itself. In Writer, as with every WYSIWYG processor it is not so easy… but this does not mean you need to have a traumatic experience.

Let's start outlining what LaTeX does. Consider the insertion point:

  1. If there is available space, the figure is moved to the page beginning, without leaving text before it.

  2. If the page beginning is occupied, the image is moved to the page end, without leaving text after it.

  3. If both the page beginning and the page end are populated, the image is moved to the next page.

We can't do all that automatically in Writer. The best approach is to insert the figure in its own empty paragraph, anchoring it to the character (not as character) and only when the document content is finalised do a right click on the figure's frame → Frame and to the bottom of the "Type" tab, under "Position" in "Vertical" select "From top" or just "Top" for images that belong to the page beginning ("Bottom", for the others), and in "to" select "Page text area" as you can see in the image.


The figure will be correctly positioned. 

NOTE: in "to" you can also select "Entire page", but in this case you will need to set the "by" option to be equal to the page top (bottom) margin.

Important note: Footnotes are part of the text area, if you send an image to the bottom it will cover the footnote!

End Notes but not in a new page

In current Writer versions, when you use End Notes these go to a new page and you cannot add text after them. This limitation is reported here:

[issue 3329]Should be able to disable page break before endnotes

A possible way to overcome this limitation is to write the End Notes without using the End Notes utility…

No, I'm not mad (well, just a bit): starting with OOo 3.0 it is possible and really easy to cross reference Numbered Lists, so a possible "solution" for the End Notes limitation is to create a numbered list at the document's end/chapter's end/where-you-need end, then go to the note's insertion point, open Insert → Fields → Other → Cross-references tab and select under "Numbered Paragraphs" the "end note" you need.

You must be careful about the list order!

Yeah, it is a dirty trick…

A possible problem with this possible solution: if the numbered list uses a separator after the number (usually a dot), this separator will be inherited by the cross reference:

[Issue 94995]Number format of cross reference to numbered paragraph

In this case it is better to create the list without separator.

Fields and Table of Content do not honour the direct formatting in the original text, first part

If a Heading contains a subscript, for example if you write "H2O", this format will be lost in the Table of Contents and in every Field that refers to that Heading, showing "H2O".

The corresponding bug reports:

Character formatting not retained in entries of TOC, table lists, etc.

Fields don't keep character formatting.

A possible solution (OK, work-around…) is to use "true sub(super)scripts" inserting them with "insert symbol". The Linux Libertine font contains not only the numbers from 0 to 9 as sub and superscripts, but also almost all the "basic Latin" alphabet.

Again, do not mix typefaces! Always use the same font for both, text and symbols!

Difficult problems

Fields and Table of Content do not honour the direct formatting in the original text, second part

In case you cannot use true indexes (you are writing about general relativity and need a Greek character as superscript, or more simply want/need to use a font that does not contain the needed special characters) the only option is to manually edit the table of contents: right click on it and → Edit Index/Table → uncheck "Protected against manual changes". Keep in mind that all manual changes will be erased if you update the Table of Contents. Perform this editing only when the document content is finalised…

For OOo 2.x there was a macro for rewriting the Table of Content automatically, but it does not work any more on 3.1.1 nor 3.2 beta.

And now, the difficult question: the Fields?

If you have a Field in the Page Header/Footer that refers to the chapter name it will be necessary to work a bit, because Fields cannot be manually edited like the Table of Contents: it will be necessary to create a Page Style identical to the "base" Page Style and, by inserting manual page breaks to use this new Page Style and introduce by hand the needed information.

Yes, the only "solution" to the Cross Reference Field Problem is to not use the Cross Reference Field!

Did I tell you that using the right font is a good idea?

Again, the reports (yes, I'm insisting):

Character formatting not retained in entries of TOC, table lists, etc.

Fields don't keep character formatting.

Please, vote/comment on these reports!

Conclusions

A possible first reaction to this article could be "is it worth the effort?".

The answer will vary according to the user's needs: manually correcting the position for ten or so figures is not the same as correcting a hundred. Inserting symbols once in a while to correct a deficiency in OOo's field implementation is not the same as doing it for all the fifty chapters.

I can hear the LaTeX experts saying "what a waste of time! Doing this even once is too much!". Well, sometimes it is better to not listen to the experts: LaTeX is nice, but it is quite far from being perfect:

  • The package used to have images surrounded by text it is unstable: if it is near to the bottom of the page the whole figure could disappear from the output document without any single warning from LaTeX.

  • Even when it does not disappear, it only accepts rectangular images: if you need the text to follow a non rectangular shape you will discover the dark side of LaTeX… tip: it is not possible to automatically do that.

  • You will also discover the dark side of LaTeX when trying to insert the copyright/dedicatory page: the "small adjustments" in LaTeX could be a big headache!

  • The only way you know in LaTeX if the inserted image/table/equation/whatever-you-inserted is inside the page margins is to compile the document: the whole LaTeX theory of "you only need to worry about the content" breaks into small pieces here.

  • Defining a new "documentclass" (the "equivalent" of Writer's templates) is a work for LaTeX gurus. You may argue that defining documentclasses is not needed considering the huge number already available… but I'm not convinced: especially when I consider the difficulties of installing a new documentclass that does not come with the LaTeX distribution I'm using.

  • If you only need to print a document then you can use plain LaTeX: that means you will need to use eps images. If you need to create a "live" pdf file you need to use pdfLaTeX and a different "LaTeX Preamble": that means you will need to use pdf images because eps will not work…

  • You also need to change the Preamble (and compiler, and possibly image format) if you need to use the system fonts through XeTeX.

Writer has all the problems mentioned in this article but:

  • It is really simple to have images surrounded by text.

  • It is really simple to perform "small adjustments".

  • When you insert an image/table/equation/whatever-you-inserted you will immediately know the position it occupies.

  • It is really simple to define styles and templates.

  • You have great freedom regarding image types. In fact, you can use different image types in the same document.

  • All system fonts are available (or will be from OOo 3.2… with the ligature limitation, though).

There is no perfect system. You need to evaluate which system will give you fewer headaches because none of them will be headache free. In this article I tried to show that the headaches with Writer are not so huge after all.