sillsdev / ptx2pdf

XeTeX based macro package for typesetting USFM formatted (Paratext output) scripture files
22 stars 8 forks source link

Enhancement: Have some visual feedback if any tracing is turned on #816

Open markpenny opened 1 year ago

markpenny commented 1 year ago

It is all too easy to accidentally leave some \tracing{codes} left on in a .tex file and then wonder why PTXprint is working so slowly. So I would like there to be some indication in the UI that warns a user that it may run slower than expected due to tracing being on.

A few ideas on how to do this: a) Color the Advanced tab label red instead of blue b) Use a different color (like peach/orange) on the Print button (instead of the green) c) Issue a status bar message when you hit print

We would need to (i) check if the mods.tex and pre-mods.tex files are enabled, and if so (ii) look/regex for certain strings like \tracing{.+} that aren't commented out. And only do any of this if in Full view.

davidg-sil commented 1 year ago

An alternative to searching any included tex files would be to load the UI with a whole heap of tracing options. grepping the .tex files is probably better.

mhosken commented 1 year ago

Or perhaps add a emoticon (e.g. U+2712 BLACK NIB) after the offending file reference in the Advanced tab.

markpenny commented 1 year ago

How we tell the user is the relatively easy work, but I'm still no closer to knowing how we detect the fact that tracing has been left turned on...

davidg-sil commented 1 year ago

Does something like this work?

usestracing=0
for texfile (all included tex files):
   with texcontents=open(texfile):
      if match("^[^%]\\tracing",texcontents):
          usestracing=1