3.5 Configuration
LaTeX export can be configured with a configuration file. The configuration is read from several sources:
-
First Writer2LaTeX reads the file writer2latex.xml in the same directory as writer2latex.jar. This file is supposed to contain installation-wide configuration.
-
Then it reads the file writer2latex.xml in your home directory (unix, eg. /home/username) or user profile (windows, eg. c:\documents and settings\username). This file is supposed to contain user-specific default confguration.
-
Then the file <documentname>-config.xml in the same directory in the source document is read.
-
If you specify a configuration file on the command line, this file will replace <documentname>-config.xml.
The configuration file is an xml file, here are the default contents:
<config>
<option name="create_document_config" value="true" />
<option name="backend" value="generic" />
<option name="inputencoding" value="ascii" />
<option name="greek_math" value="true" />
<option name="use_pifont" value="false" />
<option name="use_ifsym" value="false" />
<option name="use_wasysym" value="false" />
<option name="use_bbding" value="false" />
<option name="use_hyperref" value="true" />
<option name="use_endnotes" value="false" />
<option name="use_ulem" value="false" />
<option name="use_bibtex" value="false" />
<option name="bibtex_style" value="plain" />
<option name="main_paragraph_style" value="" />
<option name="ignore_unknown_paragraph_styles" value="false" />
<option name="hard_paragraph_formatting" value="hard" />
<option name="ignore_list_label_styles" value="false" />
<option name="ignore_heading_styles" value="false" />
<option name="ignore_footnotes_configuration" value="false" />
<option name="ignore_page_formatting" value="false" />
<custom-preamble />
</config>
The meaning of each part is explained in the following sections. Writer2LaTeX comes with four sample configuration files:
-
clean.xml to produce a clean LaTeX file, ie. most of the formatting is ignored.
-
pdfscreen.xml to produce a LaTeX file which is optimized for screen viewing using the package pdfscreen.sty.
-
pdfprint.xml to produce a LaTeX file which is optimized for printing with pdfTeX.
-
article.xml to produce a LaTeX article, see below.
Basic options
-
If the option create_document_config if set to true, the document specific configuration file mentioned above will be created if it does not exist.
-
The option backend can have any of the values generic (default), dvips or pdftex. This will create LaTeX files suitable for any backend/dvi driver, dvips or pdfTeX respectively.
-
The option inputencoding can have any of the values ascii (default), latin1, iso-8859-7, cp1252, koi8-r or utf8. The latter requires Dominique Unruh's ucs.sty.
Font and symbol options
-
The option greek_math can have the values true (default) or false. This means that greek letters in latin or russian text are rendered in math mode. This behaviour assumes that greek letters are used as symbols in this context, and has the advantage that greek text fonts are not required. It is not used in greek text, where it would be awful.
-
The option use_pifont can have the values true or false (default). This enables the use of Zapf Dingbats using the LaTeX package pifont.sty.
-
The option use_wasysym can have the values true or false (default). This enables the use of the wasy symbol font using the LaTeX package wasysym.sty.
-
The option use_ifsym can have the values true or false (default). This enables the use of the ifsym symbol font using the LaTeX package ifsym.sty.
-
The option use_bbding can have the values true or false (default). This enables the use of the bbding symbol font (a clone of Zapf Dingbats) using the LaTeX package bbding.sty.
Options for other packages
-
The option use_hyperref can have the values true (default) or false. This enables use of the package hyperref.sty to include hyperlinks in the LaTeX document.
-
The option use_endnotes can have the values true or false (default). This enables use of the package endnotes.sty to include endnotes in the LaTeX document. If set to false, endnotes will be converted to footnotes.
-
The option use_ulem can have the values true or false (default). This enables use of the package ulem.sty to support underlining and crossing out in the LaTeX document.
Options for BibTeX
-
The option use_bibtex can have the values true or false (default). This enables the use of BibTeX for bibliography generation. If it is set to false, the bibliography is included as text.
-
The option bibtex_style can have any BibTeX style as value (default is plain). This is the BibTeX style to be used in the LaTeX document.
Options to control export of formatting
In Writer, formatting is controlled by styles. Per default Writer2LaTeX will convert all styles to LaTeX while preserving as much formatting as possible. You can however change this behaviour in the configuration file.
-
The option main_paragraph_style can be set to any Writer paragraph style. Writer2LaTeX usually wraps up each paragraph in a LaTeX environment, eg.
\begin{styleTextbody}
This is the text of the paragraph.
\end{styleTextbody}
but not this particular style. This will create a more normal looking LaTeX file, since ususally only special paragraphs (ie. quotations) are wrapped up in enviroments. Note that this will ignore any paragraph formatting in this style, but not character formatting.
-
The option hard_paragraph_formatting can have the values hard (default), soft and ignore. This option controls how hard paragraph formatting is handled. The default places the formatting instructions directly in the text, making it somewhat hard to read.
If you change the value to soft, Writer2LaTeX will not differentiate between hard and soft formatting; this means that several enviroments wil be created like for soft formatting. They wil usually be named something like stylePi, stylePii etc.
The value ignore instructs Writer2LaTeX to ignore any hard paragraph formatting and only use soft formatting (this affects paragraph formatting only, not hard character formatting associated with the paragraph).
-
The option ignore_unknown_paragraph_styles can have the values true or false (default). Setting the option to true will instruct Writer2LaTeX to ignore any paragraph styles that does not have a style-map in the configuration file, see below.
-
The option ignore_list_label_styles can have the values true or false (default). Setting the option to true will instruct Writer2LaTeX to ignore the character formatting used in list labels (including outline numbering), so that labels will be formatted like the surrounding text.
-
The option ignore_heading_styles can have the values true or false (default). Setting the option to true will instruct Writer2LaTeX to ignore the formatting for headings, so that LaTeX's defaults will be used.
-
The option ignore_footnotes_configuration can have the values true or false (default). Setting the option to true will instruct Writer2LaTeX to ignore the formatting for footnotes and endnotes (this is what you define with Tools – Footnotes), so that LaTeX's defaults will be used.
-
The option ignore_page_formatting can have the values true or false (default). Setting the option to true will instruct Writer2LaTeX to ignore page formatting. This is not recommended.
Style maps
In addition you can specify maps from styles in Writer to your own LaTeX styles in the configuration. Currently this is possible for text styles, paragraph styles and list styles. For example the following confguration files overrides the text style Emphasis and the paragraph style Quotations as well as the list style theorem.
<?xml version="1.0" encoding="UTF-8"?>
<config>
<style-map name="Emphasis" class="text" before="\emph{" after="}" />
<style-map name="Quotations" class="paragraph" before="\begin{quotation}" after="\end{quotation}" />
<style-map name="theorem" class="list" before="" after="" />
<style-map name="theorem" class="listitem" before="\begin{theorem}" after="\end{theorem}" />
</config>
Note that there are two entries for a list style: The first one to specify the LaTeX code to put before and after the entire list. The second one to specify the LaTeX code to put before and after each list item. The example shows how to create theorem environments from a list in Writer.
When you override a style, all formatting specified in the original document will be igored.
Math symbols
In OOo Math you can add user-defined symbols. Writer2LaTeX already understands the predefined symbols such as %alpha. If you define your own symbols, you can add an entry in the confguration that specifies LaTeX code to use. The math-symbol-map element is used for this:
<math-symbol-map name=”ddarrow” latex=”\Downarrow” />
This example will map the symbol %ddarrow to the LaTeX code \Downarrow.
Custom preamble
The text you specify in the element custom-preamble will be copied verbatim into the LaTeX preamble. For example:
<custom-preamble>\usepackage{palatino}</custom-preamble>
to typeset your document using the postscript font palatino.