7

I'm writing my cv using moderncv, and I want to make it in 2 languages. I wrote a common part, which both languages will have, and specific ones, where I put the translated content. I also want to make 2 versions: one with contact information, and another without it.

In short: I want my cv in 4 versions: 2 languages, each one with and without contact information.

I looked for an automated way to do that, just for fun. The ideal answer would be a single main .tex file producing all the 4 versions. I found 2 answers here in tex.sx, this and this, where I think my ideal can be made combining both.

My main.tex have this code now

\ifx\conditionmacro\undefined
  \immediate\protect\write18{%
    pdflatex --jobname="cv-pt" "\includeonly{pt/personal,pt/contact,pt/content}\input{main}"
  }%
  \immediate\protect\write18{%
    pdflatex --jobname="cv-pt-web" "\includeonly{pt/personal,pt/omitted,pt/content}\input{main}"
  }%
  \immediate\protect\write18{%
    pdflatex --jobname="cv-en" "\includeonly{en/personal,en/contact,en/content}\input{main}"
  }%
  \immediate\protect\write18{%
    pdflatex --jobname="cv-en-web" "\includeonly{en/personal,en/omitted,en/content}\input{main}"
  }%
  \expandafter\stop
\fi

\input{personal}

\include{pt/contact}
\include{pt/omitted}

\include{en/contact}
\include{en/omitted}

\begin{document}

\makecvtitle

\include{pt/content}
\include{en/content}

\end{document}

I could get this working only once without knowing how. I wish someone here can help me doing it.

I really really really don't want to use a Makefile or shell script to do this. =)

Thanks!

3

1 Answer 1

8

This way should work:

\documentclass{moderncv}

% other stuff here

\ifx\conditionmacro\undefined
  \immediate\write18{%
    pdflatex --jobname="cv-pt" "\gdef\string\conditionmacro{1}\string\input\space\jobname"
  }%
  \immediate\write18{%
    pdflatex --jobname="cv-pt-web" "\gdef\string\conditionmacro{2}\string\input\space\jobname"
  }%
  \immediate\write18{%
    pdflatex --jobname="cv-en" "\gdef\string\conditionmacro{3}\string\input\space\jobname"
  }%
  \immediate\write18{%
    pdflatex --jobname="cv-en-web" "\gdef\string\conditionmacro{4}\string\input\space\jobname"
  }%
  \expandafter\stop
\fi

\ifnum\conditionmacro=1 \includeonly{pt/personal,pt/contact,pt/content}\fi
\ifnum\conditionmacro=2 \includeonly{pt/personal,pt/omitted,pt/content}\fi
\ifnum\conditionmacro=3 \includeonly{en/personal,en/contact,en/content}\fi
\ifnum\conditionmacro=4 \includeonly{en/personal,en/omitted,en/content}\fi

\begin{document}

\makecvtitle

\include{pt/personal}
\include{pt/contact}
\include{pt/omitted}
\include{pt/content}

\include{en/personal}
\include{en/contact}
\include{en/omitted}
\include{en/content}

\end{document}
1
  • Worked! Can't forget to mention the whitespace/newline after \conditionmacro=X.
    – paulochf
    Feb 24, 2014 at 17:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .