bugtex4ht - Bugs: bug #172, oolatex: Spurious spaces after...

Show feedback again

You are not allowed to post comments on this tracker with your current authentification level.

bug #172: oolatex: Spurious spaces after cross references and citations

Submitted by:  Kirill Müller <muelleki>
Submitted on:  Thu Dec 13 14:17:09 2012  
Votes:  10  
Category: NonePriority: 5 - Normal
Severity: 5 - NormalStatus: None
Privacy: PublicAssigned to: None
Open/Closed: Closed

Fri Nov 3 10:50:08 2023, comment #3:

I've tried this MWE and while the original issue was fixed, some more appeared over the years. But everything should be OK now.

Michal Hoftich <michal_h21>
Project Member
Thu Oct 25 21:59:51 2018, comment #2:

Thank you for the report, the original issue indeed seems to be fixed.

The footnote issue can be fixed without need to use sed. I cannot find the source of the spurious spaces, but tex4ht can be instructed to ignore spaces using the \special{t4ht@)} command. I've added this command to the footnote configuration in the ooffice configuration file and it seems to fix the issue.

BTW, it is better to use

make4ht -f odt filename.tex

instead of the old mk4ht oolatex, it fixes lot of issues with file names, Unicode and it also supports filtering of the XML files before the xt-pipes processing. See https://tex.stackexchange.com/a/447968/2891 for example.

The additional information about tex4ht \special commands can be found for example here: https://www.kodymirus.cz/src4ht/tex4ht-moz18.html

Michal Hoftich <michal_h21>
Project Member
Thu Oct 25 19:29:44 2018, comment #1:

I can't confirm the behaviour for \ref{} and \cite{} but only for \footnote{} and \footcite{}.

In those cases, there is a possibility for a dirty workaround:

$ cat /usr/share/texmf/tex4ht/base/unix/tex4ht.env | sed -E "s:(4oo.+)(mv):\1sed -E 's/( )\{2,\}(<t4htlink)/\\\\2/g':g" > ~/texmf/tex4ht/base/unix/tex4ht.env && mktexlsr

This changes the "packing" behaviour of "-coo" to not just move the generated content.xml, but to replace the unwanted whitespaces first. For my usecase this seems to work. (Make sure the paths are correct and exist on your system and that you don't override already existing custom settings on your system!)

This workaround is based on some assumptions:

1. The Bug seems to be fixed for \ref and \cite
2. But it is still present for footnotes
3. A single whitespace before a link tag is valid and there because the TeX-Author wanted it
4. Multiple Spaces are Bug-induced code that is completely unwanted.

Florian Zumkeller-Quast <branleb>
Thu Dec 13 14:17:09 2012, original submission:

When converting to ODF using

mk4ht oolatex texput "xhtml,ooffice,bib-,hidden-ref"

extra spaces appear after cross references (\ref{}) and citations (\cite{}). A minimal example is https://github.com/muelleki/lm-template/archive/oolatex-spaces.zip (ZIP) or https://github.com/muelleki/lm-template/tree/oolatex-spaces (GIT).

The extra space appears with and without hidden-ref. Can this be worked around, or is it a bug?

Kirill Müller <muelleki>


No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -unavailable- added by michal_h21 (Posted a comment)
  • -unavailable- added by branleb (Posted a comment)
  • -unavailable- added by branleb (Voted in favor of this item)
  • -unavailable- added by muelleki (Submitted the item)

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 10 encouragements so far.

    Only logged-in users can vote.


    Please enter the title of George Orwell's famous dystopian book (it's a date):



    2 latest changes follow.

    Date Changed By Updated Field Previous Value => Replaced By
    Fri Nov 3 10:50:07 2023michal_h21Open/ClosedOpen=>Closed
    Thu Oct 25 19:07:41 2018branlebCarbon-Copy-=>Added branleb
    Show feedback again

    Back to the top

    Powered by Savane 3.1-cleanup+gray