minoki / cluttex

Process LaTeX documents without cluttering your working directory
GNU General Public License v3.0
45 stars 3 forks source link

Add --glossaries option #15

Open atticus-sullivan opened 1 year ago

atticus-sullivan commented 1 year ago

Reason why I added this option is that the glossaries package offers the ability to add many different glossaries (not just the usual glo but also e.g. something for symbols or abbreviations). While makeglossaries is able to process these other glossaries, cluttex has no chance of detecting changes in files different than .glo as it doesn't know which files to watch.

Thus, --glossaries offers the ability to register a tool (makeindex/xindy, these are the tools used by makeglossaries internally anyhow) with the respective files (needs to specify the whole filename+ext as I wanted to give full flexibility, most of the time the filename will be main or master I think) to watch.

See https://github.com/minoki/cluttex/issues/14 for some ideas and discussion (with myself).

I changed a bit the order of the arguments in the options string so now it is type:out:inp:log:path:args and inp and log are inferred from out (seems like a more logical ordering). I chose out before inp as the file-ending of out is typically better known than the one of inp and I wanted the parameter which can be used to infer the other ones as early as possible.


This option offers the --makeindex as well as the --makeglossaries (I don't know of makeglossaries flags/options that can not be set directly for makeindex/xindy) features. The only thing we can't do properly is to check for No file ... and issue a warning that the user shall set a respective option (the only thing I could think of is to watch for common extensions like ind (index), sls (symbols), nls (numbers), gls (glossaries) and acr (acronyms/abbreviations)).

So I personally would deprecate these functions or redirect them to the proper --glossaries call, but that's not my decision as collaborator. That's a decision of @minoki as maintainer, I think.

atticus-sullivan commented 1 year ago

Making a draft since I discovered a .ist file is (sometimes) automatically created. So I want to figure out first under which circumstances this happens and how we can honor this appropriately.

atticus-sullivan commented 1 year ago

Added .ist support for makeindex (didn't find an equivalent for xindy). Also I needed to fix some things when checking for a rerun (like adding the makeindex/xiindy output files to the auxiliary section of the tex-input files).

Still I would be interested in the reason why you decided to touch the output files even if they didn't change (e.g.https://github.com/minoki/cluttex/blob/c16509ed9496767f346c632b3a22e33a7a3804b3/src/cluttex.lua#L332 or https://github.com/minoki/cluttex/blob/c16509ed9496767f346c632b3a22e33a7a3804b3/src/cluttex.lua#L362 )

minoki commented 10 months ago

Still I would be interested in the reason why you decided to touch the output files even if they didn't change (e.g.

https://github.com/minoki/cluttex/blob/c16509ed9496767f346c632b3a22e33a7a3804b3/src/cluttex.lua#L332

I don't remember the exact reason, but I guess that ClutTeX assumes .ind file (or .glo file) should be newer than .idx file (or .gls file) if it is up-to-date.

atticus-sullivan commented 10 months ago

Oh, that actually makes sense :+1: