This is not possible .gitignore is a fairly simple file and does not allow any conditional rules.
However, as a rule, it is a good idea to prepare the assembly system to create all the intermediate files in any assembly. Often used build or target . Then you can just put in .gitignore :
/target
If compilation is done using the Makefile, the rules may look like this:
target/%.pdf: target/%.tex $(LATEX) -o $@ $< target/%.tex: %.org generate_tex -o $@ $<
(not much about the syntax for latex and, of course, the specific command to generate *.tex from *.org )
source share