Menu

#1313 LaTeX variable displayed erroneously, but is correct in target file

6.0.2
open
None
5
2026-01-28
2026-01-19
No

Dear Bug Trackers,

Jean-Christophe instructed me to file a bug report.

Appended underneath is my mail to the OmegaT users list, entitled
"LaTeX variable displayed erroneously, but is correct in target file"
and his reply.

Also on:
https://sourceforge.net/p/omegat/mailman/message/59284750/

The attachments from my original posting in the list are also attached here.

Thank you for your project and your valuable time.

Kind regards,
Frank Richter

Dear Fellow Translators & Developers,

I encountered the following bizarre behavior:

I define a new LaTeX variable \ArchivFormatWarnung which is referred to in several of my source files.
I import these into OmegaT.

As expected, that variable is not displayed in OmegaT when translating three of my source files.

In a fourth file however, it is displayed, but only as "Warnung".
Minor problem: tags are modified compared to my earlier translation, so I had to insert it manually.

What is even more bizarre, the displayed "Warnung" (see screen copy) comes out as the intended "\ArchivFormatWarnung" in the target file.

This problem did not arise with any of my other LaTeX variables.

Attached are:
a LaTeX file assembling the texts containing that LaTeX variable; the problem is only in the last text underneath the dashed line;
a screen copy, showing OmegaT after importing that LaTeX file (source language in green: German, target language in yellow: French);
the log file (last program start = (Fri Jan 16 16:15:07 CET 2026), only for this file).

My system:
Version: OmegaT-6.0.1_0_42ef0143
Platform: Windows 11 10.0
Java: 11.0.24 amd64
Memory: 377MiB total / 162MiB free / 1024MiB max

Can anyone shed light here ?

Thanks a lot for your kind expertise,
kind regards

Frank

Hello Frank,

I tested your file with the current 6.0.2 build and OmegaT’s default settings.

On Jan 17, 2026, at 0:38, Frank Richter - solvimus GmbH via Omegat-users omegat-users@lists.sourceforge.net wrote:

Dear Fellow Translators & Developers,

I encountered the following bizarre behavior:

I define a new LaTeX variable \ArchivFormatWarnung which is referred to in several of my source files.
I import these into OmegaT.

As expected, that variable is not displayed in OmegaT when translating three of my source files.

It seems to be that the lack of display is more due to the position of the tags.

In your test file, the first and second instances are at the end of a block, the third at the beginning.

This behaviour is expected.

You notice that the first segment "hides" this part:

\begin{Liste}
\itemWeiter

and the second, this part:

\ArchivFormatWarnung

\end{Liste}

In a fourth file however, it is displayed, but only as "Warnung".

It seems to be displayed as <u2>Warnung, which seems to mean that the "\ArchivFormat" part is considered as a tag by OmegaT.</u2>

Also, that instance is in the middle of a block, hence it is not ignored by OmegaT, which is expected.

Minor problem: tags are modified compared to my earlier translation, so I had to insert it manually.

What is even more bizarre, the displayed "Warnung" (see screen copy) comes out as the intended "\ArchivFormatWarnung" in the target file.

Which seems to confirm that "\ArchivFormat" is considered as a tag and is properly reproduced in target, followed by "Warnung".

It looks like a bug to me and you should create a report on Sourceforge.

Jean-Christophe

3 Attachments

Discussion

  • Hiroshi Miura

    Hiroshi Miura - 2026-01-27
    • Group: 6.0.1 --> 6.0.2
     
  • Hiroshi Miura

    Hiroshi Miura - 2026-01-28

    This happens because OmegaT searches command strings in the order in which they appear.

    Assume the following text:

    “We \Archive it, and \Archive is compressed. Then we \ArchiveMore.”

    There are two commands: \Archive and \ArchiveMore.
    OmegaT builds a list of commands: ["Archive", "ArchiveMore"].

    OmegaT then matches the text against each item in this list.
    First, it picks Archive, searches for \Archive, and replaces it with <u0>.

    As a result, the text becomes:

    “We <u0> it, and <u0> is compressed. Then we <u0>More.”

    This is what you observed.

    If the list is instead ["ArchiveMore", "Archive"] —that is, sorted by length with longer commands first—OmegaT searches for \ArchiveMore first. When it finds and replaces \ArchiveMore, the text becomes:

    “We \Archive it, and \Archive is compressed. Then we <u0>.”

    OmegaT then searches for \Archive and replaces it with <u1>.
    The final result becomes:

    “We <u1> it, and <u1> is compressed. Then we <u0>.”

     
    👍
    1
    • Jean-Christophe Helary

      I guess that is something that we would like to fix, to make sure that the longer command is properly recognized. What do you think?

       
  • Hiroshi Miura

    Hiroshi Miura - 2026-01-28
    • assigned_to: Hiroshi Miura
     
  • Hiroshi Miura

    Hiroshi Miura - 2026-01-28

    I raised a Pull-Request for the fix to master branch.
    https://github.com/omegat-org/omegat/pull/1889

     
  • Hiroshi Miura

    Hiroshi Miura - 2026-01-28

    Fix for 6.0 branch is also raised.
    https://github.com/omegat-org/omegat/pull/1890

     

Log in to post a comment.