Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Generate two versions of the same latex document
.PHONY: all
all: tutorial.pdf tutorial-solns.pdf
%.pdf: %.tex
pdflatex $^
%-solns.pdf: %.tex
pdflatex -jobname $(basename $@) '\def\SOLUTIONS{} \input{$^}'
.PHONY: clean
clean:
rm -f *.aux *.log *.pdf
\documentclass{article}
\ifdefined\SOLUTIONS
\newcommand{\solution}[1]{\textbf{Solution:} #1}
\else
\newcommand{\solution}[1]{}
\fi
\begin{document}
Job name: `\jobname'.\\
\solution{Just use makefiles!}
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment