Footnote Codes

I’m trying to find a way to parse footnotes out of a document.

I’ve seen something like this before on the forums, but for the life of me I cannot think of what the appropriate terms would be.

I’m editing together memoirs for my grandfather, using bits and pieces from letters, interview, newspaper reports, the backs of photographs, etc etc.

All of this is being organised in a Filemaker database I’ve created, and as I assign various bits and pieces to places and to people, they are organised by date into a sort of automatic raw biography for each person - Each record is headed with the date, place, and approx age,folowed by notes, the quoted passage, and then the source.

It works very well for organising what followed what, but so far as a memoir goes, strict chronology isn’t going to help, and of course I will have to edit here and there to make things flow.

I want to be able to maintain a source for each snippet, so that I or anyone else can always refer back to both the source and the verbatim transcription if needed.

This is where I want to use some sort of footnote parsing.

I have an idea from this forum long ago that it’s possible to insert some bit of code that says “A Footnote begins here” and the same sort of thing at the end of a footnote, which some programme somewhere can read.

I can then output this fairly easily from filemaker.

Does anyone know what I’m talking about?

Or have I made this up?

Are you intending to work with Scrivener on this project? If so, you could just place Scrivener’s footnote code into the document. It’s a little on the bulky side, but here you go:

{\Scrv_fn=Content of the footnote goes here\end_Scrv_fn}

Even if you just paste that into a Scrivener document it will come up like a footnote; also works on import, too from plain-text or RTF.

If you intend to do that a lot, I’d recommend looking at a text expansion tool like Typinator or TextExpander. Both of them have a way of inserting a chunk of text and then moving your cursor to the middle of the chunk where you tell it to go.

Thanks Amber - I want to work in Scrivener so this solution is ideal.

However, although the footnote is applied, instead of just putting a number on the page (or the footnote itself in a grey bubble like it used to) it has “(Unnattached Footnote)” in the grey bubble.

It shows up like this when it is exported as a pdf as well.

Is there a way to “attach” the footnote?

When you click on it, does it still open up the content in the sidebar? I’m thinking the way you placed it, it might not know where to put it in the text. You could try either using plain-text, or if that is not an option, set your Import & Export settings to import RTF footnotes as inline. Once you get them in, you can always convert them to linked if that is what you prefer, using the Format/Convert sub-menu.

Try copying and pasting my prior post, too. That worked just fine for me both ways. If I pasted it into a text file and imported it, I get an inline footnote with a bubble around it. If I pasted it into an RTF file and then imported that (with inline disabled in the above preference) then it attached the footnote to “go:” which is what it should do.

If that worked but you text refuses to, double-check that all of the red-marked stuff above is included. It can have spaces around it, that’s fine—the footnote will just have spaces around it which are okay in Scrivener; it strips those out when you compile.

Thanks - I’ve figured it out now.

I was pasting the code directly into a page on scrivener.

When I do the same in a textedit document and import it it works.

The final word before the footnote was in a grey box - can this be adjusted to include whole passages somehow?

And if so, do you know whether if I separate, say, a paragraph that’s in the grey box into separate snippets a few words long, whether each would end up with the same footnote attached.

This is a rather crude way of inserting footnotes. :slight_smile: It basically pops into existence without any attachment information, so Scrivener does the best it can and attaches it to the last available word. It would have no way of discerning what you would prefer in terms of highlighting contextually relevant phrases. Once it does that, there is a bunch of extra information in a whole separate file that you can’t even see—it would not be easy (and really not recommended) to try and insert them via that control file, which is the only way you could define phrases. You’d need to know the precise byte offset of the start and stop position.

On the second question: footnotes are homogenous. It is not possible to split up the highlighted area into multiple pieces and have them all point back to one note. There is one single trailing edge: and that edge defines where the reference mark will be placed. It sounds like maybe inline footnotes would fit better with what you are trying to do? They are less dependent upon the text around them since they just float there at the anchor point.

This is great news.

I work on a regular basis with plain text coming from an AlphaSmart Dana. When I got the text on the Mac, either in Scrivener or another application, I apply a TextSoap cleaner on it to turn xxx into xxx and stuff like that. But I never could do this with footnotes. Until now.

Could you give us a little more Scrivener codes, Amber? Like for inline footnotes (I prefer the new inspector footnotes but one day I might go for both footnotes and endnotes)?

This code is actually mode agnostic. Whether or not it comes in as inline or linked is dependent upon your preferences in the Import & Export pane. For me, they come in as inline because that is my preference set, for you they come in as linked—but they are both using the same code.

The only other code that works like this is annotations, which is a little more bulky even than footnotes (unlike footnotes these will always come in as inline and that’s all you can do):

{\Scrv_annot \color={\R=1.000000\G=0.000000\B=0.000000} \text=Content of the annotation.\end_Scrv_annot}

The numbers in the middle are for the colour. It is a floating point between 0 and 1. So in this case, the annotation is pure R (red).


If anyone needs a TextSoap cleaner—it will work at least similarly with other find and replace functions using regular expressions—for generating Scrivener footnotes with the code provided by Amber, here it is.

I used the Franc symbol ƒ as a delimiter for footnotes but of course you can use whatever you want unless it is already in use in your text.

It had to be done in two steps as I didn’t find a way to insert a backslash in a cleaner with regular expressions activated.