Benutzer:Dirk Huenniger/wb2pdf/manual

Aus Wikibooks
Wechseln zu: Navigation, Suche

Command line Version[Bearbeiten]

It you are using the command line version we recommend to read the man page.

Tables[Bearbeiten]

There are some commands for the typesetting of tables. Tables can include horizontal as well as vertical rules and a frame surrounding the table. They will be drawn if and only if the template prettytable or the attribute class="wikitable" is present in the header of table be drawn. Secondly it might be useful to reduce the fontsize for a whole table. This can be achieved by writing latexfontsize="scriptsize" into the header of the table. In contrast to the tolerant behavior of mediawiki, wikipdf requires new tables to start in a new line. You can furthermore define the width of columns of a table by using the width attribute with a value in percent (%) in the attributes of cells of the table. There is also support for table headings. In a large table spanning several pages, it is often required to repeat the header (that is some rows in the beginning of the table) on the beginning of each page. This is done by marking some cells as header cell. This is done by using the exclamation mark (!) instead of the vertical bar (|) when writing down the table in the wiki syntax. The program considers the fist few rows to be part of the header as long as they continuously contain header cells.

Images[Bearbeiten]

List of Figures[Bearbeiten]

A table of images, their authors and licenses is automatically created in the appendix. In order to determine the name of the author, the information template on the description page of the image is analyzed, thus it needs to be present and to have a valid author entry.

Size of Files and Image Resolution[Bearbeiten]

Often the size of file allowed by the application, you want to use the generated pdf in, is limited. Especially submitting the PDF to a print on demand service often causes this issue. You can reduce the size of the file by dithering the images to a lower resolution, loosing some quality. Typical printing machines used for manufacturing books in an industrial manner today use a resolution of 300 dpi. Thus a higher resolution is usually not necessary. You can enter the maximum allowed resolution in the Graphical User Interface. All images with higher resolutions will be dithered accordingly.

Width of Images[Bearbeiten]

The width of image will usually be as large as possible, determined by the width of the page as well as the margins. You may modify this behavior by using a px command when including the image in the wiki source text. 400 pixels correspond to the maximum available width. Thus writing 200px will reduce the size to one half of the original size.

Wrapping Images[Bearbeiten]

The template Latex Wrapfigure can be used for that. It takes two parameters, image and width. Width is between 0.0 and 1.0, where 1.0 means full width of text. 0.5 means half the width of the text and so on. Image has to be a link to an image in the wiki notation starting and tailing double square brackets. see also section on used defined templates of this document and manual of the wrapfigure latex package found on ctan.

Templates[Bearbeiten]

Automated Expansion[Bearbeiten]

In the default case all Templates are expanded by MediaWiki. This is the meaning of the setting Template Inclusion = MediaWiki in the GUI.

Manual Expansion[Bearbeiten]

It is hard for an algorithm to determine how a mediawiki template should be converted to LaTeX code. This is because templates are implemented using HTML in an extensive manner in order to produce a good looking output on a Webbrowser, which is very different from the "what you get is what you mean" style LaTeX is using. Still all templates are algorithmically expanded by default as explained above. But we recommend an other way of dealing with templates, which will explain now. You have to set Template Inclusion=normal in the GUI. In this case only a limited number of templates is taken into account by wb2pdf. All other templates will cause the text UNKNOWN TEMPLATE message to come up in the resulting file. It is recommendable to search the output files for this string in order to make sure that all templates were processed correctly. To extend the template processor with custom templates you have to modify the file templates.user in the directory wb2pdf/trunk/latex.

[
["mywikitemplate1","MyLaTeXTemplate","paramx","3","paramy"],
["print version cover","LaTeXNullTemplate"],
["GCC_take_home","LaTeXGCCTakeTemplate","1"]
]

it contains a list of sublists. The fist item in each sublist is the name of the template in the wiki. The second is the name of the template in LaTeX. The following n elements of the sublist are the parameters in the wiki, which shall be passed to the template in LaTeX. Certainly you also have to modify templates.tex in the directory wb2pdf/trunk/document/main to add a definition for the LaTeX version of the template. When modifying templates.user be aware that each entry ends with a comma except for the last entry which does not end with a comma. Furthermore umlauts and non ansi characters have to be encoded in decimal utf8 notation this means:

"\195\156berschriftensimulation 5"


This isn't such a big problem since the Unknown Template Error message in main.tex file in directory wb2pdf/trunk/document/main will have exactly this format (decimal utf8 notation), thus you just need to copy and paste them.

If you need to have more degrees of freedom in defining how a template is processed you can also edit the source code of the template processor In order to extend the template processor of wb2pdf with you custom templates you need can also modify the function templateProcessor in the file LatexRenderer.hs an to recompile pa.exe. In order to do so you need to install the Glasgow Haskell compiler as well as its package manager (cabal). Many examples for custom templates are given in LatexRenderer.hs. Still this file is coded in the purely functional programming language Haskell, which having learned about will help you to define the processing of your custom template. LatexRenderer.hs is essentially a code generator writing code in the LaTeX typesetting language which you will also need to learn in order to extend the custom template abilities of wb2pdf.

Inputstage[Bearbeiten]

The full source of the wikipages to be compiled is downloaded to your local computer. This is done by load.py. This file is coded in the python language using the syntax of version 3.1. Since the subpages in a printversion of a wikibook are often included using a custom template it is necessary to modify load.py in order to make it load all the data you included. Many examples of the processing of custom templates are given in load.py. If you don't want to modify this file you may stick to mediawikis standard include mechanism using a double opening curly bracket followed by a colon, the wikipage you want to include and a tailing double closing curly bracket.

Other Stuff[Bearbeiten]

Other Fonts[Bearbeiten]

Currently we do full 16 Bit Unicode and chose vector font if available. If not we use GNU Unifont. We are using a combined font called megafont.ttf and you will have to modfy or replace it in order to use custom fonts. For the Linux command line version we use a default font that does not support the whole unicode range. You have to use the -f command line option and install the megafont ttf from the font.zip file you find on the sourceforge page in order to get 16 bit unicode.

Indents at the beginning of paragraphs[Bearbeiten]

You can cause the first line of each paragraph to be indented if you uncomment the line \usepackage{parskip} the file packages1.tex.