Package writer2latex.latex
Class MathConverter
- java.lang.Object
-
- writer2latex.latex.ConverterHelper
-
- writer2latex.latex.MathConverter
-
public final class MathConverter extends ConverterHelper
This ConverterHelper converts mathematical content to LaTeX. It works slightly different than the other helpers: A number of elements may or may not have content that should be converted to math. Thus the methods offered first examines the content. If it turns out to be a mathematical formula, it is converted. Otherwise nothing is done, and the method returns false. Mathematical content may be MathML (with StarMath annotation), TexMaths or (the now obsolete) OOoLaTeX
-
-
Field Summary
-
Fields inherited from class writer2latex.latex.ConverterHelper
config, ofr, palette
-
-
Constructor Summary
Constructors Constructor Description MathConverter(OfficeReader ofr, LaTeXConfig config, ConverterPalette palette)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
appendDeclarations(LaTeXDocumentPortion pack, LaTeXDocumentPortion decl)
java.lang.String
convert(org.w3c.dom.Element formula)
boolean
handleDisplayEquation(org.w3c.dom.Element node, LaTeXDocumentPortion ldp)
Try to convert a paragraph as a display equation: A paragraph which contains exactly one formula + at most one sequence number is treated as a display equation.boolean
handleDisplayEquation(TableReader table, LaTeXDocumentPortion ldp)
Try to convert a table as a display equation: A 1 row by 2 columns table in which each cell contains exactly one paragraph, the left cell contains exactly one formula and the right cell contains exactly one sequence number is treated as a (numbered) display equation.boolean
handleTexMathsEquation(org.w3c.dom.Element node, LaTeXDocumentPortion ldp)
Try to convert a draw:frame or draw:g element as an (inline) TexMaths or OOoLaTeX equation
-
-
-
Constructor Detail
-
MathConverter
public MathConverter(OfficeReader ofr, LaTeXConfig config, ConverterPalette palette)
-
-
Method Detail
-
appendDeclarations
public void appendDeclarations(LaTeXDocumentPortion pack, LaTeXDocumentPortion decl)
- Overrides:
appendDeclarations
in classConverterHelper
-
convert
public java.lang.String convert(org.w3c.dom.Element formula)
-
handleTexMathsEquation
public boolean handleTexMathsEquation(org.w3c.dom.Element node, LaTeXDocumentPortion ldp)
Try to convert a draw:frame or draw:g element as an (inline) TexMaths or OOoLaTeX equation- Parameters:
node
- the element containing the equation (draw:frame or draw:g)ldp
- the LaTeXDocumentPortion to contain the converted equation- Returns:
- true if this elements happen to be a TexMaths equation, otherwise false
-
handleDisplayEquation
public boolean handleDisplayEquation(TableReader table, LaTeXDocumentPortion ldp)
Try to convert a table as a display equation: A 1 row by 2 columns table in which each cell contains exactly one paragraph, the left cell contains exactly one formula and the right cell contains exactly one sequence number is treated as a (numbered) display equation. This happens to coincide with the AutoText provided with OOo Writer :-)- Parameters:
table
- the table readerldp
- the LaTeXDocumentPortion to contain the converted equation- Returns:
- true if the conversion was successful, false if the table did not represent a display equation
-
handleDisplayEquation
public boolean handleDisplayEquation(org.w3c.dom.Element node, LaTeXDocumentPortion ldp)
Try to convert a paragraph as a display equation: A paragraph which contains exactly one formula + at most one sequence number is treated as a display equation. Other content must be brackets or whitespace (possibly with formatting).- Parameters:
node
- the paragraphldp
- the LaTeXDocumentPortion to contain the converted equation- Returns:
- true if the conversion was successful, false if the paragraph did not contain a display equation
-
-