使用 \ifthenelse 中的命令生成文档的多个版本

使用 \ifthenelse 中的命令生成文档的多个版本

我希望能够使用\ifthenelse语句中的某种打印命令来生成文档的不同版本。下面是我想要执行的操作的示例。我想这样做,因为我的文档很长,而且包含很多部分。我认为这样做比在语句中定义所有文本更容易\ifthenelse

\documentclass{article}

\usepackage{ifthen}

\begin{document}

\newcommand{\docVersion}[1]
{
% normally, text would go where the commands \printA{} and \printB{} would go
    \ifthenelse{\equal{#1}{group A version}}{\printA{}}{}
    \ifthenelse{\equal{#1}{group B version}}{\printB{}}{}
}

% so here, I could define that I want group A's version
\docVersion{group A version}

% and only this would be printed
\printA{Some stuff for group A here.}

% and this would not
\printB{Some stuff for group B here.}

% and this would be printed also
Some stuff for both groups here.

\end{document}

相关内容