This question led to a new package:

I'm trying to work out options for configuring a large memoir to multiple audiences via multiple editions.

Obviously one method of doing this is by building a master set of sections and then combining them into several different master documents which are basically a string of \input{} commands.

Another might be to define a set of section id environments and then include or exclude them with \newcomment{} \commentson{} and commentsoff{}

Yet another way would be an inverse of this: to tag each section with one or more labels. Something like this:

\chapter{A Simple Introduction}
\chapter{A Complex Introduction}
\chapter{How to erase the system}

where I could then do something at the start like:


to build the "System Programmer" edition.

Is there a package that will do something like this?

Accepted @Leo Liu's answer. Bril.

  • 1
    FWIW, in ConTeXt this feature is called modes. – Aditya May 17 '12 at 3:32

There is a xcomment package, it isn't tagged, but useful for this kind of question. See also


Here is what you want:




     \ifcsname tagged@##1\endcsname





\begin{tagged}{a, x}
aaaa xxxx

\begin{tagged}{b, c, x}
bbbb cccc xxxx


It's not difficult to implement. Whitespace after commas is ignored.

  • That looks brilliant, and much simpler than I had feared. Going off to have a play with it, back soon... – Brent.Longborough Feb 13 '11 at 19:17
  • Accepted, +1. Brilliant. Worth an extra upvote just for the line \usepackage{etoolbox}. – Brent.Longborough Feb 13 '11 at 19:39
  • A previous version does not contain etoolbox. I used \@for and \@namedef, which is not more complex. I use etoolbox to ignore the extra spaces. However, unlike keyval, spaces before commas is not ignored. You can use \ForEach in forarray package or other trick to ignore more spaces. – Leo Liu Feb 13 '11 at 19:55

The `tagging' package is now on CTAN, providing the following commands:

\tagged{list}{yes}            % Conditional inclusion
\untagged{list}{no}           % Conditional exclusion
\iftagged{list}{yes}{no}      % Conditional inclusion/exclusion
\begin{taggedblock}{list}     % Conditionally included environment
    \end{taggedblock}         %
\begin{untaggedblock}{list}   % Conditionally excluded environment
    \end{taggedblock}         %
\usetag{list}                 % Turn tags on
\droptag{list}                % Turn tags off

My thanks to Leo Liu, for his original answer on which the work is based.

  • 1
    Good job. I've just seen this package on CTAN-ann mailing list. – Leo Liu Aug 29 '11 at 17:31
  • I was very happy when I found tagging. Does this package have the ability to list the tags in use? Somewhat along the lines of tex.stackexchange.com/questions/37928/… – A Feldman Mar 19 '16 at 18:23
  • @AFeldman I'm sorry, I have good news: I'm in the process of freezing and deprecating tagging, in favour of Boris Veytsman's multiaudience, which I think does a better job. tagging will remain on CTAN, in order not to force current users to migrate, but there will no further development, and no bug or feature requests will be accepted. – Brent.Longborough Mar 19 '16 at 20:25
  • @Brent.Longborough much obliged for the response. I will take a look at multiaudience. – A Feldman Mar 20 '16 at 15:36
  • 1
    @Brent.Longborough the tagging documentation is very understandable. I found myself wishing that the same was true with multiaudience, which I found a little confusing. Is there a technical reason why multiaudience is better? – A Feldman Mar 20 '16 at 15:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.