[LyX/master] tex2lyx: improve module support

Scott Kostyshak skostysh at lyx.org
Tue Feb 2 05:47:41 UTC 2021

On Thu, Apr 04, 2019 at 03:55:15PM +0200, Juergen Spitzmueller wrote:
> commit 0b54650f0e7f1eae39f93444cac6c8525811975b
> Author: Juergen Spitzmueller <spitz at lyx.org>
> Date:   Thu Apr 4 15:46:49 2019 +0200
>     tex2lyx: improve module support
>     The current heuristics only considered modules with styles that defined
>     a searched command in their preamble, and only for commands/environments
>     that were defined in the document's preamble. This limited the module
>     support drastically.
>     The new heuristics also checks for commands coming from packages. If the
>     command is not (re-)defined in the document preamble, it checks modules
>     that provide a style with a matching LaTeXName, checks for their
>     requirements and matches those with the packages loaded by the document.
>     If no module provides a searched style, but we found modules that load
>     packages that are loaded in the imported tex file, and if those packages
>     are not auto-loaded by LyX anyway, we also load this module.
>     fixes: #11259, part of #8229
> ---

Starting with this commit, tex2lyx is a bit slower. For importing the string "\textbf{hello}", it took about 0.15s before (as measured by the "real" row of the "time" command output) and now it takes about 0.56s. I tested by putting the string in a file mwe.tex and running the following command:

$ time /path/to/tex2lyx -userdir /path/to/user-dir -fixedenc utf8 -f mwe.tex /dev/null

The fix seems like nice feature, so the small increase in time might be worth it. Also, tex2lyx is not usually a feature that a user uses repeatedly, so in my opinion a delay is fine. Nonetheless, I note the increased time just in case it was unexpected.

By the way, for anyone testing, if you see long delays from tex2lyx it could be from updating layouts.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.lyx.org/pipermail/lyx-devel/attachments/20210202/557f3fe0/attachment-0001.asc>

More information about the lyx-devel mailing list