我正在使用 moderncv 撰写简历,我想用两种语言撰写。我写了一个通用部分,两种语言都会有,还有特定的部分,我将翻译的内容放在其中。我还想制作两个版本:一个带有联系信息,另一个没有。
简而言之:我希望我的简历有 4 个版本:2 种语言,每个版本包含和不包含联系信息。
我寻找一种自动化的方式来做到这一点,只是为了好玩。理想的答案是使用一个主 .tex 文件来生成所有 4 个版本。我在 tex.sx 中找到了 2 个答案,这和这,我认为我的理想可以将两者结合起来。
我的 main.tex 现在有这个代码
\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}
我只能让它工作一次,但不知道怎么做。我希望这里有人能帮助我做到这一点。
我真的真的真的不想使用 Makefile 或 shell 脚本来执行此操作。=)
谢谢!
答案1
这种方法应该可行:
\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}