# LyX functions: Nest label from clipboard into inset insert

In writing my thesis in LyX I make frequent use of the label-copy-as-reference function - mainly from equations but also with other labels. The labels are however not pasted as formatted reference which I think I should use for later flexibility (via the refstyle package). Changing every pasted label manually is not my preferred option ;)

Entering the inset-insert function into the mini-buffer

inset-insert ref LatexCommand formatted reference "eq:foo" \end_inset


I mangaged to paste eq:foo in the desired format into my text. How can I nest a function into inset-insert which replaces eq:foo by a previously-copied label (stored in the clipboard)? I was not able to work it out from How to make use of selected text using LyX commands and command sequences?

PS: Many belated thanks to those behind LyX and this great forum!

• Lets see whether @scottkosty can help you with this. – PhilipPirrip Jul 8 '16 at 0:28
• I'm not sure how you could do this within LyX (maybe using "LyX Server"? But that's not really within LyX anyway). You could use a clipboard manager like CopyQ for a macro-type implementation. – scottkosty Jul 8 '16 at 10:08
• Thanks @scottkosty for your feedback! ... Learning to use "LyX Server" unfortunately seems beyond my present skills/time budget :-/ Of course, I would be perfectly happy with an alternative way of copying labels and paste them directly as formatted references. The "cross-reference" dialog keeps the format used last for the next insertion. Is there a way of transferring this to the pasting of cross-references from the clipboard? E.g. any global setting? For now, I will also try using a keyboard shortcut to dialog-show ref. – dasausTeR Jul 8 '16 at 13:46
• Maybe using command-sequence to first paste, then char-backward, then inset-modify with the appropriate arguments? Another answer would be that there is currently an open bug (I believe) asking that the reference is introduced in the last remembered formatting. Maybe this would solve the issue as well. – G.M. Jul 8 '16 at 20:04