Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Conditional compilation in a LaTeX document

Tags:

latex

pdflatex

I want to generalize a template I have and one of the items is setting a few variables before generating a PDF to send to someone.

In my Makefile I have set:

${OBJS}/main.pdf: main.tex ${DEPS}
 pdflatex -output-directory=${OBJS} "\def\recipiant{${RECIPIANT}} \def\revision{${REVISION}} \include{main}"

Though I would like to not worry about those variables for reviews.. I figured I could do something like \ifdef but it isn't working out... any ideas how I can generalize this template conditionally?

\ifdef\recipiant
                \fancyfoot[CE,CO]{prepared for \recipiant \ (revision \revision) }
\else
                \fancyfoot[CE,CO]{REVIEW}
\fi
like image 744
sean Avatar asked Oct 15 '22 03:10

sean


1 Answers

I use \ifx to achieve this

\ifx\recipiant\undefined
    \fancyfoot[CE,CO]{REVIEW}
\else
    \fancyfoot[CE,CO]{prepared for \recipiant \ (revision \revision) }
\fi
like image 139
Niall Murphy Avatar answered Oct 21 '22 03:10

Niall Murphy