Tobias Krause wrote:
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?
LyX will break the line when it thinks it has reached some line-length
limit in the .tex file. Whether that limit is self-imposed or defined
externally I do not know. You *can* see what will be lost, though, at
least with current versions (1.5.x) of LyX. Put the cursor near the ERT
and click View -> View Source. A view of the .tex output will open in
the lower half of the window, and the part that LyX thinks is a comment
will be grayed out.
IIRC, LaTeX will interpret a single line break as "continue the
paragraph but insert a space". If you do not want that space, the line
break will create a problem.
It is not beyond the bounds of possibility that the space could cause
problems. For instance, using [[]] to indicate an ERT inset, I will
frequently do something like this in LyX:
[[\weirdfunction[optional argument]{]]some normal text here[[}]].
Doing it this way, rather than putting everything in ERT, allows me to
use the spellchecker, the math editor etc. on the part between the two
ERT insets. Off-hand, I cannot think of any instances of this where an
initial space would be problematic, but neither can I rule it out.
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...
Done in the source view. If you think the user needs to see some
indication in the main body of the GUI, you could file an enhancement
request via bugzilla. My guess, though, is that insertion of comments
in in-line ERTs is pretty rare. Yours was the first post I've seen
concerning it, and I've been on the list since around LyX 1.3.5.
Cheers,
Paul