minoki / cluttex

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

available create option '--inputonly' as like as '--includeonly' ? #18

Open 128Mac opened 7 months ago

128Mac commented 7 months ago

Is it possible to add an option similar to --includeonly called --inputonly?

cluttex supports \include with the "-includeonly" option, but this primitive(?) has the side effect of page breaks. To avoid this, I started to use 'source' instead of '\input'. At the same time, I am beginning to wish there was a similar option called "--iinputonly" as like as "--includeonly".

If possible, please consider it.

atticus-sullivan commented 5 months ago

The main difference is that includeonly is something that is already provided by LaTeX. So it is possible to manually specify include only this and that section. We simply make use of this mechanism by injecting this directive you otherwise would have to manually insert.

Therefore, while it might be possible to implement something like this also for input, we don't have help from LaTeX and would have to do this on our own (use a custom conditional, modify the tex code or specifying a hook which returns an empty file for the other inputs (only with LuaLaTex) might be some ideas on that) -> more work.

atticus-sullivan commented 3 months ago

I've been thinking about this again these days and there might be a way to implement this somehow. There are two caveats though.

atticus-sullivan commented 3 months ago

Ok it didn't work out as expected. I was trying to use the "new" hooking mechanism of latex for this. But simply placing a \if ... in before and \fiin \after didn't work out. Another approach would be redefining \input (\let\myInput\input \renewcomand\input[1]{\myInput{#1}}) so that it can check if the provided filename shall be inputted. But then this approach is predestined to break in the future or if some other package fiddles with the \input directive. Thus, I'm not sure if it's wise to include this to cluttex.