[LyX/master] tex2lyx: improve module support

Scott Kostyshak skostysh at lyx.org
Tue Feb 2 18:35:43 UTC 2021


On Tue, Feb 02, 2021 at 11:27:33AM -0500, Richard Kimberly Heck wrote:
> On 2/2/21 12:47 AM, Scott Kostyshak wrote:
> > 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.
> 
> Does it search through the existing modules? If so, that would take some
> time.

Would it be possible to do use configure to cache some information that would make tex2lyx faster?

Scott
-------------- 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/e850a9b9/attachment-0001.asc>


More information about the lyx-devel mailing list