On 08/11/2016 04:53 PM, Bernt Lie wrote:
>
> I have used SWP a lot in the past, and really like that product
> (despite some limitations). They support “fragments” which is really
> great:
>
> ·        Mark any part of a document, and save this marked part as a
> “fragment” in a file of a given name.
>
> ·        Then call back this fragment by typing Ctrl+ fragment name at
> any time (v 5.5). (Use of the Ctrl key makes it slightly complex to
> type, so there may be better ways).
>
> ·        Examples of fragments could be (I) horizontal fill + math
> \blacktriangle (e.g named endex – end of example) (ii) a floating
> table with center table (e.g, mytab), (iii) similar for figures (e.g,
> myfig), (iv) a symbol for scaled variables (e.g, scaled), (v) an empty
> data list object set to the Python language, numbered lines on the
> left side with smallest font using typewriter font (e.g, mypython),
> etc., etc.
>
> In summary: fragments are great – very useful, and very intuitive to
> use! Sorely missed.
>

You can approximate this behavior by copying the fragment to a LyX file
and then using Insert> File> LyX Document to insert it. You can bind the
file-insert command to a keystroke to make it easier to open the
relevant dialog, if you wish. And if you have some file you want to
insert a lot, you can bind a key to something like "file-insert
/path/to/myfile.lyx". Though, at the moment, that does not seem to be
working for me. Hmm. I'll investigate.

For short things, it's maybe easier to define a shortcut, as someone
else explained, using command-sequence.

These seem to be like "snippets" in other programs. I've never really
used them myself, but I can see why someone might like to do so. To be
honest, though, in LaTeX, this sort of "cut and paste" behavior always
seems wrong to me: If there's something you want to insert a lot,
especially in some regular way, it is best to define a command for it.
Then you have more control over it. E.g., you could change all instances
of it by re-defining the command. This seems especially true when it
will be part of every environment of a certain kind. Note that LyX
actually tries to encourage this "semantic" way of thinking.

It would be nice if LyX allowed for "text macros" the way it allows for
"math macros". That would make this sort of thing much easier. There's a
long-standing wish for this....

Richard

Reply via email to