Jump to content

Book tool/Help/Books/for experts

From Meta, a Wikimedia project coordination wiki
Other languages:
Printed PediaPress books of Wikipedia content.

This page gives experienced users details on the advanced functions of the Book tool. Among other things it explains how the layout of books can be improved and how books are stored on Wikipedia.

Adding articles to a book[edit]

Add a particular revision to your book

Older revisions of a page can be added to a book collection instead of the current version by using the history tab. By choosing loading the relevant older revision from the history page, the wiki page can added to the book in the same way as before, by clicking the "Add wiki page" link in the menu on the left. (See the step by step guide for more help). If an older revision has been added, this specific revision will always be used. If you add the most current version of a wiki page, always the latest revision will be used.

Add the entire contents of a category in one click

To add the entire contents of a category in one click first navigate to the relevant category page. Then click the "Add category" link in the "Create a book" section of the menu on the left hand side.

Saving books[edit]

Format of stored book pages

A book with the title "My book" and the subtitle "Example", with two chapters named "Foo" and "Bar", each containing three articles, with the last article having a fixed revision number would be shown using the following syntax.

== My Book ==
=== Example ===
:[[First article]]
:[[Second article]]
:[[Third article]]
:[[Fourth article]]
:[[Fifth article]]
:[{{fullurl:Sixth article|oldid=20}}Sixth article version:20]

You can also create books without the use of the input box and Special:Books page. The wiki syntax to use is:

Title The title is contained in double equals signs.

Example: == Title ==

Subtitle The subtitles is contained in three equals signs.

Example: === Subtitle ===

Chapter headings Chapter headings are preceded with a semicolon.

Example: ;Chapter name

Add an article An article is inserted as a wikilink after a colon.

Example: :[[Article]]

Use a fixed article revision To use a fixed revision of the article you can use:

Example: :[{{fullurl:Article name|oldid=Version number}}Article title]

Renaming of articles You can use a pipe ('|') to rename the article in the book.

Example: :[[Python (Programming language)|Python]]

Location of books

Books can either be saved in the user's namespace [[User:Name/Books/Bookname]] or as a community book at [[Wikipedia:Books/Bookname]]. All books are grouped into the Category:Wikipedia:Books.

Loading books[edit]

Each wiki page that is a member of the category Category:Wikipedia:Books can be loaded by clicking the "Load book" link on the left hand menu on the page.

Improving the book layout[edit]

Some wiki-markup can lead to problems in the generation of PDF documents as part of the book feature.

Templates and specific contents[edit]

Templates will be displayed differently in the PDF version compared to how they look in the online version of an article. This can be fixed by either substituting the current template or removing the template from the content that cause problems in the PDF. As a rule of thumb, all content (especially templates) that is not useful for an offline version of the document, should be excluded from the print version.

There are four ways to resolve issues caused by templates:

1) Exclude templates

A template can be excluded from content by adding it to the Category:Exclude in print. Note: Many templates use other templates to function. Therefore groups/types of templates can be excluded by adding the commonly used template to this category. This feature is currently broken.

2) Exclude certain specific content

By using {{Hide in print}}, certain specific content, such as a few words or an image, can be excluded from printing.

This content will be printed.{{Hide in print|This content will not be printed.}}This content will be printed.

3) Include certain specific content only in print versions

The {{Only in print}} can be used to insert content that shall only be visible in offline versions.

Example: print this and display it in the browser {{Only in print|this is only in PDFs or printed books visible, *not* with the browser}} this is visible in the browser and in print as well.

4) Substitute templates

You can create a print version of a template under the name "TEMPLATENAME/Print" with TEMPLATENAME being the name of the original template.

5) Use CSS

Elements in class "noprint" are not included in the output.

Dealing with source code[edit]

Don't use the <pre> tag, but use the source tag. You also should consider breaking long lines. The PDF renderer does include a code prettifyer.

Do not insert an image just before the source code, since source code would be printed over the bitmap. In other words, source code doesn't wrap around an image (that is with the version of May 2009).

Multi-wiki Books[edit]

Using the extension it is currently impossible to create a collection of content from multiple different wikis. However this page shows how to create a book containing articles from multiple wikis.

See also[edit]