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
General ⇒ Show/Hide Specific Content Based on Audience and Output
NEW: TikZ book now 40% off at Amazon.com for a short time.
Re: Show/Hide Specific Content Based on Audience and Output
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.
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.
Show/Hide Specific Content Based on Audience and Output
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:
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:
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.
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}}}
Code: Select all
\todo{Here's what the public would see.}{Here's the private copy.}