Conversion from LO formula to Tex/LaTex

To whom it may concern,

I’m about to finish a series of mathematical proofs on Wikipedia of the various Trachtenbeg methods.

I use the formula writing in LO Writer. Alas I’m not keen on Tex/LaTex and I gave up trying to convert an LO formula.
Is there a translator somewhere - which is not based on JAVA ?? (I’m very reluctant to install JAVA).

THX in advance/René

There are some extension, that maybe can help.
https://extensions.libreoffice.org/en/extensions/show/writer2latex-1
https://extensions.libreoffice.org/en/extensions/show/texmaths-1

Thx a lot. The first suggestion, unfortunately, uses JAVA, which I try hard to avoid…
I shall give the second one a try.

/René

-------- Oprindelig besked --------

but the second is using an installed TeX to create a picture of the formula to insert in LibreOffice - not the reverse way you seem to ask for.
.
Why do you have trouble with java ?

I have No trouble with JAVA. But being an enduser, I don’t want it because of security/vulnerability…
A bit nerdy perhaps.

/René

-------- Oprindelig besked --------

Which issues with security/vuknerability? Java is not ActiveX. The times of Java applets running in (and escaping from) browsers are over. Local Java applications impose no higher risk than any other application.

Sorry, I got it wrong as of where to ask (post now deleted) - hereby:

Continuing the discussion from Conversion from LO formula to Tex/LaTex:

Hi all, and THX for all your suggestions.
Having followed a very log and winding road on installing JAVA JRE (without vulnerabilities, as they say now a days), LaTex fonts, babel et al. I’m back to square one.

First of all, I can only “LaTex” english text to PDF.
I’ve found no way to get a LaTex formula, to put into Wikipedia.

Further suggestions ?

You did this directly in TeX? Or from Writer2Latex-Extension? If you used the extension for a YourFile.odt there should now exist a YourFile.tex wich you can search for the source.
.
If your Writer-File included a Formula it is omitted??
.
Could you upload a sample from your .odt here? As you intend to post on Wikipedia there should not be a problem with privacy…
Maybe give us a shortened copy.

Maybe a solution possible, if you can save a formula in MatML first:

I found out, that I needed yet another module named teckit.

Now I do get a file with some kind of LaTex:

\begin{gathered}R=T\ast 2\Leftrightarrow \{}\R=2\ast
(10^{(n-1)}\ast c_n+…+10^0\ast c_1)\Leftrightarrow \{}\R=10^{(n-1)}\ast 2\ast c_n+…+10^0\ast 2\ast
c_1\{}\\mathit{QED}\end{gathered}

When I paste this into Wiki I get an errormessage saying:
**Failed to parse (unknown function “\begin{gathered}”): {\displaystyle \begin{gathered}R=T\ast 2\Leftrightarrow \{}\R=2\ast (10^{(n-1)}\ast c_n+…+10^0\ast c_1)\Leftrightarrow \{}\R=10^{(n-1)}\ast 2\ast c_n+…+10^0\ast 2\ast c_1\{}\\mathit{QED}\end{gathered}}

Same-same if I replace \begin{gathered} … \end{gathered} with \begin{math} … \end{math}, which I think are the proper LaTex tags ?

So due to your patient help we are getting close now - I think.

PS. The LO math is:
R = T2 dlrarrow
newline
newline
R = 2
(10^(n-1)c_{n} + … + 10^0c_{1}) dlrarrow
newline
newline
R = 10^(n-1)2c_{n} + … + 10^02c_{1}
newline
newline
QED

It is a long time since I used TeX a lot… I would remove the \begin{gathered} and the \end{gathered}
and replace both with a $-sign, as the $ is the typical “math-mode” in TeX - especially as you seem to intend to put the formula in wikipedia. (Do they have an interpreter for tex-formula ?)
.
The other way round: I would assume gathered is in an additional .sty-file by Writer2Latex and you have to find out, why it is not found…

THX again - I shall try to sort it out.

I’ve tried, to no avail, to use $ … $, ( … ) and \begin{math} … \end{math}.

Also, if I paste the piece of formula from the generated .tex file back to LO, it does interpret all correctly, leaving section af question marks (???).

I just installed the Writer2LaTeX extension and tried with an arbitrary formula embedded in a Writer document. Math window vs. DVI viewer on the left:


and this is the Math formula:

size 28 nospace { matrix{
alignr nospace{int f(x)dx} # {}={} # alignl {alignc nospace{ 2 x^2 + 3 x - 1 }} over  {alignc {x^{1/3}}}dx ##
alignr {} # {}={} # alignl int left({ alignc {nospace{2 x^2} over {x^{1/3}} } + { nospace{3 x} over {x^{1/3}} } - { {1} over {x^{1/3}}} }right)dx ##
alignr {} # {}={} # alignl int (nospace{2 x^{5/3} + 3 x^{2/3} - x^{1/3}})dx ##
alignr {} # {}={} # alignl 2 cdot { alignc{{3} over {8}} } x^{8/3} + 3 cdot { alignc{ {3} over {5}} } x^{5/3} - 3 cdot { alignc{{3} over {2} }} x^{2/3} + C ##
alignr {} # {}={} # alignl {} { alignc {{3} over {4}} } x^{8/3} + { alignc{{9} over {5}} } x^{5/3} - { alignc{{3} over {2}} } x^{2/3} + C} }

Nice - is there some versioning between Windows and (Debian) Linux ???

Maybe, if you could cut just the formula from Math in LON and mail it to me for a try ???

The LibreOffice Math formula is the one below my screenshot.
The LaTeX code goes like this:

% This file was converted to LaTeX by Writer2LaTeX ver. 1.6.1
% see http://writer2latex.sourceforge.net for more info
\documentclass[a4paper,landscape]{article}
\usepackage[latin1]{inputenc}
\usepackage{amsmath}
\usepackage{amssymb,amsfonts,textcomp}
\usepackage[T1]{fontenc}
\usepackage[english,magyar]{babel}
\usepackage{color}
\usepackage{array}
\usepackage{hhline}
\usepackage{hyperref}
\hypersetup{pdftex, colorlinks=true, linkcolor=blue, citecolor=blue, filecolor=blue, urlcolor=blue, pdftitle=, pdfauthor=Andreas Säger, pdfsubject=, pdfkeywords=}
% Page layout (geometry)
\setlength\voffset{-1in}
\setlength\hoffset{-1in}
\setlength\topmargin{2cm}
\setlength\oddsidemargin{2cm}
\setlength\textheight{17.001cm}
\setlength\textwidth{25.7cm}
\setlength\footskip{0.0cm}
\setlength\headheight{0cm}
\setlength\headsep{0cm}
% Footnote rule
\setlength{\skip\footins}{0.119cm}
\renewcommand\footnoterule{\vspace*{-0.018cm}\setlength\leftskip{0pt}\setlength\rightskip{0pt plus 1fil}\noindent\textcolor{black}{\rule{0.25\columnwidth}{0.018cm}}\vspace*{0.101cm}}
% Pages styles
\makeatletter
\newcommand\ps@Standard{
  \renewcommand\@oddhead{}
  \renewcommand\@evenhead{}
  \renewcommand\@oddfoot{}
  \renewcommand\@evenfoot{}
  \renewcommand\thepage{\arabic{page}}
}
\makeatother
\pagestyle{Standard}
\title{}
\author{Andreas Säger}
\date{2022-09-12}
\begin{document}
Text body


\bigskip

\begin{equation*}
{\begin{matrix}\hfill {\int f(x)\mathit{dx}}&=&\frac{{2x^2+3x-1}}{x^{1/3}}\mathit{dx}\hfill\null \\\hfill &=&\int
\left(\frac{{2x^2}}{x^{1/3}}+\frac{{3x}}{x^{1/3}}-\frac 1{x^{1/3}}\right)\mathit{dx}\hfill\null \\\hfill &=&\int
({2x^{5/3}+3x^{2/3}-x^{1/3}})\mathit{dx}\hfill\null \\\hfill &=&2\cdot \frac 3 8x^{8/3}+3\cdot \frac 3 5x^{5/3}-3\cdot
\frac 3 2x^{2/3}+C\hfill\null \\\hfill &=&\frac 3 4x^{8/3}+\frac 9 5x^{5/3}-\frac 3 2x^{2/3}+C\hfill\null \end{matrix}}
\end{equation*}

\bigskip


\bigskip


\bigskip
\end{document}

THX a lot for the “formula code”
Unfortunately - neither LO (v. 7.4.1.1 or 7.5DEV) nor Wikipedia Math section can handle the “formula code”.
In LO there are still lots of “upside down” question marks - and Wiki still cannot parse it.

I’m about to give up, I’m afraid.

Works for me with OpenOffice 4.1.11, LibreOffice 6.0, 7.2, 7.3
I can’t run 7.4 for now.

Here is the formula embedded in a Writer document which I could export to LaTeX after installing the Writer2Latex extension:
test.odt (15.7 KB)

THX for your vast help.

It works for me too in LO Math - just pasted it into the OLE object window and got the formula right away.

Well, THX all for kind and patient guidance.

The solution is to edit Wiki formulas by hand.
I’ve found no way to automate/filter the operation.

Starting point, LO Math
R = T*2 dlrarrow
newline
newline
R = 2*(10^(n-1)*c_{n} + … + 10^0*c_{1}) dlrarrow
newline
newline
R = 10^(n-1)*2*c_{n} + … + 10^0*2*c_{1}
newline
newline
QED

Via Writer2LaTex
$\begin{gathered}R=T\ast 2\Leftrightarrow \{}\R=2\ast
(10^{(n-1)}\ast c_n+…+10^0\ast c_1)\Leftrightarrow \{}\R=10^{(n-1)}\ast 2\ast c_n+…+10^0\ast 2\ast
c_1\{}\\mathit{QED}\end{gathered}$

Finishing in Wiki, by writing by hand
<math>
R = T*2 \Leftrightarrow

R = 2*(10^{n-1}*c_{n} + \ldots + 10^0*c_{1}) \Leftrightarrow

R = 10^{n-1}*2*c_{n} + \ldots + 10^0*2*c_{1}

QED
</math>

To be extremely nerdy and precise, there are 3 ways of putting a formula into Wiki. I ended up with the LaTex like one, like this:

<div style=“text-align: center;”>
<math display=“inline”>
\begin{align}
R & = T2 \Leftrightarrow \
R & = 2
(10^{n-1}c_{n} + \ldots + 10^0c_{1}) \Leftrightarrow \\
R & = 10^{n-1}2c_{n} + \ldots + 10^02c_{1} \\
\\
& QED
end{align}
</math>
</div>