wtsnjp / llmk

Light LaTeX Make

Home Page:https://ctan.org/pkg/llmk

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

unnecessary latex execution repeated

matteofg opened this issue · comments

commented

First of all, congratulations for this project: it's very simple and "user oriented". But it may not be very efficient.
For example, in case of sequence = [”latex”, ”bibtex”], the automatic mechanism of the execution repeated (via .aux file check) is useful only after the bibtex postprocess (and not after the first latex execution).
All this means more executions than necessary.

What do you think?
Matteo

Thanks for your suggestion. Yes, I know the issue but have not considered it in depth yet. Should the repeat only be on the very last latex program call, often as a postprocess? Or maybe we could introduce a rule like "unless there is a force_repeat key, no repeat unless it is the last latex execution." We could use that key explicitly if we need to converge cross-references, even if it is not the last run.

Furthermore, even if postprocess = "latex", it does not necessarily mean the latex program must be executed more than once. For example, if sequence = ["latex", "bibtex", "makeindex"] and both bibtex and makeindex are executed, it is unnecessary to run latex immediately after bibtex, but it is sufficient to run it after makeindex is run.

commented

In my opinion, any solution should not involve manual settings by the user. In fact, the most frequent use of llmk is to explicit the workflow through the editor's magic comments (and not through TOML fields or llmk.toml).

Of course, repetition should occur only at the last call of the LaTeX program. Also, the presence of an explicit force_repeat key is definitely a positive option.

Matteo

We are planning the following changes for a more efficient workflow run, i.e., no extra latex command execution or repetition.

1. Change postprocess semantics

Currently, the program specified in postprocess is executed immediately after each program run. Change this behavior so that the program specified in postprocess is executed only once after completing all the sequence.

2. Introduce a new table key in_postprocess in the programs table

The settings specified within this table will only be applied when the program is executed as postprocess (overriding any existing settings if they conflict). This allows you to change whether or not the program is repeated when it is run normally in a sequence and when it is executed as a postprocess, for example.

With this new table key in place, we change the default [programs.latex] setting as follows:

[programs.latex]
command = "lualatex"
opts = [
  "-interaction=nonstopmode",
  "-file-line-error",
  "-synctex=1",
  '-output-directory="%o"'
]
postprocess = "latex"

  [programs.latex.in_postprocess]
  aux_file = "%B.aux"
  aux_empty_size = 9

Note that the postprocess setting shall be ignored if the program is run as a postprocess.

commented

We are planning the following changes for a more efficient workflow run, i.e., no extra latex command execution or repetition.

Hello,
is there any news?

No, unfortunately, I have been too busy to make progress.

I have decided on the design for the enhancement as above. No particular objections seem to have been raised. I will work on it when I can find the time, but for the time being, I do not expect to be able to do so. If you are in a hurry, please send me a pull request, and I will be able to review it.

commented

Don't worry, I have no special needs.
I hope you'll find time soon to follow this implementation, which is especially useful for long documents that have many cross-references, tables, indexes, etc.