Tobias Krause wrote:
Hi Paul,
some text [[%comment ]] more text
where [[]] is an ERT box, then "more text" will look to LaTeX like
part of the comment, because LyX will (properly) not insert a line
break after the ERT box. This would IMHO be proper behavior.
Sounds like proper behavior, but there are some remarks:
1. This is totally uncontrollable for the user: if "more text" is a
long text, the user does not know where LyX will break the line -
and so it's not possible to know which text will be show up in the
output. From this point of view there would be no advantage of
this behavior, is there any reason for not inserting a line break
after ERTs?
There is plenty of reason. ERT can be used in cases where the
latex command inside ERT acts on the following text.
For example, a command that makes higlights the next
character in some way, such as those big characters that
start chapters in some books. Getting an extra newline wouldn't
work in that case.
Or:
ERT \texcommand{ <some lyx construct or text> ERT}
The texcommand used might be one that can't handle newlines.
As for user control - the user can put a linebreak after his
ERT comment and avoid this issue. No problem once you know.
Using ERT is an expert option.
2. Even though this behavior is proper it is risky for the user,
because there is no visual indication for a behavior which might
not be obvious or which is just triggered without knowing. Maybe
it'd be possible to gray out the text which will be gone or to do
something else to show what will happen...
ERT is there for using latex features that LyX doesn't already
support directly, so LyX has no hope of understanding what's
inside an ERT box. If you want a comment LyX understands,
insert a note behind the ERT box.
Now the % comment seems simple enough but this is not so,
it is possible to write latex commands redefining % to
do something else instead of "comment to the end of the line".
This sort of thing is why LyX just leaves user-defined latex alone.
Helge Hafting