3

I'm using the multiaudience package - works pretty nice. Here is an example

\usepackage{multiaudience}
\SetNewAudience{internGER}
\SetNewAudience{externGER}
\DefCurrentAudience{internGER}
...
\begin{shownto}{internGER, externGER}
text for everyone
\begin{shownto}{internGER}
text for internals only
\end{shownto}
\end{shownto}

Now I would love to create an extra-option, that allows me to "mark" (text in red or underline or something like this) the internal text. That will make text-approval much easier, as you do not have to check both documents, but only one.

So I tried to recreate the shownto environment

  \let\oldshownto\shownto
  \let\endoldshownto\endshownto
  \renewenvironment{shownto}[1][]{%
  THIS TEXT WILL BE VISIBLE TO #1 :\\
 \oldshownto
  }{ %
  END OF VISIBLE TEXT\\
  \endoldshownto
  }

my plan was to use some "if-magic" based on argument #1, unfortunately there is no content in #1. What is wrong with this?

Here is the full minimal example - its compiling

\documentclass{article}

\usepackage{multiaudience} \SetNewAudience{internGER} \SetNewAudience{externGER} \DefCurrentAudience{internGER} %\DefCurrentAudience{externGER}

\let\oldshownto\shownto \let\endoldshownto\endshownto \renewenvironment{shownto}[1][]{% -THIS TEXT WILL BE VISIBLE TO #1-, \oldshownto }{ % -END-\ \endoldshownto }

\begin{document} \begin{shownto}{internGER, externGER} text for everyone.

\begin{shownto}{internGER} text for internals only \end{shownto} \end{shownto} \end{document}

Thanks Georg

Georg
  • 51
  • 4

1 Answers1

2

You are defining the environment to take an optional argument, which by default is empty, but you want (1) the environment to take a mandatory argument, and (2) to pass this argument to the original environment.

However, the {shownto} environment is defined by \NewEnviron (in a way which makes me think that the author kind of misunderstood its usage...), so I'd take a different approach:

\documentclass{article}

\usepackage{multiaudience} \SetNewAudience{internGER} \SetNewAudience{externGER} \DefCurrentAudience{internGER} %\DefCurrentAudience{externGER}

% original definition %\NewEnviron{shownto}[1]{% % @MULTAU@shownfalse@MULTAU@includetrue % \setkeys{MULTAU}{#1}% % \if@MULTAU@shown\BODY\fi} \makeatletter \RenewEnviron{shownto}[1]{% @MULTAU@shownfalse@MULTAU@includetrue \setkeys{MULTAU}{#1}% \if@MULTAU@shown [START TEXT SHOWN TO #1]% \BODY [END]% \fi } \makeatother

\begin{document} \begin{shownto}{internGER, externGER} text for everyone.

\begin{shownto}{internGER} text for internals only \end{shownto} \end{shownto} \end{document}

enter image description here

campa
  • 31,130
  • This is working fine.... how can I do the same for the \showto{} command. Difinition is \long\def\showto#1#2{\@MULTAU@shownfalse\@MULTAU@includetrue \setkeys{MULTAU}{#1}% \if@MULTAU@shown#2\fi \@MULTAU@showntrue\@MULTAU@includetrue} – Georg Aug 10 '23 at 12:12