Difference between revisions of "Writer2Latex"
(6 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
− | '''This page contains several QA regarding [http://www.hj-gym.dk/~hj/writer2latex/ writer2latex] for advanced users. | + | {{Old|EN}} |
+ | [[Category:Extensions]] | ||
+ | '''This page contains several QA regarding [http://www.hj-gym.dk/~hj/writer2latex/ writer2latex] for advanced users. | ||
+ | Most answers reference to the Writer2Latex configuration file.''' A companion page for [[Writer2xhtml]] is also available. | ||
===How to number the reference chapters with letters instead of numbers?=== | ===How to number the reference chapters with letters instead of numbers?=== | ||
− | Insert the following code into the | + | Insert the following code into the Writer2Latex configuration file: |
− | <custom-preamble> | + | <custom-preamble> |
− | \renewcommand\bibsection{\section{\refname}} | + | \renewcommand\bibsection{\section{\refname}} |
− | </custom-preamble> | + | </custom-preamble> |
===How to define the title of the reference chapter to anything instead "References" when using bibtex?=== | ===How to define the title of the reference chapter to anything instead "References" when using bibtex?=== | ||
Line 13: | Line 16: | ||
Define in the configuration file: | Define in the configuration file: | ||
− | <custom-preamble> | + | <custom-preamble> |
− | \AtBeginDocument{\renewcommand\refname{Bibliography}} | + | \AtBeginDocument{\renewcommand\refname{Bibliography}} |
− | </custom-preamble> | + | </custom-preamble> |
===What does the option "htbp" mean?=== | ===What does the option "htbp" mean?=== | ||
Line 21: | Line 24: | ||
They are different placement options: | They are different placement options: | ||
− | h means "put the float here, if there is enough room left on the page" | + | * h means "put the float here, if there is enough room left on the page" |
− | t means "put the float on top of the page" | + | * t means "put the float on top of the page" |
− | b mean "put the float at the bottom of the page" | + | * b mean "put the float at the bottom of the page" |
− | p means "create a special page containing only floats" | + | * p means "create a special page containing only floats" |
the possiblities are tried in the order they are given until a suitable one is found. | the possiblities are tried in the order they are given until a suitable one is found. | ||
Line 37: | Line 40: | ||
You can give LaTeX some more placement options using | You can give LaTeX some more placement options using | ||
− | <option name="float_options" value="htbp" /> | + | <option name="float_options" value="htbp" /> |
However, it's probably a better idea not to float the tables | However, it's probably a better idea not to float the tables | ||
− | <option name="float_tables" value="false" /> | + | <option name="float_tables" value="false" /> |
Perhaps a few experiments will show what you prefer. | Perhaps a few experiments will show what you prefer. | ||
Line 48: | Line 51: | ||
If you have inserted drawing objects directly, they will be ignored. | If you have inserted drawing objects directly, they will be ignored. | ||
− | One solution is to insert an object instead: Insert - object - OLE object - | + | One solution is to insert an object instead: Insert - object - OLE object - OpenOffice Drawing. |
===Which bibtex style exist?=== | ===Which bibtex style exist?=== | ||
Line 58: | Line 61: | ||
Load the package natbib by adding a line to the custom-preamble: | Load the package natbib by adding a line to the custom-preamble: | ||
− | <custom-preamble> | + | <custom-preamble> |
− | \usepackage{natbib} | + | \usepackage{natbib} |
− | </custom-preamble> | + | </custom-preamble> |
Then change the string replace for [[ to: | Then change the string replace for [[ to: | ||
− | <string-replace input="[[" latex-code="\cite[Cp.][]{" /> | + | <string-replace input="[[" latex-code="\cite[Cp.][]{" /> |
This should generate the references you want. | This should generate the references you want. | ||
Line 71: | Line 74: | ||
You can change this line in the LaTeX code | You can change this line in the LaTeX code | ||
− | \hypersetup{colorlinks=true, linkcolor=blue, filecolor=blue, pagecolor=blue, urlcolor=blue} | + | \hypersetup{colorlinks=true, linkcolor=blue, filecolor=blue, pagecolor=blue, urlcolor=blue} |
To | To | ||
− | \hypersetup{colorlinks=true, linkcolor=blue, citecolor=blue, filecolor=blue, pagecolor=blue, urlcolor=blue} | + | \hypersetup{colorlinks=true, linkcolor=blue, citecolor=blue, filecolor=blue, pagecolor=blue, urlcolor=blue} |
or any other color you prefer (eg. black if you don't want to color citations). | or any other color you prefer (eg. black if you don't want to color citations). | ||
Line 84: | Line 87: | ||
For example, add this to the configuration: | For example, add this to the configuration: | ||
− | <custom-preamble> | + | <custom-preamble> |
− | \makeatletter | + | \makeatletter |
− | \renewcommand\paragraph{\@startsection{paragraph}{4}{\z@}%{-3.25ex\@plus -1ex \@minus -.2ex}%{1.5ex \@plus .2ex}%{\normalfont\normalsize\bfseries}} | + | \renewcommand\paragraph{\@startsection{paragraph}{4}{\z@}%{-3.25ex\@plus -1ex \@minus -.2ex}%{1.5ex \@plus .2ex}%{\normalfont\normalsize\bfseries}} |
− | \makeatother | + | \makeatother |
− | </custom-preamble> | + | </custom-preamble> |
The formatting of a the \paragraph will be the same as for \subsubsection (level 3), except that it's without numbering. | The formatting of a the \paragraph will be the same as for \subsubsection (level 3), except that it's without numbering. | ||
Line 94: | Line 97: | ||
===List of tables or list of figures does not work. What to do?=== | ===List of tables or list of figures does not work. What to do?=== | ||
− | If you don't have a list of tables in your document, you will have to help | + | If you don't have a list of tables in your document, you will have to help Writer2Latex to identify the captions: |
− | <option name="table_sequence_name" value="Table" /> | + | <option name="table_sequence_name" value="Table" /> |
− | (the value should be the name of the sequence name in | + | (the value should be the name of the sequence name in OpenOffice). |
Likewise you shoud add | Likewise you shoud add | ||
− | <option name="figures_sequence_name" value="Illustration" /> | + | <option name="figures_sequence_name" value="Illustration" /> |
if you have image captions. | if you have image captions. | ||
Line 110: | Line 113: | ||
It's a simple LaTeX problem; you should always run your document throug TeX twice. | It's a simple LaTeX problem; you should always run your document throug TeX twice. | ||
− | ===How to implement marginal notes with | + | ===How to implement marginal notes with Writer2Latex like the \marginpar{...} in LaTeX?=== |
These can be created quite easily with Writer2LaTeX. | These can be created quite easily with Writer2LaTeX. | ||
Line 117: | Line 120: | ||
With styles: Create a paragraph style called eg. marginpar and add | With styles: Create a paragraph style called eg. marginpar and add | ||
− | <style-map name="marginpar" class="paragraph" before="\marginpar{" after="}" /> | + | <style-map name="marginpar" class="paragraph" before="\marginpar{" after="}" /> |
With text: Add a string-replacement to your configuration, eg. | With text: Add a string-replacement to your configuration, eg. | ||
− | <string-replace input="/margin/" latex-code="\marginpar{" /> | + | <string-replace input="/margin/" latex-code="\marginpar{" /> |
− | <string-prelace input="//" latex-code="}" /> | + | <string-prelace input="//" latex-code="}" /> |
or something similar | or something similar | ||
Then you will write bla bla /margin/This goes to the margin// bla bla... | Then you will write bla bla /margin/This goes to the margin// bla bla... | ||
− | Another alternative is to use notes/annotations in | + | Another alternative is to use notes/annotations in OpenOffice: |
− | <option name="notes" value="marginpar" /> | + | <option name="notes" value="marginpar" /> |
− | In all cases you must ensure that there is sufficient room in the margin; by changing the margin in | + | In all cases you must ensure that there is sufficient room in the margin; by changing the margin in OpenOffice or in the converted LaTeX file. |
− | === | + | ===Is it possible to hack latex code directly in OpenOffice? How to use bibtex with Writer2Latex?=== |
My plan is to keep my bibliographic data in a separate bibtex file and | My plan is to keep my bibliographic data in a separate bibtex file and | ||
use it when creating the PDF from TEX file. Therefore I would like to hack latex | use it when creating the PDF from TEX file. Therefore I would like to hack latex | ||
− | code directly in | + | code directly in OpenOffice such like "\nocite{xyz}" or "\\nocite{xyz}" to |
distinct it from regular text. | distinct it from regular text. | ||
There are several ways to achieve this: | There are several ways to achieve this: | ||
− | * you can create a special character style in | + | * you can create a special character style in OpenOffice, and then configure Writer2Latex to treat this as verbatim LaTeX code |
This character style could for example format the text in boldface, red, to make it easy to see. | This character style could for example format the text in boldface, red, to make it easy to see. | ||
So to insert a reference, you would write \cite{xyz} and then apply your character style to this. | So to insert a reference, you would write \cite{xyz} and then apply your character style to this. | ||
The configuration should contain | The configuration should contain | ||
− | <style-map name="the style name" class="text" before="" after="" verbatim="true" /> | + | <style-map name="the style name" class="text" before="" after="" verbatim="true" /> |
− | * or you can have | + | * or you can have OpenOffice add the LaTeX code, so you only have to write the key |
So to insert a reference, you would write xyz and then apply your character style to this. | So to insert a reference, you would write xyz and then apply your character style to this. | ||
The configuration should contain | The configuration should contain | ||
− | <style-map name="the style name" class="text" before="\cite{" after="}" /> | + | <style-map name="the style name" class="text" before="\cite{" after="}" /> |
− | * or you can use some special text markup, for example you could write <<<xyz>>> in | + | * or you can use some special text markup, for example you could write <<<xyz>>> in OpenOffice to represent a reference |
− | Then instruct | + | Then instruct Writer2Latex to convert this to a reference: |
− | <string-replace input="<<<" latex-code="\cite{" /> | + | <string-replace input="<<<" latex-code="\cite{" /> |
− | <string-replace input=">>>" latex-code="}" /> | + | <string-replace input=">>>" latex-code="}" /> |
* or a variant: Write you citation as \\cite{{xyz}} and use | * or a variant: Write you citation as \\cite{{xyz}} and use | ||
− | <string-replace input="\\" latex-code="\" /> | + | <string-replace input="\\" latex-code="\" /> |
− | <string-replace input="{{" latex-code="{" /> | + | <string-replace input="{{" latex-code="{" /> |
− | <string-replace input="}}" latex-code="}" /> | + | <string-replace input="}}" latex-code="}" /> |
you can insert citations in the text like this, as we previously discussed | you can insert citations in the text like this, as we previously discussed | ||
Line 166: | Line 169: | ||
At the point, where you want the bibliography to appear, you add additional LaTeX code: | At the point, where you want the bibliography to appear, you add additional LaTeX code: | ||
− | \\nocite{{key1,key2}} | + | \\nocite{{key1,key2}} |
− | \\bibliographystyle{{plain}} | + | \\bibliographystyle{{plain}} |
− | \\bibliography{{bibtexfile}} | + | \\bibliography{{bibtexfile}} |
Of course plain should be replaced with the BibTeX style you want to use, and bibtexfile with the name of your file. | Of course plain should be replaced with the BibTeX style you want to use, and bibtexfile with the name of your file. | ||
Line 174: | Line 177: | ||
That should be all. As you probably know, you will have to process the file several times, like this: | That should be all. As you probably know, you will have to process the file several times, like this: | ||
− | pdflatex document | + | pdflatex document |
− | bibtex document | + | bibtex document |
− | pdflatex document | + | pdflatex document |
− | pdflatex document | + | pdflatex document |
Then all your references should be resolved and inserted. | Then all your references should be resolved and inserted. | ||
Line 183: | Line 186: | ||
===How to format the title in the default LaTeX style instead of having the title in a small non-serif font?=== | ===How to format the title in the default LaTeX style instead of having the title in a small non-serif font?=== | ||
− | If your title is formatted with a paragraph style, you can instruct | + | If your title is formatted with a paragraph style, you can instruct Writer2Latex to generate specific code for this, eg. |
− | <style-mape name="the style name in | + | <style-mape name="the style name in OpenOffice" class="paragraph" before="\title{" after="}\maketitle" /> |
You have to use the english name of the text style: | You have to use the english name of the text style: | ||
− | <style-mape name="Title" class="paragraph" before="\title{" | + | <style-mape name="Title" class="paragraph" before="\title{" after="}\maketitle" /> |
− | after="}\maketitle" /> | ||
− | When you use the built in styles, | + | When you use the built in styles, OpenOffice always saves the english style names (to allow better exchange of documents). |
Alternatively | Alternatively | ||
− | <option name="formatting" value="convert_most" /> | + | <option name="formatting" value="convert_most" /> |
which will try to convert more formatting - but this requires a very well structured document. | which will try to convert more formatting - but this requires a very well structured document. | ||
Line 199: | Line 201: | ||
You can change the width by adding e.g. | You can change the width by adding e.g. | ||
− | <custom-preamble> | + | <custom-preamble> |
− | \setlength\arrayrulewidth{0.8pt} | + | \setlength\arrayrulewidth{0.8pt} |
− | </custom-preamble> | + | </custom-preamble> |
to the configuration. The standard width is 0.4pt, so this will double the width. | to the configuration. The standard width is 0.4pt, so this will double the width. | ||
Line 209: | Line 211: | ||
Please try this in the configuration: | Please try this in the configuration: | ||
− | <custom-preamble> | + | <custom-preamble> |
− | \renewcommand\baselinestretch{1.25} | + | \renewcommand\baselinestretch{1.25} |
− | </custom-preamble> | + | </custom-preamble> |
===Why are images not embedded but "Warning: Image ignored" displayed instead?=== | ===Why are images not embedded but "Warning: Image ignored" displayed instead?=== | ||
Please try | Please try | ||
− | <option name="backend" value="pdftex" /> | + | <option name="backend" value="pdftex" /> |
− | <option name="backend" value="unspecified" /> | + | <option name="backend" value="unspecified" /> |
This will include your images. | This will include your images. | ||
− | ===My tables width is too large so that pdflatex displays me several errors that some tables are too | + | ===My tables width is too large so that pdflatex displays me several errors that some tables are too width to fit on the page. What to do?=== |
− | width to fit on the page. What to do?=== | ||
− | If they are too wide, it's probably because you use different margins in | + | If they are too wide, it's probably because you use different margins in OpenOffice and LaTeX. |
You can choose to | You can choose to | ||
− | * change the margins in | + | * change the margins in OpenOffice and adapt the tables to the new margins |
− | * let | + | * let Writer2Latex convert the page layout (<option name="page_formatting" value="convert_all" />) |
− | * let | + | * let Writer2Latex produce tables with l, r and c columns rather than p-columns (<option name="simple_table_limit" value="20" />, or some other number which means that all tables in which no cell contains more that 20 characters will be exported with c, r and l-columns.) |
− | ===Is there a way to tell | + | ===Is there a way to tell Writer2Latex or OpenOffice to turn tables by 90° if required?=== |
No, you will have to manually add sidewaystable to the LaTeX file. | No, you will have to manually add sidewaystable to the LaTeX file. | ||
Line 235: | Line 236: | ||
It should work to add some extra code to your preamble: | It should work to add some extra code to your preamble: | ||
− | <custom-preamble> | + | <custom-preamble> |
− | \AtBeginDocument{\renewcommand\figurename{Illustration}} | + | \AtBeginDocument{\renewcommand\figurename{Illustration}} |
− | </custom-preamble> | + | </custom-preamble> |
For version 0.6 I will add the possibility to set this automatically. | For version 0.6 I will add the possibility to set this automatically. | ||
Line 243: | Line 244: | ||
===How to let text flow around (small) images? === | ===How to let text flow around (small) images? === | ||
− | Text flow around a figure is problematic in LaTeX (that's why I don't try to export this with | + | Text flow around a figure is problematic in LaTeX (that's why I don't try to export this with Writer2Latex). I would recommended the pacakge floatflt.sty for this. |
This requires some manual editing of the LaTeX file: | This requires some manual editing of the LaTeX file: | ||
Add the package to the preamble: | Add the package to the preamble: | ||
− | \usepackage{floatflt} | + | \usepackage{floatflt} |
Replace the relevant | Replace the relevant | ||
− | \begin{figure} | + | \begin{figure} |
− | .... | + | .... |
− | \end{figure} | + | \end{figure} |
with | with | ||
− | \begin{floatingfigure}{5cm} | + | \begin{floatingfigure}{5cm} |
− | .... | + | .... |
− | \end{floatingfigure} | + | \end{floatingfigure} |
(replacing 5cm with the actual width of the figure) | (replacing 5cm with the actual width of the figure) | ||
Line 268: | Line 269: | ||
You can center the tables as well in your document or: | You can center the tables as well in your document or: | ||
− | You can left justify all captions. | + | You can left justify all captions. Writer2Latex currently use a version called caption2, which is obsolete and replaced with a version called caption (this is actually version3). Writer2Latex will be fixed to use the never version of caption.sty soon. |
Configure: | Configure: | ||
− | <option name="use_caption2" value="true" /> | + | <option name="use_caption2" value="true" /> |
Then you should add to your custom preamble: | Then you should add to your custom preamble: | ||
− | <custom-preamble> | + | <custom-preamble> |
− | \captionsetup[table]{justification=raggedright,singlelinecheck=false} | + | \captionsetup[table]{justification=raggedright,singlelinecheck=false} |
− | </custom-preamble> | + | </custom-preamble> |
But you also need to edit the LaTeX file and replace | But you also need to edit the LaTeX file and replace | ||
− | \usepackage{caption2} | + | \usepackage{caption2} |
with | with | ||
− | \usepackage{caption} | + | \usepackage{caption} |
===A table could easily break particular cells in two or more lines but exceeds the page width instead. How to fix it?=== | ===A table could easily break particular cells in two or more lines but exceeds the page width instead. How to fix it?=== | ||
You should lower the value of the option simple_table_limit, for example | You should lower the value of the option simple_table_limit, for example | ||
− | <option name="simple_table_limit" value="25" /> | + | <option name="simple_table_limit" value="25" /> |
If all cells in a table contains at most this number of characters, they will be exported as simple tables with one line per cell. | If all cells in a table contains at most this number of characters, they will be exported as simple tables with one line per cell. | ||
Line 310: | Line 311: | ||
1. Change the backend option to dvips | 1. Change the backend option to dvips | ||
− | <option name="backend" value="dvips" /> | + | <option name="backend" value="dvips" /> |
and then export your document. This will generate an eps-file with your diagram. | and then export your document. This will generate an eps-file with your diagram. | ||
Line 316: | Line 317: | ||
3. Change the backend top pdftex again | 3. Change the backend top pdftex again | ||
− | <option name="backend" value="dvips" /> | + | <option name="backend" value="dvips" /> |
and make sure also to include this option: | and make sure also to include this option: | ||
<option name="remove_graphics_extension" value="true" /> | <option name="remove_graphics_extension" value="true" /> | ||
− | The next time you export your document again, | + | The next time you export your document again, Writer2Latex will generate a png-file with your diagram. |
Delete the png file before running the document through LaTeX: PdfTeX will then find the pdf version of the image and include it. | Delete the png file before running the document through LaTeX: PdfTeX will then find the pdf version of the image and include it. | ||
This is not very elegant - of course I will implement automatic conversion of vector images to pdf later. This will not be fixed in version 0.5, but it's on my list for version 0.6. | This is not very elegant - of course I will implement automatic conversion of vector images to pdf later. This will not be fixed in version 0.5, but it's on my list for version 0.6. |
Latest revision as of 12:37, 9 July 2018
| RU = Статья устарела. | UA = Статья устарела. | EN = This article is outdated. | PT = Este artigo está desatualizado. | #default = This article is outdated.
}}{{#if: | |}}
This page contains several QA regarding writer2latex for advanced users. Most answers reference to the Writer2Latex configuration file. A companion page for Writer2xhtml is also available.
How to number the reference chapters with letters instead of numbers?
Insert the following code into the Writer2Latex configuration file:
<custom-preamble> \renewcommand\bibsection{\section{\refname}} </custom-preamble>
How to define the title of the reference chapter to anything instead "References" when using bibtex?
Define in the configuration file:
<custom-preamble> \AtBeginDocument{\renewcommand\refname{Bibliography}} </custom-preamble>
What does the option "htbp" mean?
They are different placement options:
- h means "put the float here, if there is enough room left on the page"
- t means "put the float on top of the page"
- b mean "put the float at the bottom of the page"
- p means "create a special page containing only floats"
the possiblities are tried in the order they are given until a suitable one is found.
pdftex is not able to process my file without errors anymore: "LaTeX Error: Too many unprocessed floats." What to do?
This is a well known problem with LaTeX when there is a huge amount of floats.
You can give LaTeX some more placement options using
<option name="float_options" value="htbp" />
However, it's probably a better idea not to float the tables
<option name="float_tables" value="false" />
Perhaps a few experiments will show what you prefer.
I found out that draw objects are not included in Latex. The message "Warning: Draw object ignored" appears instead. Is there a way to include them?
If you have inserted drawing objects directly, they will be ignored. One solution is to insert an object instead: Insert - object - OLE object - OpenOffice Drawing.
Which bibtex style exist?
There's a long list on http://www.cs.stir.ac.uk/~kjt/software/latex/showbst.html
How to use bibtex with references of the type (Cp. XYZ)?
Load the package natbib by adding a line to the custom-preamble:
<custom-preamble> \usepackage{natbib} </custom-preamble>
Then change the string replace for [[ to:
<string-replace input="[[" latex-code="\cite[Cp.][]{" />
This should generate the references you want.
How to prevent that URLs are displayed in blue and references in green?
You can change this line in the LaTeX code
\hypersetup{colorlinks=true, linkcolor=blue, filecolor=blue, pagecolor=blue, urlcolor=blue}
To
\hypersetup{colorlinks=true, linkcolor=blue, citecolor=blue, filecolor=blue, pagecolor=blue, urlcolor=blue}
or any other color you prefer (eg. black if you don't want to color citations).
How to change heading of level 4 to look like a "real" heading?
For example, add this to the configuration:
<custom-preamble> \makeatletter \renewcommand\paragraph{\@startsection{paragraph}{4}{\z@}%{-3.25ex\@plus -1ex \@minus -.2ex}%{1.5ex \@plus .2ex}%{\normalfont\normalsize\bfseries}} \makeatother </custom-preamble>
The formatting of a the \paragraph will be the same as for \subsubsection (level 3), except that it's without numbering.
List of tables or list of figures does not work. What to do?
If you don't have a list of tables in your document, you will have to help Writer2Latex to identify the captions:
<option name="table_sequence_name" value="Table" />
(the value should be the name of the sequence name in OpenOffice).
Likewise you shoud add
<option name="figures_sequence_name" value="Illustration" />
if you have image captions.
My resulting document has wrong counting of page numbers. What to do?
It's a simple LaTeX problem; you should always run your document throug TeX twice.
How to implement marginal notes with Writer2Latex like the \marginpar{...} in LaTeX?
These can be created quite easily with Writer2LaTeX.
Again you can either use styles or text content:
With styles: Create a paragraph style called eg. marginpar and add
<style-map name="marginpar" class="paragraph" before="\marginpar{" after="}" />
With text: Add a string-replacement to your configuration, eg.
<string-replace input="/margin/" latex-code="\marginpar{" /> <string-prelace input="//" latex-code="}" />
or something similar Then you will write bla bla /margin/This goes to the margin// bla bla...
Another alternative is to use notes/annotations in OpenOffice:
<option name="notes" value="marginpar" />
In all cases you must ensure that there is sufficient room in the margin; by changing the margin in OpenOffice or in the converted LaTeX file.
Is it possible to hack latex code directly in OpenOffice? How to use bibtex with Writer2Latex?
My plan is to keep my bibliographic data in a separate bibtex file and use it when creating the PDF from TEX file. Therefore I would like to hack latex code directly in OpenOffice such like "\nocite{xyz}" or "\\nocite{xyz}" to distinct it from regular text.
There are several ways to achieve this:
- you can create a special character style in OpenOffice, and then configure Writer2Latex to treat this as verbatim LaTeX code
This character style could for example format the text in boldface, red, to make it easy to see. So to insert a reference, you would write \cite{xyz} and then apply your character style to this. The configuration should contain
<style-map name="the style name" class="text" before="" after="" verbatim="true" />
- or you can have OpenOffice add the LaTeX code, so you only have to write the key
So to insert a reference, you would write xyz and then apply your character style to this. The configuration should contain
<style-map name="the style name" class="text" before="\cite{" after="}" />
- or you can use some special text markup, for example you could write <<<xyz>>> in OpenOffice to represent a reference
Then instruct Writer2Latex to convert this to a reference:
<string-replace input="<<<" latex-code="\cite{" /> <string-replace input=">>>" latex-code="}" />
- or a variant: Write you citation as \\citeTemplate:Xyz and use
<string-replace input="\\" latex-code="\" /> <string-replace input="{{" latex-code="{" /> <string-replace input="}}" latex-code="}" />
you can insert citations in the text like this, as we previously discussed
Bla bla bla ses the reference \\cite {{#switch:{{{1}}} | shift = ⇧ Shift | up = ↑ | down = ↓ | > = → | < = ← | enter = ↵ Enter | cmd = ⌘ Cmd | command = ⌘ Cmd | opt = ⌥ Opt | option = ⌥ Opt | tab = Tab ⇆ | backspace = ← Backspace | << = ← Backspace | bs = ← Backspace | * = * | # = # | ; = ; | : = : | #default = {{{1}}} }} {{#if:| + {{#switch:{{{2}}} | shift = ⇧ Shift | up = ↑ | down = ↓ | > = → | < = ← | enter = ↵ Enter | cmd = ⌘ Cmd | command = ⌘ Cmd | opt = ⌥ Opt | option = ⌥ Opt | tab = Tab ⇆ | backspace = ← Backspace | << = ← Backspace | bs = ← Backspace | * = * | # = # | ; = ; | : = : | #default = {{{2}}} }} }}{{#if:| + {{#switch:{{{3}}} | shift = ⇧ Shift | up = ↑ | down = ↓ | > = → | < = ← | enter = ↵ Enter | cmd = ⌘ Cmd | command = ⌘ Cmd | opt = ⌥ Opt | option = ⌥ Opt | tab = Tab ⇆ | backspace = ← Backspace | << = ← Backspace | bs = ← Backspace | * = * | # = # | ; = ; | : = : | #default = {{{3}}} }} }}{{#if:| + {{#switch:{{{4}}} | shift = ⇧ Shift | up = ↑ | down = ↓ | > = → | < = ← | enter = ↵ Enter | cmd = ⌘ Cmd | command = ⌘ Cmd | opt = ⌥ Opt | option = ⌥ Opt | tab = Tab ⇆ | backspace = ← Backspace | << = ← Backspace | bs = ← Backspace | * = * | # = # | ; = ; | : = : | #default = {{{4}}} }} }}{{#if:| + {{#switch:{{{5}}} | shift = ⇧ Shift | up = ↑ | down = ↓ | > = → | < = ← | enter = ↵ Enter | cmd = ⌘ Cmd | command = ⌘ Cmd | opt = ⌥ Opt | option = ⌥ Opt | tab = Tab ⇆ | backspace = ← Backspace | << = ← Backspace | bs = ← Backspace | * = * | # = # | ; = ; | : = : | #default = {{{5}}} }} }}{{#if:| + {{#switch:{{{6}}} | shift = ⇧ Shift | up = ↑ | down = ↓ | > = → | < = ← | enter = ↵ Enter | cmd = ⌘ Cmd | command = ⌘ Cmd | opt = ⌥ Opt | option = ⌥ Opt | tab = Tab ⇆ | backspace = ← Backspace | << = ← Backspace | bs = ← Backspace | * = * | # = # | ; = ; | : = : | #default = {{{6}}} }} }}, bla bla bla.
At the point, where you want the bibliography to appear, you add additional LaTeX code:
\\nociteTemplate:Key1,key2 \\bibliographystyleTemplate:Plain \\bibliographyTemplate:Bibtexfile
Of course plain should be replaced with the BibTeX style you want to use, and bibtexfile with the name of your file.
That should be all. As you probably know, you will have to process the file several times, like this:
pdflatex document bibtex document pdflatex document pdflatex document
Then all your references should be resolved and inserted.
How to format the title in the default LaTeX style instead of having the title in a small non-serif font?
If your title is formatted with a paragraph style, you can instruct Writer2Latex to generate specific code for this, eg.
<style-mape name="the style name in OpenOffice" class="paragraph" before="\title{" after="}\maketitle" />
You have to use the english name of the text style:
<style-mape name="Title" class="paragraph" before="\title{" after="}\maketitle" />
When you use the built in styles, OpenOffice always saves the english style names (to allow better exchange of documents).
Alternatively
<option name="formatting" value="convert_most" />
which will try to convert more formatting - but this requires a very well structured document.
How to change the width of table borders?
You can change the width by adding e.g.
<custom-preamble> \setlength\arrayrulewidth{0.8pt} </custom-preamble>
to the configuration. The standard width is 0.4pt, so this will double the width.
how could I define 1.5 line spacing instead of the default one?
Please try this in the configuration:
<custom-preamble> \renewcommand\baselinestretch{1.25} </custom-preamble>
Why are images not embedded but "Warning: Image ignored" displayed instead?
Please try
<option name="backend" value="pdftex" /> <option name="backend" value="unspecified" />
This will include your images.
My tables width is too large so that pdflatex displays me several errors that some tables are too width to fit on the page. What to do?
If they are too wide, it's probably because you use different margins in OpenOffice and LaTeX. You can choose to
- change the margins in OpenOffice and adapt the tables to the new margins
- let Writer2Latex convert the page layout (<option name="page_formatting" value="convert_all" />)
- let Writer2Latex produce tables with l, r and c columns rather than p-columns (<option name="simple_table_limit" value="20" />, or some other number which means that all tables in which no cell contains more that 20 characters will be exported with c, r and l-columns.)
Is there a way to tell Writer2Latex or OpenOffice to turn tables by 90° if required?
No, you will have to manually add sidewaystable to the LaTeX file.
It should work to add some extra code to your preamble:
<custom-preamble> \AtBeginDocument{\renewcommand\figurename{Illustration}} </custom-preamble>
For version 0.6 I will add the possibility to set this automatically.
How to let text flow around (small) images?
Text flow around a figure is problematic in LaTeX (that's why I don't try to export this with Writer2Latex). I would recommended the pacakge floatflt.sty for this.
This requires some manual editing of the LaTeX file:
Add the package to the preamble:
\usepackage{floatflt}
Replace the relevant
\begin{figure} .... \end{figure}
with
\begin{floatingfigure}{5cm} .... \end{floatingfigure}
(replacing 5cm with the actual width of the figure)
However: For this to work well there has to be a certain amount of text around the figure, and there must be no lists or headings immediately after the figure. Thus there's a chance that 12 small images and not a lot of text will give you trouble.
You can center the tables as well in your document or:
You can left justify all captions. Writer2Latex currently use a version called caption2, which is obsolete and replaced with a version called caption (this is actually version3). Writer2Latex will be fixed to use the never version of caption.sty soon.
Configure:
<option name="use_caption2" value="true" />
Then you should add to your custom preamble:
<custom-preamble> \captionsetup[table]{justification=raggedright,singlelinecheck=false} </custom-preamble>
But you also need to edit the LaTeX file and replace
\usepackage{caption2}
with
\usepackage{caption}
A table could easily break particular cells in two or more lines but exceeds the page width instead. How to fix it?
You should lower the value of the option simple_table_limit, for example
<option name="simple_table_limit" value="25" />
If all cells in a table contains at most this number of characters, they will be exported as simple tables with one line per cell. This creates slightly better results for these tables, but if the value is too large you will get the results, you see in your example.
The background of embedded images with a transparent background is rendered colourful. How to fix it?
Yes, unfortunately pdfTeX does not support transparent backgrounds, so you have to edit it with some external image tool to replace the transparent color with white.
When processing pdflatex it warns me "No author given". What to do?
This is harmless; it's a warning that there is not given an author name to add below the title.
Charts inserted as OLE objects are rendered "ugly", look like bitmaps and not as vector charts. How to render charts properly?
That's right - in fact the whole diagram is exported as a bitmap. I should really export it as pdf, but this is not yet implemented. Here's a workaround for this problem:
You can create a pdf version as follows:
1. Change the backend option to dvips
<option name="backend" value="dvips" />
and then export your document. This will generate an eps-file with your diagram.
2. Convert this file to pdf using ghostscript/ghostview
3. Change the backend top pdftex again
<option name="backend" value="dvips" />
and make sure also to include this option: <option name="remove_graphics_extension" value="true" />
The next time you export your document again, Writer2Latex will generate a png-file with your diagram. Delete the png file before running the document through LaTeX: PdfTeX will then find the pdf version of the image and include it.
This is not very elegant - of course I will implement automatic conversion of vector images to pdf later. This will not be fixed in version 0.5, but it's on my list for version 0.6.