Skip to content

Instantly share code, notes, and snippets.

@louisswarren
Created February 3, 2021 02:08
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save louisswarren/5b9e130f950206f5e7497a9fd59e09f4 to your computer and use it in GitHub Desktop.
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