The term "tags" can be understood to mean that which is used to organize and make text more understandable (as in TeX.SE).

The term "tags" can also be understood as something used to manipulate the text (as in the multiaudience package and tagging package)

For instance:

  1. Is there an easy way to tag content in a LaTeX document? has several great solutions for tagging and showing/indexing tagged content;
  2. The multiaudience,optional and tagging packages allow text to either be compiled or not compiled depending on the "tags" in effect within the source.

But, to the best of my knowledge, there does not exist a solution that combines the two approaches set out above. This may be just my ignorance to an already existing solution or way of working.

So, in the spirit of "you got peanut butter on my chocolate", I'm looking for a "tagging" that does the following:

  • Works with any flavor of TeX (Not LyX)
  • Listing all tags;
  • Listing all tags with reference to where in the document they appear;
  • Listing only certain tags (for instance if there are 101 tags only listing the 5 that you might care about), or the flip side by listing all but some tags;
  • These same tags, as is done in the multiaudience and tagging packages, can also be used (without adding to the tag itself) to compile or not compile the "tagged" content.


  1. To help analyze complex documents;
  2. To help structure complex documents;
  3. To help collaboration by "chopping down" the task of editing a particular subject to size by use of tags;
  4. To focus study of complex documents by use of tags;
  5. To allow for creation of simplified document assembly for different "audiences";
  6. To allow for simplified document assembly for different "clauses" to permit several uses for the same document.
  7. To assist with both collaboration and study by use of categories of "clauses" and categories of "audiences" by using tags.

Related post: Turning parts of text on and off where @cmhughes uses etoolbox and the verbatim packages together to show or hide text.

  • 2
    ...like an index? IMHO, creating a well-written document that still flows seamlessly when certain 'clauses' (I'm assuming these are down to the paragraph level) are included/excluded is prohibitively difficult and significantly harder than just maintaining multiple, distinct perspectives of the same material. Mar 22, 2016 at 17:17
  • 2
    You might want to look also at the comment package. Although it is not designed to do all you ask, you can do things like \includecomment{fordummies} \excludecomment{forexperts} if you nest your paragraphs in the right environments. However, I think marking up a long and complex document with multiple tags the way you describe will prove to be more work than the pay-off will provide. (E.g., if the document is complex and requires study, the time will probably be better spent on studying it.)
    – jon
    Mar 23, 2016 at 3:37
  • 2
    Why add 3,000 tags if you only care about 5? And if somebody else added the 3,000, going through them to find the 5 you care about will almost certainly be more trouble than reading the document because tags are inevitably ambiguous, fuzzy and depend heavily on terminological choices, perspective and interest. A document which is everything to everyone ends up being nothing to anyone. 10 tags might be useful. 100 much less so. 1,000 and their existence will be worse than useless. Think of a tag cloud on a website. If it had 1,000 elements, would it be any use? Unless a few are big/featured.
    – cfr
    Mar 23, 2016 at 3:43
  • 1
    @SeanAllred It is useful for things like presentations where you might want slides, a handout and notes. But the overall perspective is the same in all cases, of course.
    – cfr
    Mar 23, 2016 at 3:48
  • 1
    @AFeldman Seem that your are looking for the branchs of LyX. They can be labelled by groups, listed (no page showed but linked to) filtered to reduce the list and activated/deactivated by groups . All at the LyX level (the exported LaTeX code will not have traces of the branches, only the content of the activated branches when exported).
    – Fran
    Mar 23, 2016 at 9:50


Your Answer

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

Browse other questions tagged or ask your own question.