Linux.com

Feature

Creating a book with OpenOffice.org Writer

By Dmitri Popov on January 27, 2006 (8:00:00 AM)

Share    Print    Comments   

OpenOffice.org Writer uses templates to store the initial formatting of a document. If you plan to use Writer to write your next book, you will need a good book template, or rather several, for the different components of your book. This article walks you through the process of creating a complex book template that includes front matter (copyright, acknowledgments, and preface), table of contents, chapters, appendixes, and an alphabetical index -- all assembled into a master document.

I'm assuming that you are familiar with the concept of page, paragraph, and character styles and you have a general idea how to define and use them.

Creating a chapter template

Let's start with creating a chapter sub-document template to use as the main building block of the book. Of course, the specific settings of the chapter template will vary, but at the very least you have to define the Default page style as well as a paragraph style for a chapter title. Create a blank Writer document, right-click in the Stylist windows, click on the Paragraph Styles button, and choose New from the context menu. (If you don't see the Stylist, press F11 or choose Format -> Styles and Formatting.) In the Organizer tab, enter "Chapter title" in the Name field and select Text body from the Next Style drop-down list. Click on the Font tab and define the style's font properties. Use other tabs to define other style settings.

To adjust the Default page style, click on the Page Styles button, select Default, right-click on it, choose Modify, and adjust the page settings. The Default page style in the chapter template is used solely to control the text flow and the overall layout of the chapter. This means that you might want to set the page size and the margins while leaving the rest of the settings as they are.

Defining the outline numbering for the chapter template

Figure 1
Click to enlarge
In a nutshell, outline numbering allows you to specify a hierarchy of different paragraph styles. In the chapter template, you must set the Chapter title to Level 1. To do this, choose Tools -> Outline Numbering, select 1 from the Level list, select Chapter title from the Paragraph Style list, and define the Separator as shown in Figure 1.

Note: You must manually adjust the "Start at" option for each chapter. For example, the "Start at" option for the second chapter must be set to 2, the same option for the third chapter will be 3, and so on. This will require some manual work if you want to rearrange the chapters, but so far I haven't been able to come up with a better solution.

Creating front matter sub-documents and appendices

One way to manage the front matter is to create separate sub-documents for the copyright and preface pages. Create a new Writer document, then create a new paragraph style called Copyright title, which you use for a copyright page title. Write the copyright text and save the document as, for example, Copyright.odt. In a similar way, create a Preface document, add a new paragraph style for the preface title, write the preface, and save the document as Preface.odt.

If your book includes appendices, you have to create a template for them as well. The appendix template is similar to the chapter template in every respect except the outline numbering. Since you've already defined the Chapter title as a Level 1 heading in the Outline Numbering, you must choose another level for the Appendix title style. I usually choose Level 5, which gives me up to three (Level 2, 3, and 4) "empty" levels in case I have to add additional styles to the outline numbering later. This can come in handy if the chapters contain not only the chapter title, but also different sub-headings.

Usually, appendices have a different ordering form than chapters. If you want your appendices to be ordered as Appendix A, Appendix B, Appendix C, and so forth, you must select the proper numbering type from the Number drop-down list (Figure 2).

Creating a master document

Once you are done with the chapters, copyright page, preface pages, and appendices, you can start working on the master document, which you use to put all the pieces together. First of all, you should outline the master's overall structure, which may look something like this:

Page styles
  • Title page: No numbering, no footer/header
  • Copyright page: No page numbering, no footer/header
  • Table of Contents (ToC): Page numbering starts with i, no header, book title and page number in the footer
  • Preface: Page numbering continues from ToC, no header, page number in the footer
  • Chapters: Page numbering starts with 1, book title in the header, page number and chapter's title in the footer
  • Appendices: Page numbering continues from the last chapter, book title in the header, page number and appendix number in the footer
  • Alphabetical index: Two column page, page numbering continues from the last appendix, no header/footer
Paragraph styles
  • Book title: Will be used for the book's title on the title page. It must be created in the master.
  • Copyright title: Imported automatically from the Copyright.odt sub-document. Requires further adjustments.
  • Preface title: Imported automatically from the Preface.odt sub-document. Requires further adjustments.
  • Chapter title: Imported automatically from the chapter sub-documents. Requires further adjustments.
  • Appendix title: Imported automatically from the appendix sub-documents. Requires further adjustments.
  • Text body: Overrides properties defined in the sub-documents, thus it must be adjusted in the master
  • Header and footer: Must be created in the master
  • Index: Must be created in the master

With this information at hand, create a new Writer document to be the master.

Defining page styles in the master

Figure 2
Click to enlarge
When working with page styles, you should keep in mind that the pages in the book template must be either left or right and they must mirror each other. Another important thing is that in most cases each sub-document starts with a new right page. This means that you have to create several sets of pages. In this case, you will need at least four page style sets:

  • Front matter first page, front matter left page, front matter right page
  • Chapter first page, chapter left page, chapter right page
  • Appendix first page, appendix left page, appendix right page
  • Index first page, index left page, index right page

As an example, let's start with creating the Chapter page style set. In the Stylist window, click on the Page Styles button, right-click somewhere in the window, and select New. In the Organizer section, give the page style a name (for example, Chapter first page). Leave the Next Style drop-down list as it is for now, and click on the Page tab. Specify the page size and margin settings, and select Only right from the Page layout list. Use the Header and Footer sections to activate and specify the header and footer settings. Click OK when done.

Create a new page style called Chapter left page and select Only left from the Page layout list in the Page section. Note that the right margin of the left page must mirror the left margin of the first page. Click OK when done. Finally, create the third page style called Chapter right page with exactly the same settings as the Chapter first page style.

Now you have to link all three page styles:

  1. Right-click on the Chapter first page style, choose Modify, and select Chapter left page from the Next Style list. Click OK.
  2. Right-click on the Chapter left page style, choose Modify, and select Chapter right page from the Next Style list. Click OK.
  3. Right-click on the Chapter right page style, choose Modify, and select Chapter left page from the Next Style list. Click OK, and you are done.

Don't forget that left and right pages mirror each other. This means that things like page numbers, headers, and footers must also be mirrored. In other words, if the header and footer on the left page are aligned left, then they must be aligned right on the right page.

Now that you know how to create a page style set for chapters, you can create other page style sets. Once you've done that, you can add chapters to the master document. To add a chapter, press and hold down the Insert button in the Navigator, select File, and select the chapter you want to insert.

Working with paragraph styles in the master

Although you've inserted the chapters into the master, they still use the Default page style. To force the chapters to use the page styles defined in the master, you can use a clever trick based on the Text Flow option. Using it, you can make each chapter start with the Chapter first page style, which then "flows" into the Chapter left page and Chapter right page styles.

To do this, click on the Paragraph Style button in the Stylist, right-click on the Chapter title style (it was imported when you inserted a chapter into the master), and click on the Text Flow tab. In the Breaks section, tick the Insert check box, select Page from the Type list, select Before from the Position list. Tick the With Page Style check box and select Chapter first page from list. Make sure that Page Number is set to 0. The break property of the Chapter title style ensures that every chapter starts with the Chapter first page style. And since all three chapter page styles are linked together, the master will use them until it encounters the next chapter title.

Using a similar technique, you can specify page breaks for the copyright title, preface title, and appendix title paragraph styles. When you have done that, you can insert the rest of the sub-documents (copyright, preface, and appendices) into the master.

Once all the sub-documents have been inserted into the master, you must specify the outline numbering, where the chapter title is set to be at Level 1 with the numbering option 1, 2, 3..., and the appendix title set to Level 5 with the numbering option A, B, C....

Adding a table of contents and alphabetical index

Using the defined outline numbering, adding a table of contents (ToC) to the master is rather easy. Let's say you want to insert the ToC between the copyright and the preface. In the Navigator, select the Preface.odt item, press and hold down the Insert button, and select Index. Select Table of Contents from the Type list, make sure that the Outline check box in the Create from section is ticked, and press OK. To force the ToC to start from a new (right) page, use the previously described trick: In the Stylist, right-click on the Contents Heading paragraph style, choose Modify, and click on the Text Flow tab. In the Breaks section, tick the Insert check box, select Page from the Type list, select Before from the Position list. Tick the With Page Style check box and select Front matter first page from list. Click OK when done.

Adding the alphabetical index is equally simple. In the Navigator select the very last item from the list of sub-documents, press and hold down the Insert button, and select Index. Select Alphabetical Index from the Type list, and press OK. Note that Writer inserts the index before the last item. To move it to the end of the book, drag it down using the mouse.

Dmitri Popov is a freelance writer whose articles have appeared in Russian, British, and Danish computer magazines.

Dmitri Popov is a freelance writer whose articles have appeared in Russian, British, US, German, and Danish computer magazines.

Share    Print    Comments   

Comments

on Creating a book with OpenOffice.org Writer

Note: Comments are owned by the poster. We are not responsible for their content.

Use Docbook

Posted by: Anonymous Coward on January 28, 2006 11:23 AM
My advice would be to skip OO.o altogether to write a book. Word processors are great for quick documents and for WYSIWYG formatting, but a book isn't a quick document and how a book is formatted isn't of prime concern (hopefully the content is paramount.)

I'd use a markup format, like DocBook or even HTML, while skipping the word processor altogether. Use Vim or Emacs to write up the text instead.

#

Re:Use Docbook

Posted by: Anonymous Coward on January 30, 2006 03:52 PM
Interesting! I wrote my last book completely in vi, all 840 pages of it, in fact. I did have to import it into Word before sending to my editor, however.

#

Re:Use Docbook

Posted by: Anonymous Coward on January 31, 2006 08:31 PM
There actually exists a book which have been written in OO.o Writer: http://www.oreilly.de/catalog/oobasger/index.html

#

LaTeX

Posted by: Anonymous Coward on January 28, 2006 02:02 PM
Why not use LaTeX? Wouldn't that be a better option? WYSIWYG isn't always helpful.

#

Re:LaTeX

Posted by: Morten Juhl Johansen on January 30, 2006 03:14 AM
I agree. LaTeX is the primary tool for this task.
I am currently playing with Texmaker, but more WYSIWYG-ish LaTeX-tools like LyX and Texmacs are available.

#

Re:LaTeX

Posted by: Anonymous Coward on January 31, 2006 05:16 AM
Can anyone point to some good book "templates" for lyx? Especially for novels.

all the best,

drew
------
http://www.ourmedia.org/node/145261
Record a "copyleft" song and enter a contest with a $1,000.00 prize.

#

This is not for professional use!

Posted by: Anonymous Coward on January 28, 2006 08:38 PM
LaTEX and other pro solutions have their place when you want to make serious "book" projects, the kind publishing companies sale.

Sometimes you want to write a book the quick way (e.g., for personal publishing at a Linux Users Group or a short book of class notes); these kind of books usually are made in Word. In that case, Openoffice is a much better alternative, not only for being free/Free, but because it works better, IMO -- even though I must agree WYSIWYG brings some problems on its own.

Alas, this kind of article is a clear sign that a suite won. Hopefully to be followed by Calc (spreadsheet) macros.

#

OOo Works for me.

Posted by: Anonymous Coward on January 28, 2006 11:35 PM
I've been editing and publishing a book (a rock climbing guide) since 1990. The first edition was done in a DOS version of WordPerfect and printed on a printing press. We printed 1000 and it took 10 years to sell them all. The next two editions were done in MS Word (output as PDF via Acrobat) and printed digitally. The 4th edition is in OOo. The transition from Word to OOo was far easier than the traumatic shift from WordPerfect to Word.
See the 3rd edition at http://www.climbers.org/bonecho/guide01.html

#

One way, not the only way

Posted by: Anonymous Coward on January 30, 2006 10:16 AM
Why the strong feelings against WYSIWYG? Like LaTeX and DocBook (which I use regularly), using OpenOffice.org Writer is just another way to create documents. And, like LaTeX and DocBook, OOo Writer has its pluses and minuses.

If created and used properly -- with proper character paragraph and character styles -- a word processor template can be used to create a well-structured document. It's when users don't use styles properly that trouble starts.

What the author is pesenting is one way to do the job. Not the only way, maybe not even the best way for some.

#

Book Publishers seldom use Latex, Docbook, etc.

Posted by: Teilo on January 31, 2006 05:34 AM
I have been in the book printing world for a long time, and have edited a lot of books myself. I have tried Latex. I have tried Docbook.

Ever tried something as simple as choosing a particular OpenType font, changing your margins, setting up tables, working in Unicode, or embedding EPS files in any of the above? It's a nightmare. If you want to spend many hours learning the underlying languages so thoroughly that you can write a layout that actually functions, good for you. I have far more productive things to do with my time.

Docbook and Latex are great for a very specific scholarly audience (like scientists and mathematicians), or if you like being forced into someone else's formatting mold. But if you need the ability to easily make broad formatting changes give me a decent page layout program, like InDesign 4 any day. (Don't even try to talk to me about Scribus.)

#

Re:Book Publishers seldom use Latex, Docbook, etc.

Posted by: Anonymous Coward on January 31, 2006 07:48 AM
True. In fact, many publishers require authors to submit manuscripts in Word format, which is then pulled into something like Quark or InDesign. Or even FrameMaker (viz. O'Reilly and Associates).

And I agree: it's a bear to change the margins in LaTeX. Easier in DocBook; just create a customization layer.

#

Re:Book Publishers seldom use Latex, Docbook, etc.

Posted by: Anonymous Coward on January 31, 2006 11:54 AM
Any you can export Writer document to LaTeX<nobr> <wbr></nobr>:o)
http://qa.openoffice.org/issues/show_bug.cgi?id=2<nobr>4<wbr></nobr> 813

#

Re:Book Publishers seldom use Latex, Docbook, etc.

Posted by: lahvak on February 01, 2006 12:33 PM
Changing margins in LaTeX? Lets see:

\usepackage[left=1in,right=1in,top=1in,bottom=1in<nobr>]<wbr></nobr> {geometry}

In a wordprocessor, you would have to fill in exactly the same information in some dialog box.

Working in Unicode? Modern TeX distro like MacTeX will do that pretty much transparently, you don't really have to do anything special.

Embedding eps files? What's that hard about
\includegraphics[width=2in]{file.eps}

I agree that tables in LaTeX are not very flexible, you would probably be better off with ConTeXt. If you want flexibility and control, but still prefer a TeX type markup language, ConTeXt is definitely the way to go.

#

Re: Book Publishers seldom use Latex, Docbook, etc.

Posted by: Anonymous [ip: 172.18.31.8] on September 05, 2007 08:13 PM

I do not know much about publishing, but I believe LaTeX and Docbook users are not focusing on book design, but on composing. Actually, I use LaTeX a lot and have used Docbook and I agree it is hard doing some sophisticated formatting with these formats - but that is the question. When I write LaTeX, I do not intend to think about formatting, but just about content. Later I export to some PDF, ODF etc. and the editor formats it, since he does it better than me.



Anyway, although I do not like WYSIWYG editors for composing, a lot of people do not understand more content-focused formats, and OpenOffice.org Write is perfect for them. I have used its styles, and it is great. The problem is that more "mundane" writers do not use even the styles...

#

I use Lotus Word Pro

Posted by: Anonymous Coward on February 01, 2006 03:32 AM
I use Lotus Word Pro. The interface has a MUCH better metaphor for divisions and sections. I have tried in vain and to the point of utter rage trying to ask OO.o to mimic Lotus Word Pro.

Here is my dillema. I write, own, or otherwise obtain multiple document the content of which I cannot or do not want to change. But, I can change the format, and/or I can choose to LINK to the document OLE-sytle.

Now, I create several pages: TOC, glossary, index, etc. I want to SEE and manage these files in ONE space, not multiple instances of a word process. Try that in OO.o.

Well, you CAN link/create sections of a document, but then the inserted document is "inserted" in some half-baked, assinine, maddening way. Not in print preview and not in draft mode can you SEE the document in a manner that looks like separate pages. There is only a "margin line" for a divider. When I imported docs (the "contained" doc), their formatting and layout got hijacked by the master or containing document.

Now, in LWP, I open a master doc. Name it. Save it. I decide to insert or link other docs and leave their layout, fonts, etc. UNDISTURBED. So, I go to the menu, select Create, Division, and then create from an existing document, create a file or just make a place holder which is essentially a BLANK file until I go back and put something in it. I then watch a TAB (like on spread sheets) get inserted and then I name the tab or accept the default name.

As I want to insert external docs, I just add more tabs and associate those tabs with docs that I edited previously or link to from other docs.

At this point, if I want to look at the doc I can choose from over 5 different themed layouts with the files in various magnifications: horizontal, split-screen, 1 on top and all the pages in another layout at the bottom.

Best of all: those pages are EDITABLE AND WYSIWYG even in print preview, page walker, panorama, zoomer, or docskimmer. AND, EACH and every division that I insert retains it own layout. So, my painstakingly-created and shrunk spreadsheets pasted into a landscape document don't get butchered into a portrait file. Section and Division footers apply to ONLy their section or all as I choose; page counts and other information can apply to all division or just the ones I say, and renumbering can be done as well.

Now, this is simply not possible in OO.o, at least not to the polished, pleasing, intuitive manner that is present in LWP. OO.o is seriously in remiss for not having taken the darn time to LOOK at LWP and just mimic LWP. They've squandered resources mimicing ms orifice so much that now the almost defunct LWP cannot even be mimiced without SO/OO.o looking wayward or mismanaged. This is yet ANOTHER PERFECT case of where FLOSS copying ms is NOT the best or smartest idea.

Now, if only IBM/Lotus and SUN/OO.o would collaborate on a quasi OpenSmartSuite... It would be a KILLEr office suite....

David Syes, posting as anonymous (forgot my pwd) and don't want to log into my e-mail acct at work)

#

This story has been archived. Comments can no longer be posted.


 
Tableless layout Validate XHTML 1.0 Strict Validate CSS Powered by Xaraya