1

I am trying to use the functions buffer to convert all my marginal notes to footnotes. I tried this command :

inset-forall marginalnote inset-modify footnote

but marginalnote and footnote are not the correct words. I couldn't find the correct way to refer to marginal notes in the LFUN documentation. Thanks for any help.

1

The following is a hack, and you should backup your .lyx file and expect something to go wrong. After backing up, and exiting LyX, run the following command on your .lyx file:

sed -i 's/^\\begin_inset Marginal$/\\begin_inset Foot/' <your_lyx_file>

Explanation: A .lyx file is a plain-text file that has its own format. It is not recommended to edit it directly, and that is why I gave the disclaimer above. The above sed command just replaces instances of \begin_inset Marginal with \begin_inset Foot. If you are not on Linux, you can open the .lyx file in a text editor that supports find & replace and modify accordingly.

Regarding the approach you tried, it was a good idea and LyX should support such conversions via LFUNs ("LyX [Internal] Functions"). I think there's a decent chance such conversions will be supported at some point in the future, but that's just a guess. I'll give a few details on your approach, even though it doesn't currently work: To find the name of the layout, you need to look at the layout definition. For Marginal Notes, this happens to be stored in the file stdinsets.inc on your computer. Looking in that file, the correct name is "Marginal". Alternatively, I think you could also open the .lyx file in a text file and find the name. Indeed, the following command works to close all Marginal notes: inset-forall Marginal inset-toggle close. Unfortunately, I don't know of an easy way to convert a Marginal to a footnote using LyX functions (you could do something like select all, cut, delete, begin footnote, paste, but that will be annoying to write all that). There should be an easy way to do this with LyX commands, but I don't think there is currently an easily implemented way to do it. I don't think that inset-modify changetype currently supports your desired conversion.

  • Thanks! Indeed it seems a combination of commands would have to be used. Replacing in the source worked. – n49o7 Jul 17 '18 at 16:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.