Warning on encapsulated TeX fields

pviton's picture

I inserted an encapsulated TeX field --- contents \\enlargethispage{1in}--- into my document, and it worked as expected. Later I found that I no longer needed it. But since I thought I might need it again later, I decided to just comment out the contents, by putting a % in front of the command. When I did this, and saved my document, it was truncated at the field, with no warning. I was able to recover most of it from a backup; but still, it's a concern. The moral seems to be never to leave a commented-out encapsulated TeX field in your document. (I haven't tested to see whether the problem was with this particular command).

Barry MacKichan's picture

Do you see the same effect

Do you see the same effect when you view the source? I would guess you do.

pviton's picture

Yes I do (everything below,

Yes I do (everything below, and including, the TeX field is gone).

(and sorry, I meant to post this to the SWP5 section, not SN; feel free to move/copy it if you think it's appropriate).

texab's picture

% is notorious for giving

% is notorious for giving problems in SW This because its a TeX active character. Do instead


in the preamble. Then make encapsulated fields for \command and \endcommand. Call then [command] and [endcommand]
then [command] ... anything ... [endcommand] will do what you want.

pviton's picture

Thanks for the suggestion: I

Thanks for the suggestion: I hadn't realized there were problems with the % character in SW.

On the other hand, it may be of interest to know that I did the experiment in SWP6 (using the Std Latex Article): there were no problems (the file stayed intact, even with a commented-out command).

I moved this topic from the

I moved this topic from the SNB 5.5 to the SWP 5.5 area.