I want to create two pdf output files of a single LaTeX source.
One output file is public and the other one (with further information) becomes private.
I use a make file, which uses find to grep the tex file in the directory. This is a simple solution because this way I can reuse the makefile for many projects without needing to modify its content.
This is the important part of the makefile.
all:
# This creates the public output file
find -name *.tex -exec sh -c 'pdflatex {}' \;
Now I want to add a further line to create the private output file. It should look something like this:
all:
# This creates the public output file
find -name *.tex -exec sh -c 'pdflatex {}' \;
# This creates the private output file
find -name *.tex -exec sh -c 'pdflatex --jobname=ABC '\def\privatflag{}\input{XYZ}' {}' \;
For ABC I look for a solution to specify the default filname but with a prefix.
For XYZ I look for a solution to pass the input filename here.
The usage of the inner quotation marks is also not correct here I think.
Update 1: Maybe I can explain the problem more simple way.
This command works in the command shell:
pdflatex --jobname=outputfile '\def\privatflag{}\input{inputfile.tex}'
But I'm looking for a solution to use it with find -name *.tex -exec
so that I don't need to specify the intput filename inputfile.tex.
Additionally I look for a way that I don't need to specify --jobname=outputfile
. It should match the input filename with an additional prefix.
Update 2: Thanks to muru and Stéphane Chazelas, the issue is solved.
This is now the important part of the makefile
all:
# This creates the public output file
find -name *.tex -exec sh -c 'pdflatex {}' \;
# This creates the private output file
find . -name '*.tex' -execdir sh -c 'pdflatex --jobname=privat_"$${1##*/}" "\def\privatflag{""}\input{$${1##*/}}"' {}-job {} \;
sh -c ...
? Why not just-exec pdflatex {}
and-exec pdflatex --jobname=ABC '\def\privatflag{}\input{XYZ}' {}
? If you ran these commands manually, how would it look, to get an idea of whatABC
andXYZ
are.pdflatex
command be affected by directories? For example, what would you do forsome/path/some/input.tex
?