Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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!

share|improve this question
    
Are you sure you do not want to use a Makefile. Maybe try this: bitbucket.org/michipili/bsdmakepscripts/wiki/… and look for “Several documents in the same directory”. –  user40989 Feb 24 at 8:13

1 Answer 1

up vote 6 down vote accepted

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}
share|improve this answer
    
Worked! Can't forget to mention the whitespace/newline after \conditionmacro=X. –  paulochf Feb 24 at 17:06

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.