Publish a book with LyX

Post original Linux User by Michael Reed

If you need to create printed documentation, LyX might just be the answer to your prayers

Be it documentation, a vanity project or an advocacy strategy for your open source project, the printed book still has a lot of life left in it and print-on-demand (POD) has revolutionised indie book publishing in recent times. There exists great scope for content that suits the printed form, yet is created by authors who don’t expect to be on the bestseller list. Thanks to flexibility that it offers, POD is also a useful route for business documentation.

LyX is a structured documentation system that uses LaTeX, a typesetting system, as its back-end. This means that you enter the content and the system works out the best layout. As the user does not have direct control over layout, LyX isn’t optimised for free-form documents such as posters, but it comes into its own in the creation of longer, more complex projects such as a book. The LyX interface doesn’t qualify as WYSIWYG, but it does reflect elements such as emphasised text, and it does allow you to see images (called figures in LaTeX-speak) and tables within the document. Although it is a front-end to a markup system, you can typically complete a complicated project without ever encountering any LaTeX code, but you can dabble with it to add customised effects.

Most of all, LyX is a geek’s dream come true due to the way it integrates with standard Linux tools. We’ll take you through the process from starting a new document to creating the finished book.

Step by Step

Step 1 Install LyX

LyX is installed by using the package manager or by building from source. It’s a fairly lightweight application, but the installation requires a complete LaTeX system, which is much larger. LyX itself runs well on resource- constrained devices such as netbooks.

Step 2 Choose document class

For a book project, one of the Book classes is a good starting point (selected in Document>Settings>Document Class). KOMA- script is a superset of the basic LaTeX Book class, and this tutorial will assume that you are using it.

Step 3

Adhere to the document structure Document structure is an area of LyX that works best if you don’t try to fight with it. Hit Return twice and nothing will happen the second time as LyX won’t allow you to impose your own structure. All documents make use of a hierarchy, and depending on document type, the top heading might be chapter or part. After this come levels such as section, subsection and paragraph. Handily, if you select a section header from the drop-down menu, the shortcut appears in the status area.

Step 4

Use the section browser LyX has a nested section browser in the
form of a sidebar that greatly eases navigation on a book-sized project. It is also switchable so that you can browse by figures, index marks and other elements. You can even move whole sections around the document.

Step 5 Add index marks

Market research tells us that having an index greatly increases the sales potential of a non-fiction book. Fortunately, LyX has an index feature and allows you to simply add an index marker, possibly a nested one, within body text. Add these as you go along.

Step 6 Add citations

Cite your sources by adding them inline. LyX supports a few citation styles such as (Wikipedia-style) numeric and author-year. It uses BibTeX databases but can’t edit them, so you’ll have to add one of the many external editors such as KBibTeX or JabRef (Java).

Step 7 Insert ERT (Evil Red Text)

You can complete most projects in LyX without seeing any LaTeX code, but there are examples floating around the internet to help you do just about anything you can imagine with text and layout. It also comes into its own for more mundane, but useful tasks such as starting a numbered list on a number other than 1. ERT can be inserted inline, added to the preamble to affect the entire document or, if you come up with something handy that you want to move between documents, implemented as a module.

Step 8 Set up converters

Converters are used for including ‘foreign’ file formats within your document. These can be image files or documents. As long as there is a command-line tool for handling the file, you can adapt LyX to work with it. Useful if you’re compiling content from diverse sources.

Step 9 Set up image converters

If you have a command-line program or a script that can convert images, you can include them directly on the page. For example, to work directly with Dia files, add this string

“dia -e $$o -t eps $$i”

to the converter section.

Step 10 Add images

Handling images will probably be your first brush with insets, a LaTeX concept. Creating an image inset gives you the default setup of a single figure and a numbered caption. However, you can add sub-figures, each with its own optional caption. When not needed, images can be folded away within the editor. When the output document is generated, LaTeX will do the job of arranging things so that everything fits. Note that you can also add images directly into a document – for example, a symbol that sits within a sentence.

Step 11 Chapter precis

A precis is a small summary, and they appear as part of the contents section. When using the Koma class you have to resort to some LaTeX code by inserting ‘\cftchapterprecistoc{Enter summary text}’. Remember to spell-check this text separately.

Step 12 Add equations

If you’re of a mathematical bent, you’ll be pleased to hear that LyX has an extensive equation editor built in. Even if you’re not a specialist, just being able to add the odd properly formatted equation looks good. Like images, equations sit in insets.

Step 13 Add labels

Many elements such as section headings, figures and tables can have an associated label. This means that you can refer to them in the text and the output will contain a reference such as ‘see fig 2.5 on page 29’.

Step 14 Front matter

The front matter is the page of a book that gives details about the publisher of the book and any legal declarations, and LyX has text styles to help. There are no legal requirements for the format of the page, but conventions exist, so look it up online.

Step 15 Layout and format

Time to get the ruler out and start measuring some books. Once you’ve found a book size that you want, start considering styles for section headings and the header and footer of each page. These are controlled with a combination of the GUI and LaTeX hacking.

Step 16 Designing the cover

LyX doesn’t have any graphic design functions of its own, so you’ll have to rely on tools such as GIMP, Inkscape and LibreOffice Draw. The printing service that you have selected will supply detailed specifications for your cover image, the dimensions of which may vary with the number of pages in your book. Although PDF is designed to be a portable format, some features such as font selection and transparency may vary between platforms. For this reason, consider generating a 300dpi PNG or TIFF instead of using PDF.

Step 17 Add an ISBN

You don’t need an ISBN number to publish a book, but it’s often required by retail channels. The Nelson Agency allocates the numbers in a minimum block of ten for £121. The Python script bookland.py can generate a suitable barcode.

Step 18 Order proof copies

Before committing to a print run, make a proof copy. Although LyX and LaTeX are handling things, you can never be completely sure that the layout you’ve designed works until you have a copy in your hands. Some printing firms offer an initial proof copy as part of the overall deal, but a better approach might be to use a service that allows the printing of single books. Order a few to try out different designs. The cover is another area that needs to be viewed in the flesh.

Step 19 Investigate alternative output formats

LyX is particularly adept at outputting to other file formats. This means that you can create, for example, a structured website from your source document or an eBook edition. Search around and you’ll find LaTeX converters that can be used for most document types.

Step 20 Select a printing service

Printing services fall into two basic categories: casual printers like Lulu.com, that can handle a single print of a book, and companies that will only accept runs of 50 copies or more. The large-batch printers are usually substantially cheaper per book.

Trackbacks

Deixe uma resposta

Preencha os seus dados abaixo ou clique em um ícone para log in:

Logotipo do WordPress.com

Você está comentando utilizando sua conta WordPress.com. Sair / Alterar )

Imagem do Twitter

Você está comentando utilizando sua conta Twitter. Sair / Alterar )

Foto do Facebook

Você está comentando utilizando sua conta Facebook. Sair / Alterar )

Foto do Google+

Você está comentando utilizando sua conta Google+. Sair / Alterar )

Conectando a %s

%d blogueiros gostam disto: