[Tex/LaTex] way to position a footnote in LyX without using TeX code “manually”

footnoteslyxpositioning

I'm using the tufte-latex document class with LyX and would like to adjust the positions of some "footnotes" in my document by specifying an offset. I understand that I can do this manually by replacing the footnote that appears in LyX (which generates \footnote{...} in the source) with the code

\sidenote[][<offset>]{...}

but am wondering whether there is a way to do this through the LyX UI so that I don't have ERT cluttering up the document (yes, I know; but that's what LyX is for). Many environments and commands in LyX provide simple ways to add options in this way (e.g. enumitem lets you add options with Insert > Short Title) but I don't see how to do it for footnotes.

Best Answer

You could write a module looking roughly like this:

#\DeclareLyXModule{Sidenotes}
#DescriptionBegin
#Inserts sidenotes in the output.
#DescriptionEnd
# Author: Florian Rubach

Format 11

InsetLayout sidenote
    LyXType               custom
    LabelString           "Sidenote"
    LatexType             command
    LatexName             sidenote
    Decoration            classic
    LabelFont
      Color               cyan
      Size                Small
    EndFont
    MultiPar              false
    OptionalArgs          2
    Preamble
        \RequirePackage{sidenotes}
    EndPreamble
End

Save this to a file named sidenotes.module, put it in your lyx user directory under the folder layouts (on win7 something like C:\Users\YOURNAMEHERE\AppData\Roaming\LyX2.0\layouts, can be seen by pressing help>about LyX in the main menu).

Then, you need to reconfigure LyX via Tools>reconfigure and restart it.

You can then add the new module via Document>Settings>Modules.

Inserting a sidenote works then by pressing Insert>Custom>Sidenote. Unfortunately, it does not accept optional arguments right now, which can otherwise be inserted the lyx way via Insert>short title. I'll inquire about this.