summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/multiaudience/multiaudience.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/multiaudience/multiaudience.dtx')
-rw-r--r--macros/latex/contrib/multiaudience/multiaudience.dtx57
1 files changed, 46 insertions, 11 deletions
diff --git a/macros/latex/contrib/multiaudience/multiaudience.dtx b/macros/latex/contrib/multiaudience/multiaudience.dtx
index 15ef56e89f..04128b728c 100644
--- a/macros/latex/contrib/multiaudience/multiaudience.dtx
+++ b/macros/latex/contrib/multiaudience/multiaudience.dtx
@@ -1,7 +1,7 @@
% \iffalse
-% $Id: multiaudience.dtx,v 1.6 2015/08/02 23:02:42 boris Exp $
+% $Id: multiaudience.dtx,v 1.9 2021/10/02 22:21:51 boris Exp $
%
-%% Copyright 2015, Boris Veytsman <borisv@lk.net
+%% Copyright 2015-2021, Boris Veytsman <borisv@lk.net
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either
%% version 1.3 of this license or (at your option) any
@@ -22,13 +22,13 @@
%</gobble>
%<style>\ProvidesPackage{multiaudience}
%<*style>
-[2015/08/02 v1.02 Generating versions for different audiences from the
+[2021/10/02 v1.04 Generating versions for different audiences from the
same source]
% \end{macrocode}
%</style>
%<*gobble>
% \fi
-% \CheckSum{81}
+% \CheckSum{85}
%
%
%% \CharacterTable
@@ -134,8 +134,8 @@ same source]
% This trick allows one to generate all versions of output from the
% command line:
% \begin{verbatim}
-% pdflatex -jobnane file-execs "\def\CurrentAudience{execs}\input{file}"
-% pdflatex -jobnane file-devs "\def\CurrentAudience{devs}\input{file}"
+% pdflatex -jobname file-execs "\def\CurrentAudience{execs}\input{file}"
+% pdflatex -jobname file-devs "\def\CurrentAudience{devs}\input{file}"
% ...
% \end{verbatim}
%
@@ -201,7 +201,7 @@ same source]
% TEXT~1 will be visible only to devs and execs, while TEXT~2 only to
% devs.
% \begin{verbatim}
-% \begin{shownto}{devs, execs}
+% \begin{shownto}{devs,execs}
% TEXT 1
% \begin{shownto}{devs}
% TEXT 2
@@ -298,6 +298,38 @@ same source]
% \begin{verbatim}
% \NewMultiaudienceSectionEnv{Section}{\section}
% \end{verbatim}
+%
+% \subsection{Combined audiences}
+% \label{ug:combinations}
+%
+% Sometimes one wants to create a document for several audiences. You
+% can do this using comma-separated lists in \cs{CurrentAudience}, for
+% example,
+% \begin{verbatim}
+% \DefCurrentAudience{execs,admins}
+% \end{verbatim}
+%
+%
+% \emph{Important:} there should be no spaces in the definition. The
+% definition |\DefCurrentAudience{execs, admins}| will \emph{not} work!
+%
+% The resulting audience is the union of the audiences in the
+% definition. Thus a fragment is included if either:
+% \begin{enumerate}
+% \item The list of audiences for the fragment does not start with
+% |-|, and at least one of the current audiences is mentioned in the
+% list.
+% \item The list of audiences for the fragment starts with |-|, and
+% none of the current audiences is mentioned in the list.
+% \end{enumerate}
+% For example, suppose the current audience is |execs,admins|. Then
+% the following is true:
+% \begin{enumerate}
+% \item |\showto{devs}{...}|---excluded.
+% \item |\showto{devs,admins}{...}|---included.
+% \item |\showto{-, devs}{...}|---included.
+% \item |\showto{-, devs, admins}{...}|---excluded.
+% \end{enumerate}
%
%
%\StopEventually{\clearpage}
@@ -380,20 +412,23 @@ same source]
% \end{macro}
%
% \begin{macro}{\SetNewAudience}
+% \changes{v1.04}{2021/10/02}{Added facility for a list of current
+% audiences}
% Definition of a new audience. We create a new key that switches
% visibility on or off.
% \begin{macrocode}
\def\SetNewAudience#1{%
\define@key{MULTAU}{#1}[]{%
\def\@MULTAU@currkey{#1}%
- \ifx\@MULTAU@currkey\CurrentAudience\relax
+ \@for\@tempa:=\CurrentAudience \do{%
+ \ifx\@MULTAU@currkey\@tempa\relax
\if@MULTAU@include
\@MULTAU@showntrue
\else
\@MULTAU@shownfalse
- \fi
- \fi}%
-}
+ \fi%
+ \fi%
+}}}
% \end{macrocode}
%
% \end{macro}