Text Formattingcomment | Problem with '\specialcomment' Command

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
RJPerkins
Posts: 2
Joined: Sat Nov 12, 2011 10:35 pm

comment | Problem with '\specialcomment' Command

Post by RJPerkins »

I am attempting to use \specialcomment (from comment.sty) to selectively include or exclude sections of text. I am using MiKTeXv2.9 with pdftex.
\specialcomment takes 3 arguments; the second argument is supposed to precede the comment text, and the third argument is supposed to be appended to the comment text.
However, this does not happen; the comment text is printed (or not, according to the option that has been selected) but nothing precedes the comment text and nothing is appended to it. I have tried modifying the code in comment.sty directly, replacing the arguments #2 and #3 in the definition part of \specialcommand with some sample text, and this does not change anything.

The only way I have managed to get this to work is to introduce the additional text directly into the definition of the \AfterIncludedCommment macro, immediately before and after the \input command.

Here is an example of code that I have tried, that should work (according to the documentation, and other postings on the internet), but doesn't:

Code: Select all

\usepackage{comment}
\usepackage{color}

\specialcomment{answer}{\begingroup\sffamily\color{blue}}{\endgroup}

% exclude the comments
% \excludecomment{answer}

% include the comments
  \includecomment{answer}

\begin{answer}
This is the answer text
\end{answer}
Has anyone had a similar experience, and does anyone have any suggestions about what might be causing this, or how to fix it?

Thank you
Last edited by RJPerkins on Mon Nov 14, 2011 10:09 am, edited 1 time in total.

Recommended reading 2024:

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

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

5gon12eder
Posts: 126
Joined: Sun Feb 13, 2011 8:36 pm

comment | Problem with '\specialcomment' Command

Post by 5gon12eder »

If you remove the line

Code: Select all

\includecomment{answer}
it will work!

Best
I'm using pdfTeX, Version 3.1415926-1.40.10 (TeX Live 2009/Debian).
RJPerkins
Posts: 2
Joined: Sat Nov 12, 2011 10:35 pm

Re: comment | Problem with '\specialcomment' Command

Post by RJPerkins »

Thanks for the speedy reply! I've made the change, and it works perfectly. Thank you very much.
Post Reply