Using Comment notes the right way

Richard Kimberly Heck rikiheck at gmail.com
Wed Nov 15 22:31:31 UTC 2023


On 11/15/23 05:47, Daniel wrote:
> I recently discovered that I might have been using LyX Notes while I 
> should have been using Comment notes. I was wondering why LyX Notes 
> inherit the font (https://www.lyx.org/trac/ticket/12939). Comment 
> notes do not inherit the font of the surrounding text which seems 
> sensible for a comment. LyX Notes inherit and they seem to be fitting 
> for commenting out parts of a document out.
>
> My guess is that the commenting feature is what people typically 
> expect when inserting a "sticky note" (see PDF readers' similar 
> features and other word processors). The prominent positioning of LyX 
> Notes (as the only notes in the toolbar) and the visualization (as a 
> sticky note) seems to have mislead me over the years to expect that 
> they are the analogue for what is found in other applications. What I 
> really wanted to do most of the time is put a comment into the text.

The difference is that comments are exported as comments, whereas notes 
are never exported. So I would use a comment where in LaTeX I would do:

% this is a comment

This is probably not a very common thing for most users to do. I'm not 
sure I've ever used a comment! I always use LyX Notes for, well, notes 
to myself (or my collaborators), which I do not usually want in the 
exported LaTeX (which I might be sending to a journal).

That said, LyX uses a comment *environment* for the export, which means 
that you can \renewenvironment{comment} if you want them printed somehow.

It would be possible (and might make good sense) to make the toolbar 
button a drop down sort of thing, like with View, so you could choose 
the note type from there.


> A couple of things would be nice.
>
> 1. Make Comments more prominent and visualize them as sticky notes 
> instead of LyX Notes.

I'm curious whether you still think this is needed, given what I've just 
said. I'm also not sure what you mean by "visualized as sticky notes". 
Comments and notes look the same to me (in LyX), except for the color 
choices.


> 2. Allow free spacing in Comments. That is typically a feature in 
> sticky notes in other applications which is handy if one wants just to 
> quickly type stuff down without bothering with special formatting.

Easy to do in Local Layout. Not to say it wouldn't be a good default. I 
wouldn't want to do it now, though, as that is a format change (since 
'free spacing' would get eaten on conversion to older formats).


> 3. Make it optional whether Comments are exported or not. Another 
> typical feature. There could be both a global (for all comments) 
> setting and a local (for individual comments).

Comments are always exported---as comments. If you want to make export 
conditional (in a broadly global way), then use branches. Or you can do 
something like:

InsetLayout Note:Comment
     LatexName MyComment
     Preamble
         \newenvironment{MyComment}{...}{...}
     EndPreamble
End

To get local control, define a Flex inset and give it an argument which 
acts as a flag: Visible or not. I.e., if the flag is empty, it acts like 
a comment; if not, then it acts like some other environment, or just 
prints the argument.

One thing that would be cool, actually, would be to be able to define 
new kinds of Note insets, the way we do Flex insets, but have them then 
be handled like other notes. E.g.:

InsetLayout Note:MyNote
     Etc
End

And now that would appears in the Notes menu and context menu.

Riki




More information about the lyx-devel mailing list