GeneralShow/Hide Specific Content Based on Audience and Output

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
jason
Posts: 2
Joined: Thu May 06, 2010 11:06 pm

Show/Hide Specific Content Based on Audience and Output

Post by jason »

Hi, I am new to LaTex and have a specific problem I'm hoping it can help address. I need to maintain a large policy document. The document will be used for multiple purposes, have multiple destination formats (PDF, wiki, text) and has 2 distinct audiences. Each audience shares about 75% of the content distributed throughout the document, with the remainder to be shown to only one of the groups.

Is there a way to inlcude all the content in the document and only render certain paragraphs or sections when the document is compiled? Thanks in advance,

Jason

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

anson
Posts: 6
Joined: Fri Feb 13, 2009 1:13 am

Re: Show/Hide Specific Content Based on Audience and Output

Post by anson »

Hi Jason,

If you don't mind typesetting the document for each group before you distribute it, I would try using,

\begin{comment}
Super secret text
\end{comment}

This way you can maintain the document in its entirety and just comment out proprietary content before you typeset it. I can't recall for sure if this is true, but I think you also need to load the verbatim package in your preamble to get it to work.
jason
Posts: 2
Joined: Thu May 06, 2010 11:06 pm

Show/Hide Specific Content Based on Audience and Output

Post by jason »

Thanks for the response. I ended up taking a break form this, and just found today what I think is a solution. I modified what I found on http://suepke.eu/conditional-commenting-in-latex/

This should create and set a boolean value to true or false. You then create a command that can take two arguments. The first would be what you want displayed if showToPublic is true, then other if set to false:

Code: Select all

\usepackage{ifthen}
\newboolean{showToPublic}
\setboolean{showToPublic}{true}
\newcommand{\todocmd}[2]{{{#1}}{{#2}}}
\newcommand{\todo}[2]{\ifthenelse {\boolean{showToPublic}} {\todocmd{#1}}{\todocmd{#2}}}
In the body of your document, when you have content that should be dynamically displayed based on that show/hide flag you'd do the following:

Code: Select all

\todo{Here's what the public would see.}{Here's the private copy.}
The original example was on how to show/hide comments. You could just use that mechanism if you only want to include or show content based on a show/hide state rather than toggle it.
Post Reply