michal-h21 / make4ht

Build system for tex4ht
141 stars 15 forks source link

Error in odt conversion: Format error in the file, in the styles.xml #107

Closed danielezambelli closed 1 year ago

danielezambelli commented 1 year ago

I get an error when I try to convert from LaTeX to odt.

For example:

% 8<----------------------------------------------------------------- % !TEX encoding = UTF-8 Unicode % make4ht -f odt+odttemplate main.tex "odttemplate=template.odt"

\documentclass[a4paper, 12pt, gray]{book} \usepackage[italian]{babel} \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc}

\begin{document}

\chapter{odt test} When I compile this text with: \

make4ht -f odt+odttemplate main.tex "odttemplate=template.odt"\

the compilation is successful, but when I try to open the file, LibreOffice gives me the error:\

\noindent Read Error.\ Format error in the file, in the styles.xml sub-document in 341,137(line,col).\

The closing of some double quotes is missing. For example I get:

\noindent [\dots] style:font-size-asian="115\%style:font-weight-asian="bold" [\dots]

instead of:

\noindent [\dots] style:font-size-asian="115\%" style:font-weight-asian="bold" [\dots]

\section{Info}

make4ht version v0.3l\

Version: 7.4.5.1 / LibreOffice Community\ Build ID: 40(Build:1)\ CPU threads: 4; OS: Linux 6.1; UI render: default; VCL: x11\ Locale: it-IT (it_IT.UTF-8); UI: it-IT\ Debian package version: 4:7.4.5-2\ Calc: threaded

\end{document} % ----------------------------------------------------------------->8

Thanks for your work.

michal-h21 commented 1 year ago

Thanks for the report. This is a known error. I've fixed it a few weeks ago, so it is possible that the fix is not available in your distribution yet. With up-to-date TeX Live, I don't get errors.

einhander commented 1 year ago

Hmm, @michal-h21 I builded latest git version, but have the same error with styles.xml on following tex file:

\documentclass{article}
\begin{document}
    Lorem ipsum
\end{document}

Is git version of make4ht use system TexLive components that cause that error?

michal-h21 commented 1 year ago

This was fixed in TeX4ht sources, so an update of make4ht alone doesn't help. It is possible that TeX Live packages of your distro don't contain the most recent version of ooffice.4ht. It should start with:

% ooffice.4ht (2023-01-24-13:16), generated from tex4ht-ooffice.tex
einhander commented 1 year ago

% ooffice.4ht (2023-01-24-13:16), generated from tex4ht-ooffice.tex

That was close, I have:

% ooffice.4ht (2023-01-19-13:31), generated from tex4ht-ooffice.tex

I'll return as soon as my distro upgrades TeXLive version.

michal-h21 commented 1 year ago

Ah, version from 2023-01-19 is particularly bad, because it introduced XML errors. The version from 24th January fixed those.

hpreusse commented 1 year ago

@michal-h21: Is it possible to just replace the file ooffice.4ht or will this breaks other things? Due to the progress in Debian release cycle I won't package another snapshot of TeX Live. Thanks!

michal-h21 commented 1 year ago

Sure, it should probably work. Just find the location of ooffice.4ht using:

 $ kpsewhich ooffice.4ht

Here is the current version:

ooffice.zip

hpreusse commented 1 year ago

Many thanks, I have the file: it it located on the next CTAN mirror. Currently I'm building new Debian packages.

einhander commented 1 year ago

Sure, it should probably work.

I can confirm, replace ooffice.4ht with new version solves the issue.

hpreusse commented 1 year ago

@danielezambelli @einhander @michal-h21: I've uploaded the fix to Debian unstable and can confirm that the issue is solved. I pinged the release team, so chances are good, that we have the fix in bookworm. This issue here shoukd be closed.

michal-h21 commented 1 year ago

Great, thanks!