使用 \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}

相關內容