Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Insert Footnote

New Here ,
Dec 16, 2009 Dec 16, 2009

I have a book with hundreds of endnotes that need to be converted into footnotes. Does anyone know of a script to insert a footnote and format it? I think what would need to happen is that you would be able to copy the endnotes, one at a time, click an insertion point where the footnote reference would be and run the script to insert the text as a footnote and apply the style "footnote" to it; it would be nice if it would add a tab before the footnote number too! I can do it fairly efficiently just uting keyboard shortcuts but I could halve the time with a script.

Any advice would be greatly appreciated!

TOPICS
Scripting
910
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Dec 16, 2009 Dec 16, 2009

O-o-o -- the safe way to handle local overrides is to replace them with character styles (and my own preptext does this).

Try this new script; the applyParagraphStyle function has an optional argument 'override', which, when set to false, will not override locally applied formatting.

fn = app.selection[0].footnotes.add();

fn.texts[0].insertionPoints.item(-1).select();

app.paste();

// fn.texts[0].appliedParagraphStyle = "note";

fn.texts[0].applyParagraphStyle(app.activeDocument.paragraphStyles.item("no

...
Translate
Community Expert ,
Dec 16, 2009 Dec 16, 2009

Sure. Copy (or Cut) something, and make sure there is no hard return at the end (that's real ugly, as it would add a blank line at the bottom of the note). Then go to the position where you want the footnote, then run this script:

fn = app.selection[0].footnotes.add();

fn.texts[0].insertionPoints.item(-1).select();

app.paste();

fn.texts[0].appliedParagraphStyle = "note";

(Replace the style name "note" with the one you want.)
There is no need for the script to insert a Tab after the footnote number; you can set that in the Document Footnote Options (adding one tab is even the default setting).
Fastest way to do this would seem to open another window, focused on the end notes. Switch windows, cut, switch windows, click the right place, run script. Repeat until done, or sufficiently bored to call it a day. For hyperspeed, add a shortcut key to the script!

[Ed.] I should probably tell you it's a Javascript, so save it with extension ".jsx".

[Ed#2] Oops. Tab should go before the note number. Okay, add this line after the last one:

fn.insertionPoints.item(0).contents = "\t";

(What's with the ugly formatting under a piece of code? Another jive-up!)

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 16, 2009 Dec 16, 2009

Thank you very much!! That works great and will save me tons of time (and I did make a shortcut to the script). The only refinement would be if it could be made to apply the style without stripping out the formatting (italics) that appear in some of the notes.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 16, 2009 Dec 16, 2009

O-o-o -- the safe way to handle local overrides is to replace them with character styles (and my own preptext does this).

Try this new script; the applyParagraphStyle function has an optional argument 'override', which, when set to false, will not override locally applied formatting.

fn = app.selection[0].footnotes.add();

fn.texts[0].insertionPoints.item(-1).select();

app.paste();

// fn.texts[0].appliedParagraphStyle = "note";

fn.texts[0].applyParagraphStyle(app.activeDocument.paragraphStyles.item("note"),false);

fn.insertionPoints.item(0).contents = "\t";

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 17, 2009 Dec 17, 2009
LATEST

Thank you again, that works perfectly.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines