0

I am trying to avoid modularizing a document into separate files (because it gets translated into 10 languages!) Instead, I am trying my luck with the comments package.

Let's say I have three software manuals for three variants of the program:

  1. appname-demo.tex
  2. appname-pro.tex
  3. appname.tex

Problem

The problem seems to me that overlapping includes and excludes would both write to comment.cut. This would cause the file to possibly be empty during an embedded (sequential) read.

From the comment.sty source code:

The comment environments use two auxiliary commands. You can get nifty special effects by redefining them. [...] \def\CommentCutFile{comment.cut}

Attempt

Does not typeset.

\documentclass{article}
\usepackage{comment}
\usepackage{xstring}
\usepackage{lipsum}

\IfSubStr{\jobname}{\detokenize{pro}}
  {\includecomment{include-pro}} % TRUE, so show pro stuff
  {\excludecomment{include-pro}}
\IfSubStr{\jobname}{\detokenize{demo}}
  {\excludecomment{exclude-demo}} % TRUE, so hide stuff
  {\includecomment{exclude-demo}} 

%\specialcomment{include-pro-functionality}% Attempt at changing `\CommentCutFile`
%  {\begingroup\def\CommentCutFile{include-pro.cut}}{\endgroup}
%\specialcomment{hide-in-demo}% Attempt at changing `\CommentCutFile`
%  {\begingroup\def\CommentCutFile{exclude-demo.cut}}{\endgroup}


\begin{document}
\section{Normal Functions}
\lipsum[1]

\begin{exclude-demo}
\section{Paid-Version Only Functions}
\lipsum[2]
\end{exclude-demo}

\begin{include-pro}
\section{Professional Functions}
\lipsum[3]
\end{include-pro}

% Overlapping Comments Test
\begin{exclude-demo}
\section{Paid-Version Only Functions}
\lipsum[2]
\begin{include-pro}
\subsection{Pro-Version Only Embedded}  
\end{include-pro}
\end{exclude-demo}

\end{document}
0

I'd like to close this question. I am going to go with Ulrike Fischer and say that you can't [currently] nest comments.

It might be possible by creating separate files for each nested comment, but this would require more time than its worth. Perhaps someday...

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.