new environment (cst question)

pviton's picture

if I take a cst file and add in the filters section

\newenvironment{Comment}{}{}

and then add a section as follows

[Comment]
ALIAS=Comment
TAG_TYPE=ENV
TAG_BEHAVIOR=LISTSTART
PARAGRAPH_INDENT_LEFT=0
PARAGRAPH_INDENT_RIGHT=0
PARAGRAPH_INDENT_REST=0
PARAGRAPH_LEADING_BEFORE=0
PARAGRAPH_LEADING_AFTER=0
FONT_SLANT=0
TEXT_COLOR=R:0 G:0 B:0
MATH_COLOR=R:255 G:0 B:0
FUNCTION_COLOR=R:128 G:128 B:128
BKGROUND_COLOR=R:212 G:212 B:212
UNIT_COLOR=R:0 G:128 B:0
MATH_SIZE=14
TAGLEVEL=1
TAGBAR_DELETE=0
PARAGRAPH_INDENT_FIRST=0
LEADIN_TEXTJUSTIFY=3
LEADIN_ALIGNLEFT=0

what happens is that when I try to enter a multiline Coment, each line is put in its own Comment environment. In other words I get

\begin{Comment}
stuff
\end{Comment)

\begin{Comment}
more stuff
\end{Comment}

when what's wanted is

\begin{Comment}
stuff
more stuff
\end{Comment}

Is there any way to get the desired behavior?

At one stage I thought I'd figured it out, but it's no longer working.

Thanks!

pviton's picture

George: thanks very much for

George: thanks very much for your help on this. I think I've figured out what's going on, and why I thought I'd solved it before.

Suppose you open a blank document and start a Comment environment (with my original setup: I don't think your suggestion changes this behavior). Type some text, hit return, type some more text, hit return again and then close out the environment with the left-arrow. SWP seems to save this as one Comment environment, as wanted.

But now suppose you have some body text. You select it, and then apply the Comment tag. In this case SWP creates separate Comment environments, one for each line.

So the trick seems to be: if you want everything in one environment, be sure to start the environment first.  I can live with this!

 

 

 

Using the current settings,

Using the current settings, after you start a new paragraph you would press Backspace to pop the tag label giving you a new paragraph in the same environment.

Try changing:

TAG_TYPE=ENV

to:

TAG_TYPE=FIELD