You are on page 1of 44

User's manual for

Writer2LaTeX, Writer2BibTeX, Writer2xhtml and Calc2xhtml


version 1.2 beta test release 2!!2"2!12 #enri$ %ust

Page 2

User's manual for Writer2LaTeX

Table of Contents
1 Introduction.......................................................................................................3 1.1 What is Writer2LaTeX?................................................................................3 1.2 More a out Writer2LaTeX and Writer2!i TeX..............................................3 1.3 More a out Writer2"html and #alc2"html....................................................$ 2 Using the e"%ort filters.......................................................................................& 2.1 Installing of the filters..................................................................................& 2.2 Using the filters............................................................................................& 2.3 Using Writer2LaTeX and Writer2!i TeX.......................................................& 2.$ Using Writer2"html.....................................................................................' 2.& Using #alc2"html.........................................................................................( 2.' #ustom configuration...................................................................................( 2.( #onfiguration %ac)ages................................................................................( 3 Using the command line utilit*..........................................................................11 3.1 +o, to install Writer2LaTeX for command line usage.................................11 3.2 Using the command line utilit*...................................................................12 $ #onfiguration...................................................................................................1$ $.1 Writer2LaTeX configuration.......................................................................1$ $.2 Writer2"html and #alc2"html configuration...............................................2$ $.3 Using -%en-ffice.org to create X+TML documents......................................33 & .%ecial features for the /PU! e"%ort.................................................................3& &.1 User defined meta data...............................................................................3& ' The LaTeX %ac)age ooomath.st*........................................................................3( ( Using Writer2LaTeX from another a%%lication...................................................30 (.1 Using Writer2LaTeX from a 1a2a a%%lication...............................................30 (.2 Using Writer2LaTeX from a !asic macro.....................................................33 (.3 !atch con2ersion ,ith U4-........................................................................$5 (.$ #on2erting from .tarMath ,ith a !asic macro............................................$1 0 Trou leshooting...............................................................................................$3

1 Introduction

Page 3

1 Introduction
1.1 What is Writer2LaTeX?
Writer2LaTeX is a utilit* to con2ert OpenDocument te"t and s%readsheet documents1 6 in %articular documents containing formulas 6 into other formats. 7ctuall* it is a collection of four con2erters8

Writer2LaTeX con2erts -%en9ocument te"t documents to LaTeX 2e: and ,or)s together ,ith... Writer2BibTeX ,hich e"tracts i liogra%hic data from an -%en9ocument te"t document and con2erts it to !i TeX format. Writer2xhtml con2erts -%en9ocument te"t documents to X+TML 1.5 strict: X+TML 1.1: X+TML 1.1 ; MathML 2.5 or /PU! using #..2 to con2ert st*le information. Calc2xhtml con2erts -%en9ocument s%readsheet documents to X+TML 1.5 strict or X+TML 1.1: using #..2to con2ert st*le information.

7lthough Writer2LaTeX is a general -%en9ocument con2erter: it is %rimaril* designed for use ,ith -%en-ffice.org and it's deri2ati2es <e.g. .tar-ffice or 4eo-ffice=. >ou can use Writer2LaTeX

...as an export filter for -%en-ffice.org 3.5 or later2: or e?ui2alent 2ersions of .tar-ffice or 4eo-ffice3. ...as a command line utility: inde%endent of -%en-ffice.org. ...as a Java library %ro2iding con2ersions from -%en9ocument for other 1a2a %rograms.

Writer2LaTeX is a 1a2a a%%lication: and thus should ,or) on an* %latform that su%%orts 1a2a. >ou need .un's 1a2a 2 @irtual Machine <Auntime /n2ironment=: version 5 or later. >ou can do,nload this from http://java.sun.com/getjava/download.html. Writer2LaTeX has not een tested ,ith other Ba2a im%lementations. This user's manual ,ill e"%lain ho, to install and use Writer2LaTeX. Note8 In this manual --o is used as an a re2iation of -%en-ffice.org.

1.2 More about Writer2LaTeX and Writer2BibTeX


Writer2LaTeX is ?uite fle"i le8 It can ta)e ad2antage of se2eral LaTeX %ac)ages: such as hyperref: pifont: ulem. It can create customiCed LaTeX code ased on the st*les and te"t in the document. 7lso it su%%orts more than 2& different languages: latin: gree) and c*rillic scri%ts and 0 in%utDencodings. The fle"i ilit* ma)es it %ossi le to use Writer2LaTeX from se2eral %hiloso%hies8
1 In addition: Writer2LaTeX su%%orts the old file formats for -%en-ffice.org 1." Writer and #alc. 2 Eor -%en-ffice.org 2.2D2.$: *ou can use Writer2LaTeX 1.5.1: for -%en-ffice.org 2.5.$62.1: *ou can use Writer2LaTeX 5.&.5.2. 3 Unfortunatel* these 2ariants does not use the same 2ersion num ers. Eor .tar-ffice *ou should use .tar-ffice 0: Product U%date ' or later. Eor 4eo-ffice I don't )no, ho, the 2ersion num ering relates to that of -%en-ffice.org.

Page $

User's manual for Writer2LaTeX >ou can use LaTeX as a t*%esetting engine for *our --o documents8 Writer2LaTeX can e configured to create a LaTeX document ,ith as much formatting as %ossi le %reser2ed. 4ote that the resulting LaTeX source ,ill e reada le: ut not 2er* clean. !e a,are that e2en though Writer2LaTeX tries hard to co%e ,ith an* document: *ou ,ill onl* get good results for ,ell structured documents: ie. documents that are formatted using styles. Eor other documents *ou ,ill find that Writer2LaTeX uses the %rinci%le garbage in garbage outF

If *ou need to continue the ,or) on *our document in LaTeX *our %rimar* interest ma* e the content rather than the formatting. Writer2LaTeX can instructed to %roduce a LaTeX document ,hich stri%s most of the formatting and hence %roduces a clean LaTeX source from any source document. Traditionall*: LaTeX documents are ,ritten * hand using a te"t editor. Using a gra%hical frontend li)e L*X %ro2ides a more user friendl* alternati2e. 7 com%anion e"tension named Writer4LaTeX is in a2aila le and %ro2ides the tools to ma)e *ou use --o as a gra%hical frontend for LaTeX.

1.3 More about Writer2xhtml and Calc2xhtml


The %rimar* goal for Writer2"html and #alc2"html is to %ro2ide standards compliant X+TML documents ,hich can e customiCed to *our s%ecific needs.

.tandards com%liance is necessar* to ensure consistent results ,hen the document is 2ie,ed in different ro,sers. It is also 2ital to ensure that the created document can e %rocessed further * other tools. #ustomiCation means that *ou can control im%ortant as%ects a out the con2ersion. In %articular *ou can control the st*le of the document8

>ou can let Writer2"html con2ert the st*le information in the source document and thus get an X+TML document that has the same general a%%earance as the original: ut is ada%ted to an online en2ironment. >ou can create a document that ada%ts the st*le of the document to *our o,n #..st*le sheet.

2 Using the e"%ort filters

Page &

sin! the ex"ort filters

2.1 Installin! of the filters


Writer2LaTeX can ,or) as an e"%ort filter for --o Writer. This re?uires -%en-ffice.org 3.5 or later: or e?ui2alent 2ersions of .tar-ffice or 4eo-ffice. T,o --o e"tensions are %ro2ided8

writer2latex.oxt installs the LaTeX and !i TeX e"%ort filters in Writer writer2xhtml.oxt installs the X+TML and /PU! e"%ort filters in Writer and #alc

The t,o e"tensions are inde%endent: *ou can install one or oth de%ending on *our needs. Note8 Erom --o 2.5.$ until 3.5: Writer2LaTeX 2ersion 5.$ is installed * default <LaTeX and !i TeX e"%ort onl*=. If *ou install 2ersion 1.2: the uiltDin 2ersion ,ill e hidden <to a2oid confusion=. If *ou uninstall 2ersion 1.2: the original 2ersion ,ill rea%%ear. lso note8 !efore *ou install the Writer2LaTeX e"tensions: *ou need to set u% --o to use 1a2a. >ou can configure this in --o under Tools Options. -f course this re?uires that *ou ha2e installed a 1a2a runtime en2ironment on *our s*stem. !mportant8 If *ou ha2e installed Writer2LaTeX 5.&: *ou must uninstall this 2ersion first. <This is not necessar* if *ou ha2e installed Writer2LaTeX 5.&.5.2.= The e"tensions are installed and uninstalled using the /"tension Manager in --o. If *ou need instructions a out using the /"tension Manager: see htt%8GGe"tensions.ser2ices.o%enoffice.orgGresourcesGuserGho,toHinstall In case of installation trou les: %lease see the E7I on Writer2LaTeXs ,e %age8 htt%8GG,riter2late".sourceforge.net.

2.2

sin! the filters

The filters %ro2ided * Writer2LaTeX are all export filters. This means that the filters are to e found in the File Export menu in Writer or #alc. ote! 7s Writer2LaTeX does not %ro2ide corres%onding import filters: *ou should al,a*s sa2e in -%en9ocument format as ,ellF

2.3

sin! Writer2LaTeX and Writer2BibTeX

To e"%ort a Writer document to LaTeX: choose LaTeX 2e in the e"%ort dialog. 7fter *ou ha2e t*%ed in a file name: an o%tions dialog ,ill o%en. To get hel%: select an item and %ress F" or %ress the hel% utton. 7lternati2el* *ou can ena le e"tended ti%s ,ith #hi$t%F". #lic) Export to initiate the e"%ort or Cancel to close the dialog ,ithout e"%orting the document. 4ormall* *ou ,ould e"%ort the i liogra%hic data to !i TeX as %art of the e"%ort to LaTeX: ut *ou ma* also e"%ort the i liogra%hic data alone. To do this: choose BibTeX in the e"%ort dialog. 7ll i liogra%hic data in the document ,ill e e"tracted and stored in a !i TeX file ,hich can later e used * e.g. LaTeX documents.

Page '

User's manual for Writer2LaTeX

2.#

sin! Writer2xhtml

To e"%ort a Writer document to X+TML: choose one of the follo,ing formats in the e"%ort dialog8

X&T'L ".( strict ,ill create an X+TML file ,hich is com%ati le ,ith the older +TML $ standard. >ou can thus e"%ect that the result ,ill e 2ie,a le ,ith an* <modern= ro,ser: ut note that mathematical formulas are not su%%orted. X&T'L "." ,ill create an X+TML file using the X+TML 1.1 standard: ut ,ithout su%%ort for mathematical formulas. X&T'L "." )'ath'L 2.( ,ill create an X+TML file ,hich follo,s the standard for com ining X+TML ,ith mathematical formulas: using "at#"L for the formulas. Unfortunatel*: not all ro,sers su%%ort this. X&T'L "." ) 'ath'L 2.( *xsl+ ,ill create a similar X+TML file: ut using some X.LDtransformations %ro2ided * the World Wide We #onsortium <W3#=: the result ,ill e 2ie,a le * a ,ider range of ro,sers: such as Internet /"%lorer ,ith the MathPla*er %lugin. .ee htt%8GG,,,.,3.orgGMathGX.LG for details. This is ho, W3#'s Math Wor)ing Jrou% recommends to %ut Kmath on the ,e K. E,-B,ill create an electronic eD oo) suita le for 2ie,ing on 2ariet* of de2ices.

In all cases: Writer2"html uses #.. to format the document: either * con2erting the original formatting to #..or * using a #..st*le sheet selected * the user. 4ote that the default file e"tension and the recommended MIM/ t*%es 2aries ,ith the out%ut format8 Output format X+TML 1.5 X+TML 1.1 X+TML 1.1 ;MathML 2.5 Default file extenstion .html .xhtml .xhtml MIMEtype text/html application/xhtml+xml application/xhtml+xml application/xml application/epub+zip

X+TML 1.1 ; MathML 2.5 .xml <,ith "sl transformation= /PU! .epub

7fter *ou ha2e t*%ed in a file name: an o%tions dialog ,ill o%en. To get hel%: select an item and %ress F" or %ress the hel% utton. 7lternati2el* *ou can ena le e"tended ti%s ,ith #hi$t%F". #lic) Export to initiate the e"%ort or Cancel to close the dialog ,ithout e"%orting the document.

2.$

sin! Calc2xhtml

To e"%ort a #alc document to X+TML: choose X&T'L ".( strict or X&T'L "." in the e"%ort dialog. 7fter *ou ha2e t*%ed in a file name: an o%tions dialog ,ill o%en. To get hel%: select an item and %ress F" or %ress the hel% utton. 7lternati2el* *ou can ena le e"tended ti%s ,ith

2 Using the e"%ort filters #hi$t%F".

Page (

#lic) Export to initiate the e"%ort or Cancel to close the dialog ,ithout e"%orting the document.

2.% Custom confi!uration


/ach of the e"%orts %ro2ides the %ossi ilit* to use a custom formatGst*le. To edit this: choose Tools Options Writer2LaTeX res%. Writer2xhtml. 7ll three e"%orters uses a configuration file in the user installation folder for --o.

-n uni"Dli)e s*stems this folder ,ill usuall* e something li)e home directory/.OpenOffice.org2/user or home directory/.OpenOffice.org/3/user

-n Windo,s it ,ill usuall* e something li)e C:\Documents and Settings\username\OpenOffice.org2\user or C:\Documents and Settings\username\OpenOffice.org\3\user <4ote that this director* ma* e hidden.=

Writer2LaTeX uses a file named writer2latex.xml: and Writer2"html and #alc2"html shares a file named writer2xhtml.xml. These files are created automaticall* the first time *ou use the custom configuration. .ee section $ for the structure of the configuration file.

2.& Confi!uration "ac'a!es


7d2anced users ma* add further formatsGst*les to the lists in the e"%ort dialog. This is done using configuration pac$ages: ,hich are custom e"tensions to --o containing further configurations for Writer2LaTeX or Writer2"html. 7 configuration %ac)age can contain8

7 configuration file for Writer2LaTeX or Writer2"html: see section $. 7n X+TML tem%late <Writer2"html onl*=. 7n --o tem%late. 7n --o registr* file to glue the %arts together.

The Writer2LaTeX distri ution contains a sam%le configuration %ac)age xhtml%con$i.% sample.oxt that demonstrates this. 7s a demonstration of the %rinci%les of configuration %ac)ages: *ou can install this into --o using the /"tension Manager8

If *ou e"%ort to X+TML: the dialog ,ill sho, an additional entr* #ample c/stom st0le in the .t*le list. If *ou o%en Templates an1 2oc/ments in --o *ou ,ill find a ne, folder xhtml% sample%con$i.. This folder contains a Writer tem%late. If *ou create a document ased on this tem%late: #ample c/stom st0le ,ill e %reselected ,hen *ou e"%ort

Page 0 to X+TML.

User's manual for Writer2LaTeX

>ou can create *our o,n configuration %ac)age ased on this sam%le. Use a Ci% utilit* to un%ac) the e"tension. The follo,ing e"%lains the indi2idual %arts of the sam%le configuration %ac)age.

The file descri"tion.xml


This files identifies the e"tension in --o. Eor *our o,n configuration %ac)age *ou should choose a uni?ue name for the identifier and a 2ersion num er: eg. <?xml version="1.0" encoding="UTF-8"?> <description xmlns="http://openoffice.org/extensions/description/2006" xmlns:d="http://openoffice.org/extensions/description/2006"> <identifier value="MyConfigPackage" /> <version value="1.0" /> </description>

The files M(T)*I+,-manifest.xml and .aths.xcu


These files should e left unchanged.

The folder tem"late


Put *our --o Writer tem%late in this folder <it is recommended to use a su folder ,ith a descri%ti2e name=. >ou ma* add more that one tem%lates: and if *ou don't ,ant to include a Writer tem%late *ou ma* lea2e it em%t* <do not delete the folder=.

The folder confi!


Put *our Writer2LaTeXGWriter2"html configuration in this folder. If *ou are using Writer2"html: *ou should also %ut *our X+TML tem%late here.

The file /"tions.xcu


This is the central configuration file that glues together the content of the configuration %ac)age. .ee the follo,ing e"am%le for an e"%lanation of the structure. <?xml version='1.0' encoding='UTF-8'?> <oor:component-data oor:name="Options" Eor LaTeX: Writer2"html should e re%laced * Writer2LaTeX here8 oor:package="org.openoffice.da.Writer2xhtml" xml:lang="en-US" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema"> Xhtml-%tions ma* e re%laced * Xhtml-%tions#alc or LaTeX-%tions8 <node oor:name="XhtmlOptions"> <node oor:name="Configurations"> The configuration needs a uni?ue name <*ou ma* define se2eral configurations in the same %ac)age=8 <node oor:name="myconfig1" oor:op="replace"> >ou can define o%tions ,hich are normall* set in the filter dialog. In that case *ou can loc)

2 Using the e"%ort filters

Page 3

<disa le= the corres%onding %arts of the dialogs. To do so: add a comma se%arated list of o%tions as 2alue here. .ee elo, for the o%tions that can e loc)ed for each of the three filters. <prop oor:name="LockedOptions" oor:type="xs:string"> <value></value> </prop> The 9is%la*4ame is the name dis%la*ed in the st*leGformat list in the filter dialog. <prop oor:name="DisplayName" oor:type="xs:string" oor:localized="true"> <value>My Config Package</value> </prop> This %ath %oints to the configuration ,ithin the e"tension: *ou ,ant to use8 <prop oor:name="ConfigURL" oor:type="xs:string"> <value>%origin%/config/myconfig.xml</value> </prop> This %ro%ert* <X+TML onl*= %oints to the X+TML tem%late ,ithin the e"tension: *ou ,ant to use8 <prop oor:name="TargetTemplateURL" oor:type="xs:string"> <value>%origin%/config/mytemplate.xhtml</value> </prop> This %ro%ert* <X+TML onl*= %oints to st*le sheet ,ithin the e"tension: *ou ,ant to include <for /PU! e"%ort=8 <prop oor:name="StyleSheetURL" oor:type="xs:string"> <value>%origin%/config/mytemplate.xhtml</value> </prop> </node> </node> The ne"t section defines the --o tem%late *ou ,ish to connect ,ith *our configuration8 <node oor:name="Templates"> The entr* needs a uni?ue name8 <node oor:name="mytemplate1" oor:op="replace"> <prop oor:name="TemplateName" oor:type="xs:string"> The name of the --o tem%late is defined here <lea2e out .odt=. <value>MyWriterTemplate</value> </prop> <prop oor:name="ConfigName" oor:type="xs:string"> The configuration to lin) to is defined here. <value>myconfig1</value> </prop> </node> </node> </node> </oor:component-data>

Page 15

User's manual for Writer2LaTeX

)bout loc'ed o"tions


The o%tions *ou can s%ecif* for the Loc)ed-%tions %ro%ert* de%ends on the filter. The follo,ing list details ,hich o%tions are a2aila le to loc) for each filter <see section $=.:

Writer2LaTeX
backend, inputencoding, multilingual, greek_math, additional_symbols4, use_bibtex, bibtex_style, wrap_lines_after, split_linked_sections, split_toplevel_sections, save_images_in_subdir, notes, metadata, original_image_size, simple_table_limit, float_tables, float_figures, float_options, ignore_hard_page_breaks, ignore_hard_line_breaks, ignore_empty_paragraphs, ignore_double_spaces

Writer2xhtml (XHTML export)


scaling, column_scaling, convert_to_px, image_size, notes, use_dublin_core, ignore_hard_line_breaks, ignore_empty_paragraphs, ignore_double_spaces, split_level, repeat_levels, save_images_in_subdir, xslt_path

Writer2xhtml (EPUB export)


scaling, column_scaling, relative_font_size, font_scaling, use_default_font, default_font_name, convert_to_px, image_size, ignore_hard_line_breaks, ignore_empty_paragraphs, ignore_double_spaces, display_hidden_text, notes, split_level, page_break_split, split_after, image_split, cover_image, external_toc_depth, include_toc

Calc2xhtml
scaling, column_scaling, convert_to_px, image_size, notes, use_dublin_core, display_hidden_sheets, display_hidden_rows_cols, display_filtered_rows_cols, apply_print_ranges, use_title_as_heading, use_sheetnames_as_headings, calc_split, save_images_in_subdir

$ This is a %seudoDo%tion ,hich loc)s all the o%tions use_pifont: use_ifsym: use_wasysym: use_eurosym and use_tipa.

3 Using the command line utilit*

Page 11

sin! the command line utilit0

3.1 1o2 to install Writer2LaTeX for command line usa!e


Writer2LaTeX can ,or) as a standalone command line utilit* <an installation of --o is not re?uired=. Limitation8 The e"%ort filters su%%ort con2ersion of em edded o Bects and gra%hics to a suita le format. The command line utilit* can onl* handle gra%hics in the original format.

Installation for Microsoft Windo2s


To install Writer2LaTeX under Microsoft Windo,s follo, these instructions8 1. UnCi% writer2latex12beta.zip su director* writer2latex12. into some director*. This ,ill create a

2. 7dd this director* to *our P7T+ en2ironment 2aria le <o%tional ut recommended=. In some cases *ou ma* ha2e to edit w2l.bat slightl*8 The atch file assumes that the Ba2a e"ecuta le is in *our %ath. To 2erif* this: o%en a command %rom%t and t*%e java -version. If this test fails <or if *ou ha2e se2eral 1a2a 2ersions installed and ,ant to use a s%ecific 2ersion=8 -%en the file w2l.bat ,ith a te"t editor and edit the a%%roriate line to contain the full %ath to the 1a2a e"ecuta le: eg. set JAVAEXE="C:\j2sdk1.5.0_01\bin\java

Installation for

nix and friends


into some director*. This ,ill create a

1. UnCi% writer2latex12beta.zip su director* writer2latex12.

2. 7dd this director* to *our P7T+ en2ironment 2aria le <o%tional ut recommended=. 3. 7dd e"ecute %ermissions to w2l as follo,s8 chmod +x w2l In some cases *ou ma* ha2e to edit the scri%t slightl*8 If *ou %lace ,2l and ,riter2late".Bar in different directories: or if *ou choose to create a s*m olic lin) to the scri%t8 -%en the file w2l ,ith a te"t editor and re%lace the %ath at the to% of the file ,ith the full %ath to Writer2LaTeX: eg. W2LPATH="/home/username/writer2latex12" 7lso: the scri%t assumes that the Ba2a e"ecuta le is in *our %ath: or that the 17@7H+-M/ 2aria le %oints to the locations. To 2erif* the former: o%en a command shell and t*%e java -version. To 2erif* the latter: t*%e env. If neither is the case or *ou ha2e se2eral 1a2a 2ersions installed *ou should edit this line to contain the full %ath to the 1a2a e"ecuta le: ie. set MYJAVAEXE="/path/to/java/executable/

3.2

sin! the command line utilit0

To in2o)e the command line utilit*: use the command line w2l <options> <source document/path> [<target document/path>] The a2aila le o%tions are

Page 12 Group Eormat -latex -bibtex -xhtml -xhtml11 -xhtml+mathml -xhtml+mathml+xsl -epub #onfig -config <file> -ultraclean -clean -pdfprint -pdfscreen -cleanxhtml "html -template <file> Option #on2ert to !i TeX #on2ert to X+TML #on2ert to X+TML 1.1

User's manual for Writer2LaTeX Explanation #on2ert to LaTeX <default=

#on2ert to X+TML ;MathML #on2ert to X+TML ;MathML ,ith "sl <see section 2.$= #on2ert to /PU! Load configuration file <see section $= Load the LaTeX format ultraclean Load the LaTeX format clean Load the LaTeX format pdfprint Load the LaTeX format pdfscreen Load the X+TML format cleanx#tml Load an X+TML tem%late

-stylesheet <file> Load a custom st*le sheet for inclusion in the document </PU! e"%ort onl*= -recurse -%tions -<option> <value> Aecurse into su directories < atch con2ersion= .et a configuration o%tions <see section $=

.ome of the o%tions are e"%lained in more detail in the e"am%les elo,.

(xam"les con3ertin! to LaTeX


The command line w2l mydocument.odt mypath/myoutputdocument.tex ,ill con2ert the document mydocument.odt in the current director*: and sa2e the result in the su director* mypath in the document myoutputdocument.tex. The command line w2l -config myconfig.xml mydocument.odt ,ill con2ert the document using the configuration file myconfig.xml <>ou can read more a out configuration in section $=. 7s no out%ut file is s%ecified: Writer2LaTeX ,ill use the same name as the original document: ut change the e"tension to .tex. >ou can also s%ecif* an* sim%le o%tion descri ed in section $ directl* on the command line. /g. to %roduce a file suita le for %rocessing ,ith %dfLaTeX8 w2l -backend pdftex mydocument.odt Instead of gi2ing *our o,n configuration file: *ou can use one of the standard configurations. Eor e"am%le to %roduce a clean LaTeX file <ie. ignoring most of the formatting from the source document=8 w2l -clean mydocument.odt

3 Using the command line utilit*

Page 13

(xam"les con3ertin! to BibTeX from the command line


Writer2!i TeX e"tracts i liogra%h* data to a !i TeX file. Eor e"am%le w2l -bibtex mydocument.odt ,ill e"tract all i liogra%hic references from the document and store them in a file named mydocument.bib. >ou can also e"tract the data as %art of the con2ersion to LaTeX: see section $.

(xam"les con3ertin! to X1TML from the command line


The command line w2l -xhtml+mathml mydocument.odt ,ill con2ert the document to X+TML;MathML: using the filename mydocument.xhtml. Li)e,ise the commandline w2l -xhtml -config myconfig.xml mydocument.odt myresult.html ,ill con2ert into X+TML using the s%ecified configuration and file name. To %roduce a clean "html file <see section $.3=: for e"am%le8 w2l -cleanxhtml mydocument.odt mypath/myoutputdoc.html

(xam"les con3ertin! to (. B from the command line


The command line w2l -epub -split_level 2 mydocument.odt ,ill con2ert to /PU!: di2ding the document at sections of le2el 2 Li)e,ise the command line w2l -epub -stylesheet mystyles.css -cleanxhtml -split_level 2 ,ill create an /PU! file using the custom st*le sheet mystyles.css for formatting.

Page 1$

User's manual for Writer2LaTeX

# Confi!uration
#.1 Writer2LaTeX confi!uration
LaTeX e"%ort can e configured ,ith a configuration file. The location of the configuration de%ends on ho, *ou use Writer2LaTeX8 Please see the sections on the e"%ort filter and the command line a%%lication. The configuration is a file in "ml format. +ere is a sam%le configuration file for %roducing a document of class book: con2erting onl* asic formatting and o%timiCing for %dfTeX. <?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 ,ith fi2e standard configuration files8

ultraclean.xml to %roduce a clean LaTeX file: ie. almost all the formatting is ignored. clean.xml is a less radical 2ersionL %reser2es h*%erlin)s: color and some character formatting. pdfscreen.xml to %roduce a LaTeX file ,hich is o%timiCed for screen 2ie,ing using the %ac)age pdfscreen.sty. pdfprint.xml to %roduce a LaTeX file ,hich is o%timiCed for %rinting ,ith %dfTeX.

In addition: *ou can find a sam%le configuration file suita le for documents originating from Joogle 9ocs in the directr* samples/config. The follo,ing su sections e"%lains the a2aila le o%tions. The o%tions ,ritten in italics can e set using the dialog if *ou use Writer2LaTeX as an e"%ort filter.

$ #onfiguration

Page 1&

4eneral o"tions
These o%tions are used to control general as%ects of the generated LaTeX document. documentclass This o%tions defines the name of the LaTeX documentclass to use <default is article=.

global_options This o%tion is a list of glo al o%tions to add to the documentclass <the default 2alue is an em%t* string=. backend This o%tion can ha2e an* of the 2alues generic: dvips: pdftex <default=: xetex and unspecified. This ,ill create LaTeX files suita le for an* ac)endGd2i dri2er: d2i%s: %dfTeX or XeTeX res%ecti2el*. The last 2alue does not assume an* s%ecific ac)end. This 2alue of the o%tion affects e"%ort of gra%hics8 -nl* file t*%es than can e handled * the ac)end are included. If *ou use the filter: other gra%hics ,ill e con2erted to a suita le format. If *ou use the command line a%%lication: other t*%es ,ill e commented out. If *ou use unspecified: no gra%hics ,ill e commented out: nor con2erted. The su%%ort for XeTeX is currentl* incom%lete. More com%rehensi2e su%%ort for XeTeX is %lanned for the ne"t 2ersion of Writer2LaTeX <2ersion 1.2=. inputencoding The o%tion inputencoding can ha2e an* of the 2alues ascii <default=: latin1: latin2: iso-8859-7: cp1250: cp1251: koi8-r or utf8. This o%tion has no effect if the ac)end is XeTeX: in this case the encoding is al,a*s utfD0. If this o%tion is set to true <default=: Writer2LaTeX ,ill e"%ort all language information in the document. If backend is xetex: the %ac)age polyglossia.sty ,ill e used: other,ise the %ac)age babel.sty. If the o%tion is set to false: Writer2LaTeX ,ill assume that the document is ,ritten in one language onl*. If backend is xetex: no language information ,ill e e"%orted: other,ise the language used for the maBorit* of the te"t in the document ,ill e e"%orted using babel.sty. greek_math This o%tion can ha2e the 2alues true <default= or false. This means that gree) letters in latin or c*rillic te"t are rendered in math mode. This eha2iour assumes that gree) letters are used as s*m ols in this conte"t: and has the ad2antage that gree) te"t fonts are not re?uired. It is not used in gree) te"t: ,here it ,ould e loo) a,ful. This o%tion has no effect if the backend is set to xetex. .etting this o%tion to true ena les the use of %apf Dingbats using the LaTeX %ac)age pifont.sty. 9efault is false. This o%tion and the follo,ing fi2e font o%tions has no effect if the ac)end is XeTeX. .etting this o%tion to true ena les the use of the ifsym s*m ol font using the LaTeX %ac)age ifsym.sty. 9efault is false.

multilingual

use_pifont

use_ifsym

Page 1' use_wasysym use_bbding

User's manual for Writer2LaTeX .etting this o%tion to true ena les the use of the ,as* s*m ol font using the LaTeX %ac)age wasysym.sty. 9efault is false. .etting this o%tion to true ena les the use of the bbding s*m ol font <a clone of Ma%f 9ing ats= using the LaTeX %ac)age bbding.sty. 9efault is false. .etting this o%tion to true ena les the use of the eurosym font using the LaTeX %ac)age eurosym.sty. 9efault is false. .etting this o%tion to true ena les the use of %honetic s*m ols using the LaTeX %ac)ages tipa.sty and tipx.sty. 9efault is false. This o%tion can ha2e the 2alues true or false <default=. This ena les the use of the LaTeX %ac)age ooomath.sty. This %ac)age defines num er of LaTeX macros used to con2ert formulas from --o to LaTeX. If this %ac)age is not used: the necessar* definitions ,ill e included in the LaTeX %ream le: ,hich ma* ecome ?uite long 6 so using ooomath.sty is recommended for documents ,ith formulas. This o%tion can ha2e the 2alues true or false <default=. This ena les use of the %ac)age lastpage.sty to re%resent the %age count.

use_eurosym use_tipa use_ooomath

use_lastpage

/"tions for biblio!ra"h0 5BibTeX6


These o%tions controls the handling of the i liogra%h*. use_bibtex .etting this o%tion to true ena les the use of !i TeX for i liogra%h* generation. If it is set to false <default=: the i liogra%h* is included as static te"t. This o%tion can ha2e an* !i TeX st*le as 2alue <default is plain=. This is the !i TeX st*le to e used in the LaTeX document. .etting this o%tion to true loads the LaTeX %ac)age natbib.sty. Use this o%tion to %ro2ide o%tions to natbib.sty. Use this o%tion to gi2e a list of e"ternal !i TeX files. If the list is nonDem%t*: i liogra%hic references in the document ,ill e inter%reted as )e*s in these files. If it is em%t* <default=: the i liogra%hic references ,ill e e"%orted to a !i TeX file <%ro2ided use_bibtex is set to true=.

bibtex_style

use_natbib natbib_options external_bibtex_files

$ #onfiguration zotero_bibtex_files

Page 1( Use this o%tion to gi2e a list of e"ternal !i TeX files. If the list is nonDem%t* and use_bibtex is set to true: Motero references in the document ,ill e inter%reted as )e*s in these files. 7lso the Motero i liogra%h*: if an*: ,ill e e"%orted as a LaTeX i liogra%h*. This ,ill ta)e ad2antage of the LaTeX %ac)age natbib.sty. If use_natbib is set to true. -ther,ise <default=: Motero references and i liogra%h* ,ill e e"%orted as te"t. Use this o%tion to gi2e a list of e"ternal !i TeX files. If the list is nonDem%t* and use_bibtex is set to true: 1a Aef references in the document ,ill e inter%reted as )e*s in these files. 7lso the 1a Aef i liogra%h*: if an*: ,ill e e"%orted as a LaTeX i liogra%h*. This ,ill ta)e ad2antage of the LaTeX %ac)age natbib.sty. If use_natbib is set to true. -ther,ise <default=: 1a Aef references and i liogra%h* ,ill e e"%orted as te"t. If *ou con2ert Motero or 1a Aef references: *ou can set this o%tion to true <default is false= to include the original citation inserted * MoteroG1a Aef as a comment in the LaTeX source.

jabref_bibtex_files

include_original_citations

,ile o"tions
These o%tions controls the creation of files associated ,ith the main LaTeX document. wrap_lines_after The o%tion s%ecifies that Writer2LaTeX should tr* to rea) lines in the LaTeX source as soon as %ossi le after this num er of characters. 9efault is 72. If *ou use a te"t editor ,hich su%%orts ,ra%%ing of long lines: *ou ma* ,ant to set this o%tion to 08 In this case Writer2LaTeX ,ill not ,ra% lines. This o%tion s%ecifies that a lin)ed section should e"%orted to a se%arate LaTeXDfile. 9efault is false. e

split_linked_sections split_toplevel_sections

This o%tion s%ecifies that all sections should e e"%orted to a se%arate LaTeXDfile: e"cluding nested sections. 9efault is false. Images contained in the document are normall* %laced in the same director* as the LaTeX document. If the document contains a large num er of images: it ma* e more con2enient to %ut the images in a su director*. .et this o%tion to true to do this.

save_images_in_subdir

Page 10

User's manual for Writer2LaTeX

/"tions for s"ecial content


notes This o%tion can ha2e an* of the 2alues comment <default=: ignore: marginpar: pdfannotation. This s%ecifies ,hat to do ,ith notes <annotations= in the document8 The* can e ignored: con2erted to LaTeX comments: con2erted to \marginpar or con2erted to %df annotations <,hich ,ill default to \marginpar if the document is not %rocessed ,ith %dfLaTeX=. In addition: *ou can gi2e an* LaTeX command <inluding the ac)slash=: and the notes ,ill e e"%orted as \yourcommand{the note}. metadata If *ou set his o%tion to true <default=: Writer2LaTeX ,ill e"%ort the title: author and date of the document as found under File ,roperties. Eurthermore: if *ou ha2e chosen %df as the ac)end: the title: author: su Bect and )e*,ords ,ill e e"%orted to the %df document and ,ill e 2ie,a le if the %df 2ie,er su%%orts it. If the o%tion is false : onl* the title ,ill e e"%orted.

,i!ure and table o"tions


The first o%tions are used to control the handling og floating or nonDfloating figures and ta les. float_figures Use this o%tion to s%ecif* that *ou ,ant to include gra%hics and te"t o"es in a floating figure en2ironment. 9efault is false. This o%tion has no effect on gra%hics and te"t o"es that are anchored as c#aracter. These are al,a*s considered to e %art of the normal te"t flo,. If *ou ,ant a figure to float: anchor it to paragrap# or to c#aracter. float_tables float_options align_frames Use this o%tion to s%ecif* that *ou ,ant to include ta les in a floating table en2ironment. 9efault is false. Use this to gi2e %lacement o%tions to the figure and ta le floats: eg. h for #ere. 9efault is em%t* <default %lacement=. Use this o%tion to s%ecif*: that all gra%hics and te"t o"es should e centered. If *ou don't ,ant that: set this o%tion to false. 9efault is true. Use this o%tion if *ou ,ant to ta)e ad2antage of the LaTeX %ac)age caption.sty. #urrentl* Writer2LaTeX onl* uses the su%%ort for nonDfloating ca%tions from this %ac)age. This o%tion can e set to a se?uence name in the source document. -%en9ocument has a 2er* ,ea) sense of figure ca%tions8 7 figure ca%tion is a %aragra%h containing a se?uence num er. If *ou use --o's defaults: Writer2LaTeX can guess ,hich se?uence name to use. If it fails: *ou can gi2e the name in this o%tion <default is em%t*=. This is a similar o%tion for ta les.

use_caption

figure_sequence_name

table_sequence_name

$ #onfiguration These o%tions controls the e"%ort of ta les8 simple_table_limit

Page 13

>ou can set this o%tion to an* nonDnegati2e integer <default is 0=. Ta le cells in --o can contain an* num er of %aragra%hs: so normall* Writer2LaTeX e"%orts ta les ,ith p columns. Eor sim%le ta les ,here all cells onl* contains a single line it is etter to use l: c and r columns. If all cells in a ta le contains at most one %aragra%h: and the total ,idth of the ta le is less than this num er of characters: the ta le ,ill e e"%orted ,ith l: c and r columns. This o%tion has no effect on ta les using tabulary. This o%tion is used to s%ecif* that longtable.sty should e used to e"%ort ta les ,hich ma* rea) across %ages. 9efault is false. This o%tion is used to s%ecif* that supertabular.sty should e used to e"%ort ta les ,hich ma* rea) across %ages. 9efault is true. <>ou should onl* set one of the o%tions use_longtable and use_supertabular to true=. This o%tion is used to s%ecif* that tabulary.sty should e used to e"%ort ta les. 9efault is false. This o%tion is used: if *ou ,ant to a%%l* ac)ground color to ta les using the %ac)age colortbl.sty. The 2alue can e true or false <default=. This o%tion has no effect unless *ou also set the o%tion use_color to true. This o%tion is used to %roduce ad2anced ta les: that are not su%%orted in Writer. >ou can set this o%tion to the name of a %aragra%h st*le. If the first %aragra%h of the first cell in a ro, is formatted ,ith this %aragra%h st*le: the ro, in ?uestion ,ill e used for the first head in a multi%age ta le. Li)e,ise this o%tion s%ecifies a %aragra%h st*le that identifies a re%eating head in a multi%age ta le <li)e a normal ta le head in Writer=. This o%tion s%ecifies a %aragra%h st*le that identifies a re%eating foot in a multi%age ta le. This o%tion s%ecifies a %aragra%h st*le that identifies the last foot in a multi%age ta le.

use_longtable

use_supertabular

use_tabulary use_colortbl

table_first_head_style

table_head_style

table_foot_style table_last_foot_style

These o%tions controls the e"%ort of figures8

Page 25 original_image_size

User's manual for Writer2LaTeX -ften images in a Writer document are scaled u% or do,n from their original siCe. 4ormall* the same scaling ,ill e used in the LaTeX document: ut if *ou set this o%tion& to true: the original <unscaled= image siCe ,ill e used. The default 2alue is false. This o%tion can e used to s%ecif*: that the file e"tension on gra%hics files should e remo2ed. >ou ,ill thus get eg. \includegraphics{myimage} rather than \includegraphics{myimage.png}. This o%tion can e used to s%ecif* some o%tions that should e a%%lied to all images <ie. all \includegraphics commands=. Eor e"am%le "width=\linewidth". 9efault is em%t* <no o%tions=.

remove_graphics_extension

image_options

)utoCorrect o"tions
ignore_hard_page_breaks This o%tion can ha2e the 2alues true or false <default=. .etting the o%tion to true ,ill instruct Writer2LaTeX to ignore hard %age rea)s < ut not soft %age rea)s s%ecified in %aragra%h st*les=. ignore_hard_line_breaks This o%tion can ha2e the 2alues true or false <default=. .etting the o%tion to true ,ill instruct Writer2LaTeX to ignore hard line rea)s <shiftD/nter=. ignore_empty_paragraphs This o%tion can ha2e the 2alues true <default= or false. .etting the o%tion to true ,ill instruct Writer2LaTeX to ignore em%t* %aragra%hsL other,ise the* are con2erted to a \bigskip. ignore_double_spaces This o%tion can ha2e the 2alues true <default= or false. .etting the o%tion to true ,ill instruct Writer2LaTeX to ignore dou le s%aces: other,ise the* are con2erted to \ .

,ormattin! o"tions
In Writer: formatting is controlled * st*les. >ou can control ho, much formatting is e"%orted using the follo,ing o%tions. 4ote that these o%tions has a maBor im%act on the structure of the LaTeX document created.

& In %re2ious 2ersions: this o%tion ,as called keep_image_size: ut has een renamed to a2oid confusion <the old name is still su%%orted=.

$ #onfiguration formatting The o%tion formatting can ha2e an* of these 2alues8

Page 21

ignore_all ,ill instruct Writer2LaTeX to ignore all character: %aragra%h: heading: list and footnote formatting contained in the document. ignore_most ,ill %reser2e asic character formatting. convert_basic <default= ,ill %reser2e asic character formatting: %aragra%h Bustification and all num erings <lists: headings: footnotes=. convert_most ,ill con2ert all su%%orted formatting: e"ce%t that %aragra%h formatting and font siCe is onl* con2erted if it is set * a st*le. To e a le to %reser2e formatting: an en2ironment is created for all %aragra%h st*les: custom lists are used for listings: headings are reformatted using the \@startsection command etc. convert_all ,ill %reser2e all su%%orted formatting.

page_formatting

This o%tion can ha2e an* of the 2alues ignore_all: convert_header_footer: convert_all This ,ill ignore all %age formatting: con2ert the header and footer <using custom %age st*les= or con2ert all su%%orted formatting: including %age geometr* and footnote rule.

use_geometry

.etting this o%tion to true s%ecifies that the %ac)age geometry.sty should e used to e"%ort the geometr* of the %age <%age siCe: margins etc.=. 9efault is false: ,hich ,ill e"%ort the geometr* using the lo, le2el LaTeX commands. .etting this o%tion to true s%ecifies that the %ac)age fancyhdr.sty should e used to e"%ort the header and footer of the %age. 9efault is false: ,hich ,ill e"%ort the header and footer using the lo, le2el LaTeX %age st*le commands. This o%tion can ha2e the 2alues true <default= or false. This ena les use of the %ac)age color.sty to a%%l* color in the LaTeX document. This o%tion can ha2e the 2alues true or false <default=. This ena les use of the %ac)age ulem.sty to su%%ort underlining and crossing out in the LaTeX document. This o%tion can ha2e the 2alues true <default= or false. This ena les use of the %ac)age hyperref.sty to include h*%erlin)s in the LaTeX document. This o%tion is used to s%ecif* ,hat to do ,ith ta ulator sto%s in the document. 4ormall* these are con2erted to s%aces: ut ,ith this o%tion *ou can s%ecif* an* LaTeX code: that should e used instead. Eor e"am%le N\quad{}N or N\hspace{2em}N

use_fancyhdr

use_color

use_ulem

use_hyperref

tabstop

Page 22 use_endnotes

User's manual for Writer2LaTeX This o%tion can ha2e the 2alues true or false <default=. This ena les use of the %ac)age endnotes.sty to format the endnotes in the LaTeX document. If set to false: endnotes ,ill e con2erted to footnotes.

/"tions for includin! or excludin! content


The follo,ing o%tions can e used to control ,hich content to e"%ort. no_preamble If this o%tion is set to true: <default is false=: Writer2LaTeX ,ill not create the a LaTeX %ream le: nor include \begin{document} and \end{document}. This is useful if the document is to e included in another LaTeX document. 4ote that in this case *ou ,ill ha2e to ma)e sure that all %ac)agesGdefinitions needed are a2aila le in the master LaTeX document. If this o%tion is set to true: <default is false=: Writer2LaTeX ,ill not e"%ort inde"es <e.g. ta le of contents: i lio%grah*=. This o%tion is also intended for the case that the document is to e %art of a larger LaTeX document: ,hich ma* contain glo al inde"es. This o%tion can all ha2e the 2alues accept <default=: ignore: warning and error. This controls ho, to e"%ort %aragra%h and te"t content: for ,hich there is no st*le ma% <see elo,=. If the 2alue of this o%tion is accept: the content is handled as normal. If the 2alue is ignore: the content is ignored silentl*. The 2alues warning and error issues a message on the terminal res%. in the generated LaTeX code. This o%tion thus lets *ou control that onl* content ,ith acce%ted st*les is e"%orted. image_content table_content This o%tion has the same 2alues: and is used to e"clude image content. This o%tion also has the same 2alues and is used to e"clude ta le content.

no_index

other_styles

1eadin!s
The heading_map section s%ecifies ho, headings in --o should ma% to LaTeX. /g. the first line in the sam%le a o2e s%ecifies that the to%le2el heading <&ea1in. "= should ma% to \chapter: ,hich is of le2el 5 in LaTeX. U% to 15 le2els are su%%orted <the same num er as in --o=.

7t0le ma"s
In addition *ou can s%ecif* ma%s from st*les in Writer to *our o,n LaTeX st*les in the configuration. #urrentl* this is %ossi le for te"t st*les: %aragra%h st*les and list st*les. In addition a fe, direct formatting attri utes can e ma%%ed to LaTeX code. The follo,ing e"am%les are from the standard configuration file article.xml. This is a sim%le rule: that ma%s te"t formatted ,ith the te"t st*le Emphasis to the LaTeX code \emph{...}8 <style-map name="Emphasis" family="text" before="\emph{"

$ #onfiguration

Page 23

after="}" /> This is another sim%le rule: that ma%s %aragra%hs formatted ,ith the %aragra%h st*le part to the LaTeX code \part{...}. The attri ute line-break ensures that no line rea)s are inserted et,een the code and the te"t. <style-map name="part" family="paragraph" before="\part{" after="}" line-break="false" /> This is a rule: that ma%s %aragra%hs formatted ,ith st*le ,re$ormatte1 Text to the LaTeX en2ironment verbatim. The attri ute verbatim ensures that the content of the %aragra%h is e"%orted 2er atim <this im%lies that characters not a2aila le in the inputenc are con2erted to ?uestion mar)s and that other content is discarded: eg. footnotes=. The paragraph-block entr* s%ecifies code to go efore and after an entire loc) of %aragra%hs. The name attri ute s%ecifies the st*le of the first %aragra%hL the next attri ute s%ecifies the st*le<s= of su se?uent %aragra%hs in the loc). <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 ela orate set of rules: that ma%s %aragra%hs formatted ,ith st*les Title: a/thor and 1ate <in an* 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 ,ill %roduce code li)e this8 \title{Configuration} \author{Henrik Just} \date{2006} \maketitle The ne"t e"am%le ma%s a %aragra%h formatted ,ith the theorem list st*le to a LaTeX en2ironment named theorem. 4ote that there are t,o entries for a list st*le8 The first one to s%ecif* the LaTeX code to %ut efore and after the entire list. The second one to s%ecif* the LaTeX code to %ut efore 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 *ou o2erride a st*le: all formatting s%ecified in the original document ,ill e igored. Einall* an e"am%le using direct formatting attri utes8 <style-map name="italic" family="text-attribute" before="\emph{"

Page 2$

User's manual for Writer2LaTeX

after="}" /> #urrentl* the onl* su%%orted names are italic: bold: small-caps: superscript and subscript.

7trin! re"lace
-ften LaTeX re?uires s%ecial care to t*%eset certain constructions. Eor e"am%le according to Jerman t*%ogra%hical rules: an a re2iation li)e C.!. should e t*%eset ,ith a small s%ace efore the !. >ou can s%ecif* this in the configuration8 <string-replace input="z.B." latex-code="z.\,B." /> The input is the te"t in the --o document: the latex-code is the LaTeX code to e"%ort for this te"t. 7nother e"am%le is Erench ?uotations mar)s <O 1e %arle franPais Q= ,hich should con2erted to the LaTeX macros Rfg and Rog. This can e achie2ed using this rule8 <string-replace input="&#xAB;&#xA0;" latex-code="\fg " /> <string-replace input="&#xA0;&#xBB;" latex-code="\og " /> The final e"am%le ensures that the LaTeX logo is t*%eset correctl* <string-replace input="LaTeX" latex-code="{\LaTeX}" /> e

Math s0mbols
In --o Math *ou can add userDdefined s*m ols. Writer2LaTeX alread* understands the %redefined s*m ols such as %alpha. If *ou define *our o,n s*m ols: *ou can add an entr* in the configuration that s%ecifies LaTeX code to use. The math-symbol-map element is used for this8 <math-symbol-map name=ddarrow latex=\Downarrow /> This e"am%le ,ill ma% the s*m ol %ddarrow to the LaTeX code \Downarrow.

Custom "reamble
The te"t *ou s%ecif* in the element custom-preamble ,ill LaTeX %ream le. Eor e"am%le8 e co%ied 2er atim into the

<custom-preamble>\usepackage{palatino}</custom-preamble> to t*%eset *our document using the %ostscri%t font %alatino.

#.2 Writer2xhtml and Calc2xhtml confi!uration


7lso the X+TML e"%ort can e configured ,ith a configuration file in "ml format. This is a sam%le configuration file8 <?xml version="1.0" encoding="UTF-8"?> <config> <option name="custom_stylesheet" value="/mystyle.css" /> <option name="ignore_styles" value="false" /> <option name="use_dublin_core" value="true" /> <option name="convert_to_px" value="true" /> <option name="split_level" value="1" /> <xhtml-style-map name="mystyle" family="paragraph" element="p" css="mycssclass" /> </config>

$ #onfiguration

Page 2&

The follo,ing su sections e"%lains the a2aila le o%tions. The o%tions ,ritten in italics can e set using the dialog if *ou use Writer2"html as an e"%ort filter.

7t0le o"tions
>ou can control some general as%ects of the generated X+TML documents using these technical o%tions. template_ids This o%tion is used to s%ecifi* the id's used for X+TML tem%lates. These should e %ro2ided as a comma se%arated list defining the id for content:header:footer and %anel in that order. The list can e truncated if *ou don't need them all. The default is em%t*: ,hich content,header,footer,panel. pretty_print is e?ui2alent to

.et this o%tion to false <default is true= if *ou don't ,ant S%rett* %rintK <using indentations and line rea)s= in the X+TML out%ut. If *ou set this o%tions to true <default is false=: Writer2"html ,ill not include the !DOCTYPE declaration in the con2erted document. The !DOCTYPE is re?uired for a 2alid X+TML document8 This o%tion should onl* e used if *ou need to %rocess the document further. This o%tion is used to s%ecif* the character encoding to use for the X+TML document. #urrentl* su%%orted encodings are UTF-8 <default=: UTF-16: ISO-8859-1 and US-ASCII. #haracters not su%%orted * the encoding are e"%orted as numeric character entities. When this o%tion is set to true <default= numeric character entities are e"%orted using he"adecimal num ers: other,ise decimal num ers are used If *ou set this o%tions to true <default is false=: Writer2"html ,ill use named character entities as defined * <X=+TML. If *ou e"%ort to X+TML;MathML: also named MathML entities ,ill e used. In rare cases: it ma* e re?uired to ad a !-M <!*te -rder Mar)= to the X+TML document. Most a%%lications ,ill not need this: ut *ou can set this o%tions to true to ena le this <default is false=. .et this to false <default is true= to remo2e language information from the file <e"ce%t on the root element= .et this to true <default is false= to generate a se%arate #.. file if the X+TML document is s%lit o2er se2eral files <thus a2oiding re%eating the st*le information in e2er* file=.

no_doctype

encoding

hexadecimal_entities

use_named_entities

add_bom

multilingual separate_stylesheet

Page 2' custom_stylesheet

User's manual for Writer2LaTeX Use this o%tion to gi2e an UAL to *our o,n: e"ternal #.. st*lesheet. If the 2alue is em%t* or the o%tion is not s%ecified: no e"ternal st*lesheet ,ill e used. Eor more ad2anced solutions <eg. different st*le sheets for screen 2ie,ing and %rinting= *ou can use an X+TML tem%late 6 see elo,.

The follo,ing o%tions are used to control the con2ersion of the formatting in the source document. If *ou use an e"ternal #..st*le sheet: this is im%ortant to define. formatting The o%tion formatting is used to s%ecif* ho, much te"t formatting <character: %aragra%h and list formatting= to e"%ort'. Possi le 2alues are convert_all <default=8 #on2ert all formatting to #... ignore_styles8 #on2ert hard formatting ut not formatting * st*les. Use this 2alue if *ou use a custom st*lesheet: ut still ,ant to e a le to add some hard formatting <eg. a centered %aragra%h: some old te"t etc.= ignore_hard8 #on2ert formatting * st*les: ut no hard formatting <e"ce%t as gi2en * attri ute st*le ma%s: see elo,=. Use this if the document is ,ell structured using st*les: so that an* hard formatting should e considered an error. ignore_all8 #on2ert no formatting at all. Use this 2alue if *ou use a custom st*lesheet and the document is ,ell structured using st*les: so that an* hard formatting should e considered an error. frame_formatting section_formatting table_formatting ignore_table_dimensions Used for the same %ur%ose for frame formatting. Used for the same %ur%ose for section formatting. <!ut note that --o does not offer section st*les currentl*=. Used for the same %ur%ose for ta le formatting. <!ut note that --o does not offer ta le st*les currentl*=. .et this o%tion to true if *ou don't ,ant ta le dimensions <ta le ,idth: column ,idth and ro, height= to e e"%orted: ut ,ant to lea2e the la*out of the ta les to the ro,ser. 9efault is false.

' This and the follo,ing o%tions re%laces the former o%tion ignore_styles.

$ #onfiguration list_formatting

Page 2( This o%tion determines ho, list formatting is e"%orted. Possi le 2alues are(8 css18 List formatting is e"%orted using #..1. This onl* %ro2ides asic su%%ort for list la els: and currentl* the ro,sers default indentations are used. css1_hack8 This 2alue is used to fi" a %ro lem ,ith continued lists. Writer2"html ,ill e"%ort a list that continues on le2el 2 or elo, li)e <ol><ol><li>...</li></ol></ol> This is not 2alid in X+TML: ut ,or)s in ro,sers. 7lso t,o de%recated attri utes are used to continue num ering. hard_labels8 If *ou use this 2alue: list la els are e"%orted as %art of the te"t. This adds full su%%ort for list la els <e.g. la els of the form 1.2.3=. Unli)e the other 2alues indentations of the list are e"%orted as ,ell.

tabstop_style

Used this o%tion to s%ecif* a st*le used for ta sto%s. 4ormall* ta sto%s are e"%orted as s%aces: ut ,ith this o%tion the s%ace ,ill e contained in a span element: eg. <span class="tabstop"> </span> >ou can then define a #..rule li)e eg. tabstop { width: 2em; }

use_default_font

.et this o%tion to true <default is false= to ignore all font information in the document and use a default font for the entire e"%orted document. Use this o%tion to su%%l* a font name to use if the o%tion use_default_font is set to true. 7 lan) 2alue ,ill not insert ant font information.

default_font_name

In addition: a num er of o%tions defines ho, dimensions in the source document should e handled. convert_to_px When this o%tion is true <default=: Writer2"html ,ill con2ert all units to %": other,ise the original units are used. The resolution is assumed to e 3'%%i: *ou can change this ,ith the scaling o%tion. /g. a scaling of 75% ,ill change the resolution to (2%%i. Eor /PU! e"%ort this o%tion ,ill e"%ort font siCes as %ercentages <and use %" for other dimensions=. Use this o%tion to s%ecif* a scaling of all formatting: ie. to get a different te"t siCe than the original document. The 2alue must e a %ercentage: default is 100%.

scaling

( In %re2ious 2ersions: this o%tion ,as called list_hack: ut ,as renamed to su%%ort the ne, 2alue hard_labels. <The old name is still su%%orted.=

Page 20 column_scaling image_size8

User's manual for Writer2LaTeX Use this o%tion to s%ecif* an additional scaling for ta le colums. The 2alue must e a %ercentage: default is 100%. Use this o%tion to s%ecif* ho, to e"%ort the siCe of images and te"t o"es8 Possi le 2alues are absolute <default: e"%ort a solute siCe=: relative <e"%ort the siCe as a %ercentage of the current te"t ,idth= and none or original_image_size <do not e"%ort siCe informationL hence the ro,ser or reader ,ill use the original <unscaled= image siCe=. .et this o%tion to true <default= false to e"%ort all font siCes as %ercentages rather than using a solute dimensions. The font siCe is calculated relati2e to the default font siCe in the document. Use this o%tion to s%ecif* a scaling for all font siCes if relative_font_size is set to true. 9efault is 100%.

relative_font_size

font_scaling

/"tions for s"ecial content


formulas If *ou are not e"%orting to X+TML;MathML: this o%tions defines ho, formulas are treated. The %ossi le 2alues are starmath <default= to e"%ort the formula in .tarMath notation: latex to e"%ort the formula in LaTeX notation: image+starmath and image+latex to e"%ort the formula as an image: ,ith an alt attri ute gi2ing the formula in .tarMath or LaTeX notation. In --o the endnotes are set on a se%arate %age at the end of the document. It is not %ossi le to gi2e this %age a heading: ut *ou can use this o%tion to add a heading. In /PU! e"%ort this heading ,ill also a%%ear in the na2igation ta le. 9efault is em%t* <no heading=. In --o the footnotes ma* e set on a se%arate %age at the end of the document <if configured to do so=. It is not %ossi le to gi2e this %age a heading: ut *ou can use this o%tion to add a heading. In /PU! e"%ort this heading ,ill also a%%ear in the na2igation ta le. 9efault is em%t* <no heading=. Use this o%tion to s%ecif* if 9u lin #ore Meta data should e e"%orted. Eor the X+TML e"%ort: the format ,ill e as s%ecified in htt%8GGdu lincore.orgGdocumentsGdc?DhtmlG=. Eor the /PU! e"%ort this o%tion has no effect: cf. section /rror8 Aeference source not found for /PU! meta data. If the 2alue is false: it ,ill not e e"%orted <default is true=.
0 This o%tion re%laces old o%tions keep_image_size and original_image_size <the old names are still su%%orted=.

endnotes_heading

footnotes_heading

use_dublin_core

$ #onfiguration notes

Page 23 If this o%tion is set to true <default=: notes in the document ,ill e e"%orted as X+TML comments. These are not directl* 2isi le in the ro,ser. If *ou don't ,ant to include notes: set this o%tion to false. If this o%tion is set to true <default is false=: %aragra%hs and te"t %ortions mar)ed as hidden ,ill e e"%orted. -ther,ise the* ,ill e ignored. If this o%tion is set to true <default=: the ta le of contents is e"%orted. If it is set to false: the ta le of contents is ignored. The latters %ossi ilit* is mainl* intended for /PU!: ,hich also %ro2ides an e"ternal na2igation ta le.

display_hidden_text

incluce_toc

)utoCorrect o"tions
ignore_double_spaces This o%tions can ha2e the 2alues true <default= or false. .etting the o%tion to true ,ill instruct Writer2"html to ignore dou le s%aces: other,ise the* are con2erted to nonD rea)ing s%aces. This o%tion can ha2e the 2alues true <default= or false. .etting the o%tion to true ,ill instruct Writer2"html to ignore em%t* %aragra%hs.. This o%tion can ha2e the 2alues true or false <default=. .etting the o%tion to true ,ill instruct Writer2"html to ignore hard line rea)s <.hiftD/nter in --o=.

ignore_empty_paragraphs

ignore_hard_line_breaks

,ile o"tions
external_toc_depth In addition to the te"t content: an /PU! document contains a ta le of contents: ,hich can e used for na2igation in the reader. This ta le is generated * Writer2"html from the headings in *our document. This o%tion is used to s%ecif* the num er of le2els to include in the ta le. The default 2alue is auto: ,hich determines the de%th from the o%tion split_value. If *ou ,ant to set the de%th inde%endent from split_value: set this o%tion to a %ositi2e integer. This o%tion is used to s%ecif* that the Writer documents should e s%lit in se2eral documents and the outline le2el at ,hich the s%litting should ha%%en <the default 0 means no s%lit=. This is con2enient for long documents. /ach out%ut document ,ill get a sim%le na2igation %anel in the header and the footer.

split_level

Page 35 repeat_levels

User's manual for Writer2LaTeX If *ou s%lit the document: *ou can use this o%tion to s%ecif* that headings of higher le2els should e re%eated on %age rea)s. This ma* hel% the user to identif* the current %osition in the document. 9efault is 5 <all le2els are re%eated=. 7n alternati2e method to s%lit the document is to use the original %age rea)s. Possi le 2alues are none <default=8 9o not s%lit at %age rea)s. styles8 .%lit at %age rea)s ,hich are defined in st*les. explicit8 .%lit at all e"%licit %age rea)s <%age defined in st*les and manual %age rea)s= rea)s

page_break_split

all8 .%lit at all %age rea)s. 7utomatic %age rea)s ma* occur ,ithin a %aragra%h: list or ta le: ut Writer2"html ,ill not s%lit until this structure has ended. 7lso in this case: each out%ut document ,ill get a sim%le na2igation %anel in the header and the footer. split_after This o%tion <,hich onl* has effect for /PU! e"%ort= is used to automatic s%lit long documents. When a single file e"ceeds the num er of characters defined * this o%tion <in 1555s=: the document ,ill e s%lit at the first %ossi le rea) %oint. The 2alue 5 disa les automatic s%lit. This o%tion <,hich onl* has effect for /PU! e"%ort= is used to con2ert large images to Nfull screenN images. The 2alue of the o%tion can e either none or a %ercentage. If set to a %ercentage: an image ,hich is ,ider than this %ercentage and has an as%ect ratio of at least 38$ is %laced in a se%arate file. If *ou set this o%tion to true <default is false=: the first image in the document is used as co2er image in /PU! e"%ort. Images contained in the document are normall* %laced in the same director* as the X+TML document. If the document contains a large num er of images: it ma* e more con2enient to %ut the images in a su director*. .et this o%tion to true to do this. This o%tion is used to s%ecif* a lin) ,hich rings the user u% in a %age hierarch*. Eor e"am%le "../index.html".

image_split

cover_image

save_images_in_subdir

uplink

$ #onfiguration

Page 31

/"tions s"ecific for s"readsheet documents


calc_split .et this o%tion to true if *ou ,ant s%readsheet documents should e s%lit in se2eral documents <one for each sheet=. This is con2enient for large s%readsheets. /ach out%ut document ,ill get a sim%le na2igation %anel in the header and the footer. The default 2alue is false: ,hich means that the entire s%readsheet ,ill e con2erted to a singe X+TML document. display_hidden_sheets display_hidden_rows_cols .et this o%tion to true if *ou ,ant to e"%ort sheets that are defined as hidden. 9efault is false. .et this o%tion to true if *ou ,ant to e"%ort ro,s or columns that are defined as hidden. 9efault is false. .et this o%tion to true if *ou ,ant to e"%ort ro,s or columns that are not 2isi le due to a filter. 9efault is false. I *ou set this o%tion to true: the %rint ranges defined in the document ,ill e used. The content of the result ,ill thus e identical to the content of %rinted out%ut. If *ou set the o%tion to false <default=: the content of the out%ut ,ill e identical to the content that *ou can see ,hen editing the document. If *ou set this o%tion to true <default=: the title of the document ,ill e included in the X+TML document as a heading. If *ou set this o%tion to true <default=: the sheet name ,ill e added as a heading a o2e each ta le in the X+TML document.

display_filtered_rows_cols

apply_print_ranges

use_title_as_heading

use_sheet_names_as_headings

/"tions for batch con3ersion


directory_icon Used to s%ecif* an UAL for an <icon= image that re%resents a director*. This is used ,hen Writer2"html creates inde" %ages for a director*. Used to s%ecif* an UAL for an <icon= image that re%resents a document. This is used ,hen Writer2"html creates inde" %ages for a director*.

document_icon

7t0le ma"s
In addition to the o%tions: *ou can s%ecif* that certain st*les in Writer should e ma%%ed

Page 32

User's manual for Writer2LaTeX

to s%ecific X+TML elements and #..st*le classes. +ere are some e"am%les sho,ing ho, to use some of the uiltDin Writer st*les to create X+TML elements8 <?xml version="1.0" encoding="UTF-8"?> <config> <!-- map OOo paragraph styles to xhtml elements --> <xhtml-style-map name="Text body" family="paragraph" element="p" css="(none)" /> <xhtml-style-map name="Sender" family="paragraph" element="address" css="(none)" /> <xhtml-style-map name="Quotations" family="paragraph" block-element="blockquote" block-css="(none)" element="p" css="(none)" /> <!-- map OOo text styles to xhtml elements --> <xhtml-style-map name="Citation" family="text" element="cite" css="(none)" /> <xhtml-style-map name="Emphasis" family="text" element="em" css="(none)" /> <!-- map hard formatting attributes to xhtml elements --> <xhtml-style-map name="bold" family="attribute" element="b" css="(none)" /> <xhtml-style-map name="italics" family="attribute" element="i" css="(none)" /> </config> 7n e"tended 2ersion of this is distri uted ,ith Writer2LaTeX: %lease see the file cleanxhtml.xml. The attri utes of the xhtml-style-map element are used as follo,s8

name s%ecifies the name of the Writer st*le. family3 s%ecifies the st*le famil* in WriterL this can either e text: paragraph: heading: frame: list or attribute. The last 2alue does not s%ecif* a real st*le: ut refers to hard formatting attri utes. The %ossi le names in this case are bold: italics: fixed <for fi"ed %itch fonts=: superscript: subscript: underline and overstrike. element s%ecifies the X+TML element to use ,hen con2erting this st*le. This is not used for frame and list st*les. css s%ecifies the #.. st*le class to use ,hen con2erting this st*le. If it is not s%ecified or the 2alue is (none): no #..class ,ill e used. block-element onl* has effect for %aragra%h and heading st*les. Eor %aragra%hs it is used to s%ecif* a loc) X+TML element: that should surround se2eral e"%orted %aragra%hs ,ith this st*le. Eor headings it is used to s%ecif* the element containing the entire heading <the element is used for the te"t content onl*: e"cluding the la el=.

3 Pre2iousl* this attri ute ,as called class.

$ #onfiguration

Page 33

block-css s%ecifies the #.. st*le class to e used for this loc) element. If it is not s%ecified or the 2alue is (none): no #..class ,ill e used.

Eor e"am%le the rules a o2e %roduces code li)e this8 <p>This paragraph is Text body</p> <address>This paragraph is Sender</address> <blockquote> <p>This paragraph is Quotations</p> <p>This paragraph is also Quotations</p> </blockquote> <p>This paragraph is also Text body and has some <em>text with emphasis style</em> and uses some <b>hard formatting</b>.</p> >ou can use *our o,n Writer st*les together ,ith *our o,n #.. st*le sheet to create further st*le ma%%ings: for e"am%le8 <xhtml-style-map name="Some OOo style" family="paragraph" block-element="div" block-css="block_style" element="p" css="par_style" /> to %roduce out%ut li)e this8 <div class=block_style> <p class=par_style>Paragraph with Some OOo style</p> <p class=par_style>Yet another</p> </div> 4ote that the rules for hard formatting are onl* used ,hen formatting is set to ignore_hard or ignore_all. It is not recommended to rel* on these rules: using real te"t st*les is %refera le. The* are included ecause the use of hard character formatting is 2er* common e2en in other,ise ,ellDstructured documents.

XHTML templates
>ou can use *our o,n X+TML document as a tem%late for the generated X+TML documents. This should e an ordinar* X+TML file <do not include 9-#T>P/ declaration= ,ith some s%ecial elements8

7 divDelement ,ith the id content is used to fill the te"t content. If no such element e"ists: the <body> element is used. If there is no <body> element in the tem%late: the root element is used. divDelements ,ith the id header or footer <o%tional= ,ill e filled ,ith a sim%le na2igation %anel using a firstG%re2iousGne"tGlast scheme <for s%readsheet documents: sheet names are used for na2igation=. 7 divDelement ,ith the id %anel <o%tional= ,ill %anel using a ta le of contensDli)e scheme. e filled ,ith a sim%le na2igation

>ou can change the names of the id attri utes using the template_ids o%tion. 7 sim%le tem%late including a header might loo) li)e this8 <html> <head> <title/> </head>

Page 3$

User's manual for Writer2LaTeX

<body> <div id='header' /> <div id='content' /> </body> </html> 7s the tem%late does not include footer and %anel nodes: these elements ,ill not included. The a solute mininal tem%late is this8

<div/> The divDelement ,ill e used as the content container. The generated document ,ill not e a com%lete X+TML document <no <html>: <head> and <body> nodes=. It ,ill ho,e2er still e a ,ellDformed XML file that can e handled ,ith standard tools. The use case for this is that *ou can %roduce X+TML fragments suita le for inclusion in e.g. a #M.. Note8 Ma)e sure to set the o%tion no_doctype to true in this caseF

#.3

sin! /"en/ffice.or! to create X1TML documents

The configuration file cleanxhtml.xml that is distri uted ,ith Writer2LaTeX: can e used to create semanticall* rich X+TML content: ,hich can e formatted ,ith *our o,n st*lesheet <*ou should edit the file to add the UAL to the st*lesheet *ou ,ant to use=. 7 su set of the uiltDin st*les in Writer are ma%%ed to X+TML elements <note that the st*le names are localiCed: so this is for the english 2ersion of -%en-ffice.org=8 OOo Writer style Te"t od* .ender Iuotations Preformatted Te"t List +eading List #ontents +oriContal Aule #itation 9efinition /m%hasis /"am%le .ource Te"t .trong /m%hasis Telet*%e User entr* @aria le old OOo Writer style family %aragra%h st*le %aragra%h st*le %aragra%h st*le %aragra%h st*le %aragra%h st*le %aragra%h st*le %aragra%h st*le te"t st*le te"t st*le te"t st*le te"t st*le te"t st*le te"t st*le te"t st*le te"t st*le te"t st*le hard formatting attri ute p address blockquote pre dt <in dl= dd <in dl= hr cite dfn em samp code strong tt kbd var b XHTML element

$ #onfiguration OOo Writer style italics fi"ed %itch font su%erscri%t su scri%t OOo Writer style family hard formatting attri ute hard formatting attri ute hard formatting attri ute hard formatting attri ute i tt sup sub

Page 3& XHTML element

.o * using these st*les onl*: *ou ,ill create ,ellDstructured X+TML documents. .ee the document sample-xhtml.sxw for an e"am%le of ho, to use this.

Lin's
--o does not su%%ort all )ind of X+TML lin) attri utes: for e"am%le *ou cannot set title or rel. Writer2"html %ro2ides a solution for thus using the name attri ute8 >ou can define 2alues for all attri utes * %ro2iding a semicolon se%arated list of names and 2alues: eg. title=My title;rel=next ,ill create an X+TML lin) li)e <a href="..." title="My title" rel="next"> If the name attri utes does not contain such a list: the 2alue is used for the name and title attri ute8 My name ,ill create an X+TML lin) li)e <a href="..." name="My name" title="My name">

Page 3'

User's manual for Writer2LaTeX

$ 7"ecial features for the (. B ex"ort


$.1 Meta data
Writer2"html al,a*s e"%orts the title of the document: and also the su Bect: )e*,ords and descri%tion if the* are nonDem%t*. The /PU! standard s%ecifies a num er of meta data elements not su%%orted * -9E. Writer2"html su%%orts these elements using userDdefined meta data. To add userDdefined meta data choose File%,roperties: -ser%1e$ine1 properties. <The e"%ort filter includes a custom editor for these.= The follo,ing %ro%erties are su%%orted8

31enti$ier8 /ach /PU! document must ha2e a uni?ue I9. 4ormall* Writer2"html generates a Uni2ersal Uni?ue I9 <UUI9= for this %ur%ose: ut *ou ma* o2erride this ,ith *our o,n I9. To do this add a ne, %ro%ert*: enter 31enti$ier <case is not im%ortant= as name and the I9 as 2alue. 7n identifier ma* follo, a s%ecific identification scheme: e.g. I.!4. To s%ecif* an identification scheme: a%%end this to the name se%arated * a %eriod: e.g. 31enti$ier.3#B . It is %ossi le to ha2e se2eral identifiers: in this case a%%end a num er to the name: e.g. 31enti$ier".3#B and 31enti$ier2. The first identifier is used as the uni?ue I9.

Creator8 7 %rimar* creator or author of the %u lication. /nter Creator as name and the creator's name as 2alue. 7 creator ma* ha2e a s%ecial role: *ou can s%ecif* this ,ith a three letter code after the ,ord creator: e.g. creator.a/t for the author or creator.ill for the illustrator. Eor the com%lete list of three letter codes see the /PU! s%ecification <htt%8GG,,,.id%f.orgG255(Go%fG-PEH2.5HfinalHs%ec.html=. >ou can define se2eral creators: in this case add a num er to the ,ord creator: e.g. creator".a/t and creator2. The creators ,ill e sorted according to the num ers. 4ote that some readers ma* onl* %resent the first creator. If no creator is defined: Writer2"html ,ill e"%ort the default creator gi2en in the document <this is usuall* ta)en from --o's user settings=.

Contrib/tor8 7 %art* ,hose contri ution to the %u lication is secondar* to those named in creator elements. -ther,ise it is handled li)e #reator: and the same rules a%%l*. 2ate8 9ate of %u lication. The date must e in the format >>>>DMMD99 <*earD monthDdate= or more generall* in the format s%ecified in htt%8GG,,,.,3.orgGTAG4-T/Ddatetime. 7 date ma* e associated ,ith a s%ecial e2ent such as creation: p/blication or mo1i$ication. To define this: add the e2ent after the ,ord 1ate: e.g. 1ate.p/blication. >ou can gi2e se2eral dates: in this case add a num er to the ,ord date: e.g. 1ate".creation: 1ate2.mo1i$ication.

& .%ecial features for the /PU! e"%ort

Page 3(

If *ou don't define an* dates: Writer2"html ,ill include the date the document ,as last modified. >ou can onl* ha2e one instance of the remaining %ro%erties: hence the* cannot num ered. 7lso no additional data can e a%%ended to the name.

,/blisher8 The %u lisher of the document. T0pe8 Terms descri ing general categories: functions: genres: or aggregation le2els for content. Format8 The media t*%e or dimensions of the resource. #o/rce8 Information regarding a %rior resource from ,hich the %u lication ,as deri2ed. 4elation8 7n identifier of an au"iliar* resource and its relationshi% to the %u lication. Covera.e8 The e"tent or sco%e of the %u licationTs content. 4i.hts8 7 statement a out rights: or a reference to one.

$.2 1idden hedin!s


If the entire te"t of a heading is stri)ed out <using an* stri)eDout st*le=: this heading ,ill e hidden in the te"t. It ,ill ho,e2er still e 2isi le in the /PU! ta le of contents.

Page 30

User's manual for Writer2LaTeX

% The LaTeX "ac'a!e ooomath.sty


--o Math has a fe, features that are not a2aila le in standard LaTeX %ac)ages. +ence Writer2LaTeX uses an o%tional %ac)age ooomath.sty15 ,hich im%lements these constructions. This %ac)ages is onl* needed for documents containing formulas. If it is not a2aila le: Writer2LaTeX ,ill insert the necessar* definitions in the LaTeX %ream le. It is sufficient to %lace ooomath.sty in the same director* as the con2erted LaTeX document. It ,ill ho,e2er e more con2enient if *ou install it in *our TeX distri ution. The %ro%er %lace ,ill usuall* e the Slocal te"mf treeK: %lease see the documentation of *our TeX distri ution. !elo, are s%ecific instructions for teTeX and Mi)TeX8

Instructions for teTeX and TeX Li3e 5Linux6


If *ou use teTeX or TeX Li2e on Linu" *ou can install ooomath.sty as follo,s8 -%en a shell and t*%e texconfig conf This ,ill list the configuration details for TeX. Under the heading SU%athseaK *ou ,ill see a list of directories searched * TeX. >ou can %ut ooomath.sty in the su director* tex of an* of these directories. Usuall* the director* /home/<user name>/texmf/tex can e used <*ou can create it if it doesn't e"ist=. 4e"t *ou should t*%e texconfig rehash to ma)e TeX refresh it's filename data ase.

Instructions for Mi'TeX 5Windo2s6


If *ou use Mi)TeX *ou can install ooomath.sty as follo,s8 #o%* ooomath.sty to the tex su director* in the local te"mf tree. With a standard installation this ,ill e the director* c:\localtexmf\tex If this director* does not e"ist *ou should start SMi)TeX -%tionsK <*ou can find this in the .tart Menu=. -n the ta %age 4oots *ou can see the location of the local te"mf tree. If the su director* tex does not e"ist: *ou can create it. 4e"t *ou should start SMi)TeX -%tionsK. -n the ta %age 5eneral: clic) the utton 4e$resh ow to ma)e Mi)TeX refresh it's filename data ase.

15 This %a)cage re%laces writer.sty used * older 2ersions of Writer2LaTeX.

( Using Writer2LaTeX from another a%%lication Page 33

&
&.1

sin! Writer2LaTeX from another a""lication


sin! Writer2LaTeX from a 8a3a a""lication

Writer2LaTeX features a sim%le 7PI to con2ert documents from another 1a2a a%%lication. Please see the Ba2adoc for writer2latex.jar <the %ac)age writer2latex.api= for details. The 7PI offers a stream ased as ,ell as a file ased interface for con2ersions. +ere's a sim%le e"am%le sho,ing ho, to con2ert a file to LaTeX using a custom configuration <e"cluding e"ce%tion handling= using the file ased methods of the 7PI. import java.io.File; import writer2latex.api.*; // Create a LaTeX converter Converter converter = ConverterFactory.createConverter("application/x-latex"); // Configure the converter Config config = converter.getConfig(); config.read(new File("myconfig.xml")); config.setOption("inputencoding","latin1"); // Convert the document ConverterResult result = converter.convert(new File("mydocument.odt"), "mydocument.tex"); // Write the files result.write(new File("mydirectory")); Using the stream ased methods the con2ersion ma* loo) li)e this <assuming the o%tion save_images_in_subdir is set to false=8 import java.io.FileInputStream; import java.io.FileOutputStream; // Convert the document ConverterResult result = converter.convert(new FileInputStream("mydocument.odt"), "mydocument.tex"); // Write the files Iterator<OutputFile> docs = result.iterator(); while (docs.hasNext()) { OutputFile docOut = (OutputFile) docs.next(); FileOutputStream fos = new FileOutputStream("mydirectory/"+docOut.getFileName()); docOut.write(fos);

Page $5 fos.flush(); fos.close();

User's manual for Writer2LaTeX

} Writer2LaTeX also offers an interface for atch con2ersion of a director* into X+TML. Eor at sim%le e"am%le: see the source of Application.java.

&.2

sin! Writer2LaTeX from a Basic macro

>ou can also access Writer2LaTeX through --o's a%i. +ere's an e"am%le using a !asic macro: ut the %rinci%le is the same for an* other language ,ith a U4- inding. Writer2LaTeX is used as an* other filter in --o. Using the %arameter FilterData: *ou can %ro2ide s%ecific o%tions for Writer2LaTeX8 >ou can gi2e an UAL for a configuration file to use andGor *ou can %ro2ide 2alues for sim%le o%tions <the order does not matter: the configuration file is al,a*s read first=. In addition <X+TML e"%ort onl*=: *ou can define a target tem%late and an included st*le sheet. This e"am%le e"%orts a document to LaTeX using a s%ecific configuration: ut o2erriding the 2alue of the o%tion use_colortbl. Dim sUrl As String sUrl = <url to document> Dim sConfigUrl As String sConfigUrl = <url to config> Dim oFilterData(1) As New com.sun.star.beans.PropertyValue oFilterData(0).Name = "ConfigURL" oFilterData(0).Value = sConfigUrl oFilterData(1).Name = "use_colortbl" oFilterData(1).Value = "true" Dim oProps(2) As New com.sun.star.beans.PropertyValue oProps(0).Name = "FilterName" oProps(0).Value = "org.openoffice.da.writer2latex" oProps(1).Name = "Overwrite" oProps(1).Value = true oProps(2).Name = "FilterData" oProps(2).Value = oFilterData ThisComponent.StoreToURL(sUrl, oProps()) The ta le lists the names of the filters %ro2ided * Writer2LaTeX8 Format LaTeX !i TeX X+TML <te"t document= X+TML 1.1 <te"t document= X+TML <s%readsheet= FilterName org.openoffice.da.writer2latex org.openoffice.da.writer2bibtex org.openoffice.da.writer2xhtml org.openoffice.da.writer2xhtml11 org.openoffice.da.calc2xhtml

( Using Writer2LaTeX from another a%%lication Page $1 X+TML 1.1 <s%readsheet= X+TML ;MathML X+TML ;MathML using "sl /PU! Property ConfigURL TargetTemplateURL StyleSheetURL ResourceURL org.openoffice.da.calc2xhtml11 org.openoffice.da.writer2xhtml.mathml org.openoffice.da.writer2xhtml.mathml.xsl org.openoffice.da.writer2xhtml.epub

This ta le lists the s%ecial %ro%erties a2aila le for the filter data <all are o%tional=8 Purpose .ets the UAL for the configuration to use .ets the UAL for an X+TML tem%late to use <X+TML and /PU! onl*= .ets the UAL for a #..st*le sheet to include </PU! onl*= .ets the UAL for a folder containing resources <images and fonts= referred in the st*le sheet </PU! onl*=. 7ll files contained in this folder ,ill e included ,ith the st*le sheet in the same director* as the st*le sheet. The media t*%e ,ill e determined from the file e"tension. If *ou ,ant to define the media t*%e *ourself: use the more com%le" %ro%ert* Resources. .ets a list of resources <images and fonts= referred in the st*le sheet </PU! onl*=. This %ro%ert* is a semicolon se%arated list. /ach entr* is of the form URL[[::file name]::mime type] ,here the %arts in s?uare rac)ets are o%tional. Eor e"am%le file://mycomputer/home/myself/images/bg.png::backgro und.png::image/png to %oint to a %ng image ,hich is referenced * the file name background.png in the st*le sheet. The resource file ,ill e %laced in the same director* as the st*le sheet. The UALs can contain 2aria les such as $(user) for the user installation of --o. Thus for e"am%le $(user)/myconfig.xml can e used to %oint to a configuration ,ithin the user installation. .ee htt%8GGa%i.o%enoffice.orgGdocsGcommonGrefGcomGsunGstarGutilGPath.u stitution.html for a list of a2aila le 2aria les. 7s a s%ecial feature: *ou can re?uire one of Writer2LaTeX's standard configurations. To do this: the UAL should start ,ith an asteris): for e"am%le *ultraclean.xml.

Resources

&.3 Batch con3ersion 2ith


Writer2LaTeX also offers a uno ser2ice

+/

org.openoffice.da.writer2xhtml.BatchConverter %ro2iding atch con2ersion of a com%lete director* into another format <usuall* X+TML= ,ith inde" %ages. This ser2ice im%lements the interface org.openoffice.da.writer2xhtml.XBatchConverter: ,hich %ro2ides a single method

Page $2

User's manual for Writer2LaTeX

// method // org::openoffice::da::writer2xhtml::XBatchConverter::convert void convert ( [in] string sSourceURL, [in] string sTargetURL, [in] sequence<com::sun::star::beans::PropertyValue> lArguments, [in] XBatchHandler handler ); The sSourceURL s%ecifies the UAL of the source director*

The sTargetURL s%ecifies the UAL of the target director* The handler is an im%lementation of the call ac) interface org.openoffice.da.writer2xhtml.XBatchHandler: ,hich is used to %ro2ide user interaction during the con2ersion %rocess. .ee the I9L definition for documentation. If *ou use the atch con2ersion from a !asic macro: the interface must e im%lemented using CreateUnoListener.

The a2aila le arguments <for the %arameter lArguments= are s%ecified in this ta le Ar ument Recurse Uplink DirectoryIcon DocumentIcon TemplateURL Des!ription .et to true <default= if *ou ,ant to con2ert su directories >ou can set this to an UAL: ,hich ,ill e used as an u%lin) on the inde" %age for the to% le2el director* >ou can set this to an UAL %ointing to an image that re%resents a director* >ou can set this to an UAL %ointing to an image that re%resents a document >ou can set this to an UAL %ointing to an X+TML tem%late that should e used to generate the inde" %age<s=. 4ote that if *ou ,ant to %ro2ide an X+TML tem%late for the documents as ,ell: this must e done using the Eilter9ata <and the tem%lates ma* e different=. IndcludePdf UseTitle UseDescription WriterFilterName .et this to true <default= if *ou ,ant to include a %df 2ersion of each file in addition to the X+TML 2ersion .et this to true <default= if *ou ,ant to use the document title in the inde" %age rather than the file name .et this to true <default= if *ou ,ant to include the descri%tion of the document in the inde" %age. >ou can set this to the name of an* Writer e"%ort filter *ou ha2e a2aila le in *our --o installation. The default is the X+TML e"%ort filter %ro2ided * Writer2"html <org.openoffice.da.writer2xhtml=. The structure of this argument de%ends on the filter: ut for the default filter it is a se?uence of PropertyValues to %ass o%tions to the filter <see a o2e=.

WriterFilterData

( Using Writer2LaTeX from another a%%lication Page $3 CalcFilterName >ou can set this to the name of an* #alc e"%ort filter *ou ha2e a2aila le in *our --o installation. The default is the X+TML e"%ort filter %ro2ided * Writer2"html <org.openoffice.da.calc2xhtml=. The structure of this argument de%ends on the filter: ut for the default filter it is a se?uence of PropertyValues to %ass o%tions to the filter <see a o2e=.

CalcFilterData

&.# Con3ertin! from 7tarMath 2ith a Basic macro


In addition to con2erting a com%lete document: *ou can also con2ert a single formula from .tarMath to LaTeX. To do this: the uno ser2ice org.openoffice.da.writer2latex.W2LStarMathConverter is %ro2ided. This ser2ice su%%orts t,o methods string convertFormula ( [in] string sStarMathFormula ); string getPreamble ( ); The method convertFormula con2erts a .tarMath string to a LaTeX string

The method getPreamble returns a LaTeX %ream le suita le for %rocessing the con2erted formulas.

This small e"am%le is a !asic macro that con2erts a fe, formulas and dis%la*s the result. 4ote that the last con2ersion triggers a definition of the LaTeX macro \defeq in getPreamble(). Dim smc As Object smc = CreateUnoService( _ "org.openoffice.da.writer2latex.W2LStarMathConverter") MsgBox smc.convertFormula("1 over 2") MsgBox smc.convertFormula("int from 1 to infty f(x)dx") MsgBox smc.convertFormula("sqrt 3") MsgBox smc.convertFormula("f(x) def x^2-1") MsgBox smc.getPreamble()

Page $$

User's manual for Writer2LaTeX

9 Troubleshootin!
If *ou ha2e to con2ert a large document: *ou could get the follo,ing error message 8 Exception in thread "main" java.lang.OutOfMemoryError: Java heap space In that case: *ou need to manuall* increase the memor* a2aila le to the Ba2a 2irtual machine: for e"am%le using the follo,ing command to con2ert *our document8 java -Xmx128M -jar writer2latex.jar bigFile.sxw out.tex In the e"am%le: the hea% siCe is set to 120 Mega *te of A7M. If *ou still get the Shea% s%aceK error: tr* setting the a2aila le memor* to 2&' or &12 Mega *te <assuming that *our com%uter has enough %h*sical A7M=. If *ou are using Writer2LaTeX as an e"%ort filter in --o: this %ro lem ,ill result in a generic error message sa*ing that that document could not e ,ritten. To increase the hea% siCe in this case: choose Tools Options OpenO$$ice.or. 6ava. #lic) ,arameters: and add the %arameter -Xmx128M <or higher=. 7 fe, memor* o%timiCations are %lanned for the ne"t 2ersion <1.$=: ,hich should ma)e it %ossi le to con2ert a ,ider range of documents ,ithout increasing the hea% siCe in Ba2a.

You might also like