I often need to generate separate PDF files for the CV and cover letter. On my system (Mac) the template file is at:
/usr/local/texlive/2016/texmf-dist/doc/latex/moderncv/examples/template.tex
I can generate two separate files by running LuaLaTeX/XeLaTeX after commenting out half the file. For example:
\documentclass[11pt,a4paper,sans]{moderncv}
\name{John}{Doe}
\begin{document}
%----------------cv----------------
\makecvtitle
\section{Education}
\cventry{year--year}{Degree}{Institution}{}{}{}
% \clearpage
% %----------------letter----------------
% % recipient data
% \recipient{Joe}{Company}
% \makelettertitle
% % letter
% \makeletterclosing
\end{document}
But this is clumsy and error-prone. Is there a direct way to generate two files.
Note that splitting the file using a PDF splitting tool (pdftk, or, on OS X, Preview) leaves incorrect page numbers, and results in unnecessarily large PDF files.
Best Answer
One possibility is to define new boolean variables and use them in your TeX file.
Add the following code
With command
\setboolean
you can definetrue
orfalse
for both varaibles, depending on your needs.With the following compilable code you get the letter, but no cv:
with the resulting pdf:
So set first the boolean variables as you need, then compile three times, copy the resulting pdf, change the boolean variables again, compile again three times. Now you have two pdf files, one containing the CV, the other containing the letter only ...