(gdb) break *0x972

Debugging, GNU± Linux and WebHosting and ... and ...

Conditional Compiling in Latex based on Filename

If you want to generate two versions of a document, for example one for online reading with hyperlinks and another one for printing, with footnotes instead of hyperlinks [1], you can use this trick:


% that inside a package, where I can pass "paper" as an option

% if substring "paper" is found in the job (file) name, set the flag

then you create a link command accordingly:


and finally you create a link (symbolic or hard, it doesn't matter) and compile one version or the other:

ln -s myfile.tex myfile-paper.tex
pdflatex myfile
pdflatex myfile-paper

(I guess that some LaTeX packages already do that for free, but conditional compilation can have many other usages.)

1: http://blog.0x972.info/?d=2014/10/29/09/55/15-conditional-compiling-in-latex-based-on-filename

Waslon :

It works fine! Thanks a lot.

September 12, 2023.