Home

Contents

1 Introduction

2 Using the export filters

3 Using the command line utility

4 Configuration

4.1 Writer2LaTeX configuration

4.2 Writer2xhtml and Calc2xhtml configuration

4.3 Using LibreOffice to create XHTML documents

5 Special features for the EPUB export

6 The LaTeX package ooomath.sty

7 Using Writer2LaTeX from another application

8 Troubleshooting

    

4 Configuration

4.1 Writer2LaTeX configuration

LaTeX export can be configured with a configuration file. The location of the configuration depends on how you use Writer2LaTeX: Please see the sections on the export filter and the command line application.

The configuration is a file in xml format. Here is a sample configuration file for producing a document of class book, converting only basic formatting and optimizing for pdfTeX.

<?xml version="1.0" encoding="UTF-8" ?>

<config>

  <option name="backend" value="pdftex" />

  <option name="documentclass" value="book" />

  <option name="inputencoding" value="latin1" />

  <option name="use_pifont" value="false" />

  <option name="use_bibtex" value="false" />

  <option name="bibtex_style" value="plain" />

  <option name="formatting" value="convert_basic" />

  <option name="page_formatting" value="convert_all" />

  <heading-map max-level="4">

    <heading-level-map writer-level="1" name="chapter" level="0" />

    <heading-level-map writer-level="2" name="section" level="1" />

    <heading-level-map writer-level="3" name="subsection"

      level="2" />

    <heading-level-map writer-level="4" name="subsubsection"

      level="3" />

  </heading-map>

  <custom-preamble />

  <style-map name="Quotations" family="paragraph"

    before="\begin{quote}" after=\end{quote} />

  <string-replace input="LaTeX" latex-code="{\LaTeX}" />

</config>

Writer2LaTeX comes with five standard configuration files:

In addition, you can find a sample configuration file suitable for documents originating from Google Docs in the directry samples/config.

The following subsections explains the available options. The options written in italics can be set using the dialog if you use Writer2LaTeX as an export filter.

General options

These options are used to control general aspects of the generated LaTeX document.

documentclass

This options defines the name of the LaTeX documentclass to use (default is article).

global_options

This option is a list of global options to add to the documentclass (the default value is an empty string).

backend

This option can have any of the values generic, dvips, pdftex (default), xetex and unspecified. This will create LaTeX files suitable for any backend/dvi driver, dvips, pdfTeX or XeTeX respectively. The last value does not assume any specific backend. This value of the option affects export of graphics: Only file types than can be handled by the backend are included. If you use the filter, other graphics will be converted to a suitable format. If you use the command line application, other types will be commented out. If you use unspecified, no graphics will be commented out, nor converted.

inputencoding

The option inputencoding can have any of the values ascii (default), latin1, latin2, iso-8859-7, cp1250, cp1251, koi8-r or utf8. This option has no effect if the backend is XeTeX, in this case the encoding is always utf-8.

multilingual

If this option is set to true (default), Writer2LaTeX will export all language information in the document. If backend is xetex, the package polyglossia.sty will be used, otherwise the package babel.sty.

If the option is set to false, Writer2LaTeX will assume that the document is written in one language only. If backend is xetex, no language information will be exported, otherwise the language used for the majority of the text in the document will be exported using babel.sty.

greek_math

This option can have the values true (default) or false. This means that greek letters in latin or cyrillic 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 look awful. This option has no effect if the backend is set to xetex.

use_pifont

Setting this option to true enables the use of Zapf Dingbats using the LaTeX package pifont.sty. Default is false.  This option and the following five font options has no effect if the backend is XeTeX.

use_ifsym

Setting this option to true enables the use of the ifsym symbol font using the LaTeX package ifsym.sty. Default is false.

use_wasysym

Setting this option to true enables the use of the wasy symbol font using the LaTeX package wasysym.sty. Default is false.

use_bbding

Setting this option to true enables the use of the bbding symbol font (a clone of Zapf Dingbats) using the LaTeX package bbding.sty. Default is false.

use_eurosym

Setting this option to true enables the use of  the eurosym font using the LaTeX package eurosym.sty. Default is false.

use_tipa

Setting this option to true enables the use of phonetic symbols using the LaTeX packages tipa.sty and tipx.sty. Default is false.

use_ooomath

This option can  have the values true or false (default). This enables the use of the LaTeX package ooomath.sty (see section 6). This package defines  number of LaTeX macros used to convert formulas from LO to LaTeX. If this package is not used, the necessary definitions will be included in the LaTeX preamble, which may become quite long – so using ooomath.sty is recommended for documents with formulas.

use_lastpage

This option can have the values true or false (default). This enables use of the package lastpage.sty to represent the page count.

Options for bibliography (BibTeX)

These options controls the handling of the bibliography.

use_bibtex

Setting this option to true enables the use of BibTeX for bibliography generation. If it is set to false (default), the bibliography is included as static text.

bibtex_style

This option can have any BibTeX style as value (default is plain). This is the BibTeX style to be used in the LaTeX document.

use_natbib

Setting this option to true loads the LaTeX package natbib.sty.

natbib_options

Use this option to provide options to natbib.sty.

external_bibtex_files

Use this option to give a list of external BibTeX files. If the list is non-empty, bibliographic references in the document will be interpreted as keys in these files. If it is empty (default), the bibliographic references will be exported to a BibTeX file (provided use_bibtex is set to true).

zotero_bibtex_files

Use this option to give a list of external BibTeX files. If the list is non-empty and use_bibtex is set to true, Zotero references in the document will be interpreted as keys in these files. Also the Zotero bibliography, if any, will be exported as a LaTeX bibliography. This will take advantage of the LaTeX package natbib.sty. If use_natbib is set to true.
Otherwise (default), Zotero references and bibliography will be exported as text.

jabref_bibtex_files

Use this option to give a list of external BibTeX files. If the list is non-empty and use_bibtex is set to true, JabRef references in the document will be interpreted as keys in these files. Also the JabRef bibliography, if any, will be exported as a LaTeX bibliography. This will take advantage of the LaTeX package natbib.sty. If use_natbib is set to true.
Otherwise (default), JabRef references and bibliography will be exported as text.

include_original_citations

If you convert Zotero or JabRef references, you can set this option to true (default is false) to include the original citation inserted by Zotero/JabRef as a comment in the LaTeX source.

File options

These options controls the creation of files associated with the main LaTeX document.

wrap_lines_after

The option specifies that Writer2LaTeX should try to break lines in the LaTeX source as soon as possible after this number of characters. Default is 72. If you use a text editor which supports wrapping of long lines, you may want to set this option to 0: In this case Writer2LaTeX will not wrap lines.

split_linked_sections

This option specifies that a linked section should be exported to a separate LaTeX-file. Default is false.

split_toplevel_sections

This option specifies that all sections should be exported to a separate LaTeX-file, excluding nested sections. Default is false.

save_images_in_subdir

Images contained in the document are normally placed in the same directory as the LaTeX document. If the document contains a large number of images, it may be more convenient to put the images in a subdirectory. Set this option to true to do this.

Options for special content

notes

This option can have any of the values comment (default), ignore, marginpar, pdfannotation. This specifies what to do with notes (annotations) in the document: They can be ignored, converted to LaTeX comments, converted to \marginpar or converted to pdf annotations (which will default to \marginpar if the document is not processed with pdfLaTeX).

In addition, you can give any LaTeX command (inluding the backslash), and the notes will be exported as \yourcommand{the note}.

metadata

If you set his option to true (default), Writer2LaTeX will export the title, author and date of the document as found under File – Properties. Furthermore, if you have chosen pdf as the backend, the title, author, subject and keywords will be exported to the pdf document and will be viewable if the pdf viewer supports it. If the option is false , only the title will be exported.

Figure and table options

The first options are used to control the handling og floating or non-floating figures and tables.

float_figures

Use this option to specify that you want to include graphics and text boxes in a floating figure environment. Default is false.

This option has no effect on graphics and text boxes that are anchored as character. These are always considered to be part of the normal text flow. If you want a figure to float, anchor it to paragraph or to character.

float_tables

Use this option to specify that you want to include tables in a floating table environment. Default is false.

float_options

Use this to give placement options to the figure and table floats, eg. h for here. Default is empty (default placement).

align_frames

Use this option to specify, that all graphics and text boxes should be centered. If you don't want that, set this option to false. Default is true.

use_caption

Use this option if you want to take advantage of the LaTeX package caption.sty. Currently Writer2LaTeX only uses the support for non-floating captions from this package.

figure_sequence_name

This option can be set to a sequence name in the source document. OpenDocument has a very weak sense of figure captions: A figure caption is a paragraph containing a sequence number. If you use LO's defaults, Writer2LaTeX can guess which sequence name to use. If it fails, you can give the name in this option (default is empty).

table_sequence_name

This is a similar option for tables.

These options controls the export of tables:

simple_table_limit

You can set this option to any non-negative integer (default is 0). Table cells in LO can contain any number of paragraphs, so normally Writer2LaTeX exports tables with p columns. For simple tables where all cells only contains a single line it is better to use l, c and r columns. If all cells in a table contains at most one paragraph, and the total width of the table is less than this number of characters, the table will be exported with l, c and r columns. This option has no effect on tables using tabulary.

use_longtable

This option is used to specify that longtable.sty should be used to export tables which may break across pages. Default is false.

use_supertabular

This option is used to specify that supertabular.sty should be used to export tables which may break across pages. Default is true. (You should only set one of the options use_longtable and use_supertabular to true).

use_tabulary

This option is used to specify that tabulary.sty should be used to export tables. Default is false.

use_colortbl

This option is used, if you want to apply background color to tables using the package colortbl.sty. The value can be true or false (default). This option has no effect unless you also set the option use_color to true.

table_first_head_style

This option is used to produce advanced tables, that are not supported in Writer. You can set this option to the name of a paragraph style. If the first paragraph of the first cell in a row is formatted with this paragraph style, the row in question will be used for the first head in a multipage table.

table_head_style

Likewise this option specifies a paragraph style that identifies a repeating head in a multipage table (like a normal table head in Writer).

table_foot_style

This option specifies a paragraph style that identifies a repeating foot in a multipage table.

table_last_foot_style

This option specifies a paragraph style that identifies the last foot in a multipage table.

These options controls the export of figures:

original_image_size

Often images in a Writer document are scaled up or down from their original size. Normally the same scaling will be used in the LaTeX document, but if you set this option3 to true, the original (unscaled) image size will be used. The default value is false.

remove_graphics_extension

This option can be used to specify, that the file extension on graphics files should be removed. You will thus get eg. \includegraphics{myimage} rather than \includegraphics{myimage.png}.

image_options

This option can be used to specify some options that should be applied to all images (ie. all \includegraphics commands). For example "width=\linewidth". Default is empty (no options).

AutoCorrect options

ignore_hard_page_breaks

This option can have the values true or false (default).  Setting the option to true will instruct Writer2LaTeX to ignore hard page breaks (but not soft page breaks specified in paragraph styles).

ignore_hard_line_breaks

This option can have the values true or false (default). Setting the option to true will instruct Writer2LaTeX to ignore hard line breaks (shift-Enter).

ignore_empty_paragraphs

This option can have the values true (default) or false. Setting the option to true will instruct Writer2LaTeX to ignore empty paragraphs; otherwise they are converted to a \bigskip.

ignore_double_spaces

This option can have the values true (default) or false. Setting the option to true will instruct Writer2LaTeX to ignore double spaces, otherwise they are converted to .

Formatting options

In Writer, formatting is controlled by styles. You can control how much formatting is exported using the following options. Note that these options has a major impact on the structure of the LaTeX document created.

formatting

The option formatting can have any of these values:

  • ignore_all will instruct Writer2LaTeX to ignore all character, paragraph, heading, list and footnote formatting contained in the document.

  • ignore_most will preserve basic character formatting.

  • convert_basic (default) will preserve basic character formatting, paragraph justification and all numberings (lists, headings, footnotes).

  • convert_most will convert all supported formatting, except that paragraph formatting and font size is only converted if it is set by a style. To be able to preserve formatting, an environment is created for all paragraph styles, custom lists are used for listings, headings are reformatted using the \@startsection command etc.

  • convert_all will preserve all supported formatting.

page_formatting

This option can have any of the values

ignore_all, convert_header_footer, convert_all

This will ignore all page formatting, convert the header and footer (using custom page styles) or convert all supported formatting, including page geometry and footnote rule.

use_geometry

Setting this option to true specifies that the package geometry.sty should be used to export the geometry of the page (page size, margins etc.). Default is false, which will export the geometry using the low level LaTeX commands.

use_fancyhdr

Setting this option to true specifies that the package fancyhdr.sty should be used to export the header and footer of the page. Default is false, which will export the header and footer using the low level LaTeX page style commands.

use_color

This option can have the values true (default) or false. This enables use of the package color.sty to apply color in the LaTeX document.

use_ulem

This option 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.

use_hyperref

This option can have the values true (default) or false. This enables use of the package hyperref.sty to include hyperlinks in the LaTeX document.

tabstop

This option is used to specify what to do with tabulator stops in the document. Normally these are converted to spaces, but with this option you can specify any LaTeX code, that should be used instead. For example "\quad{}" or "\hspace{2em}"

use_endnotes

This option can have the values true or false (default). This enables use of the package endnotes.sty to format the endnotes in the LaTeX document. If set to false, endnotes will be converted to footnotes.

Options for including or excluding content

The following options can be used to control which content to export.

no_preamble

If this option is set to true, (default is false), Writer2LaTeX will not create the a LaTeX preamble, nor include \begin{document} and \end{document}. This is useful if the document is to be included in another LaTeX document. Note that in this case you will have to make sure that all packages/definitions needed are available in the master LaTeX document.

no_index

If this option is set to true, (default is false), Writer2LaTeX will not export indexes (e.g. table of contents, bibliopgrahy). This option is also intended for the case that the document is to be part of a larger LaTeX document, which may contain global indexes.

other_styles

This option can all have the values accept (default), ignore, warning and error. This controls how to export paragraph and text content, for which there is no style map (see below).

If the value of this option is accept, the content is handled as normal. If the value is ignore, the content is ignored silently. The values warning and error issues a message on the terminal resp. in the generated LaTeX code. This option thus lets you control that only content with accepted styles is exported.

image_content

This option has the same values, and is used to exclude image content.

table_content

This option also has the same values and is used to exclude table content.

display_hidden_text

If this option is set to true (default is false), paragraphs and text portions marked as hidden will be exported. Otherwise they will be ignored.

Headings

The heading_map section specifies how headings in LO should map to LaTeX. Eg. the first line in the sample above specifies that the toplevel heading (Heading 1) should map to \chapter, which is of level 0 in LaTeX. Up to 10 levels are supported (the same number as in LO).

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. In addition a few direct formatting attributes can be mapped to LaTeX code. The following examples are from the standard configuration file article.xml.

This is a simple rule, that maps text formatted with the text style Emphasis to the LaTeX code \emph{...}:

<style-map name="Emphasis" family="text" before="\emph{" after="}" />

This is another simple rule, that maps paragraphs formatted with the paragraph style part to the LaTeX code \part{...}. The attribute line-break ensures that no line breaks are inserted between the code and the text.

<style-map name="part" family="paragraph" before="\part{" after="}" line-break="false" />

This is a rule, that maps paragraphs formatted with style Preformatted Text to the LaTeX environment verbatim. The attribute verbatim ensures that the content of the paragraph is exported verbatim (this implies that characters not available in the inputenc are converted to question marks and that other content is discarded, eg. footnotes). The paragraph-block entry specifies code to go before and after an entire block of paragraphs. The name attribute specifies the style of the first paragraph; the next attribute specifies the style(s) of subsequent paragraphs in the block.

  <style-map name="Preformatted Text" family="paragraph-block" next="Preformatted Text" before="\begin{verbatim}" after="\end{verbatim}" />

<style-map name="Preformatted Text" family="paragraph" before="" after="" verbatim="true" />

This is a more elaborate set of rules, that maps paragraphs formatted with styles Title, author and date (in any order) to \maketitle in LaTeX.

<style-map name="Title" family="paragraph" before="\title{" after="}" line-break="false" />
 <style-map name="author" family="paragraph" before="\author{" after="}" line-break="false" />
 <style-map name="date" family="paragraph" before="\date{" after="}" line-break="false" />
 <style-map name="Title" family="paragraph-block" next="author;date" before="" after="\maketitle" />
 <style-map name="author" family="paragraph-block" next="Title;date" before="" after="\maketitle" />
 <style-map name="date" family="paragraph-block" next="Title;author" before="" after="\maketitle" />

This will produce code like this:

\title{Configuration}

\author{Henrik Just}

\date{2006}

\maketitle

The next example maps a paragraph formatted with the theorem list style to a LaTeX environment named theorem. 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.

<style-map name="theorem" family="paragraph" before="" after="" />
<style-map name="theorem" family="list" before="" after="" />
<style-map name="theorem" family="listitem" before="\begin{theorem}" after="\end{theorem}" />

When you override a style, all formatting specified in the original document will be igored.

Finally an example using direct formatting attributes:

<style-map name="italic" family="text-attribute" before="\emph{" after="}" />

Currently the only supported names are italic, bold, small-caps, superscript and subscript.

String replace

Often LaTeX requires special care to typeset certain constructions. For example according to German typographical rules, an abbreviation like z.B. should be typeset with a small space before the B. You can specify this in the configuration:

<string-replace input="z.B." latex-code="z.\,B." />

The input is the text in the LO document, the latex-code is the LaTeX code to export for this text.

Another example is French quotations marks (« Je parle français ») which should be converted to the LaTeX macros \fg and \og. This can be achieved using this rule:

<string-replace input="&#xAB;&#xA0;" latex-code="\fg " />

<string-replace input="&#xA0;&#xBB;" latex-code="\og " />

The final example ensures that the LaTeX logo is typeset correctly

<string-replace input="LaTeX" latex-code="{\LaTeX}" />

Math symbols

In LO 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 configuration 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.


3 In previous versions, this option was called keep_image_size, but has been renamed to avoid confusion (the old name is still supported).