0

I use the "Comment package" to write exercises with or without solutions. But I also want to use the "Sagetex package" to write the solution without typos. There seems to be an incompatibility between the Comment package and the Sagetex one. I get the following cryptic message: "Bad space factor (0). \end{comment}" What does the message mean and is there a way to workaround this?

MWE:

\documentclass{article}`
\usepackage{sagetex}`
\usepackage{comment}
\begin{document}
This sentence
\begin{comment}
has
\end{comment}
no verb.
\end{document}
1

The packages should be loaded in reverse order:

\documentclass{article}
 \usepackage{comment}
 \usepackage{sagetex}

 \begin{document}
 This sentence
 \begin{comment}
 has
 \end{comment}
 no verb.
 \end{document}

In any case the conditional compilation with a declared environment:

\includecomment{thisone}
\excludecomment{notthisone}

works whatever the loading order of the two packages.

\documentclass{article}
\usepackage{comment} %allows conditional compilation
\usepackage{sagetex}%For computing with SAGE within the text
\includecomment{thisone}
\excludecomment{notthisone}

\begin{document}
This sentence
\begin{comment}
has
\end{comment}
no verb.
Check for\begin{notthisone}
superfluous
\end{notthisone}
spaces and around
\begin{thisone}
inclusion
\end{thisone}
of proper texts.
\end{document}

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.