Part of Nobumi Iyanaga's website. 5/21/06.

logo picture

Toggle Footnotes/Endnotes macro for Nisus Writer Express v.2.0.x

version 0.7.5 (posted 04.11.08)

One of the best new features of Nisus Writer Express 2.0.x is the ability of handling both footnotes and endnotes. But there is one shortcoming: while Classic Nisus Writer (which could not have the two notes at the same time) could change globally footnotes to endnotes, and vice-versa, now, with NWE, this is impossible. Endnotes can be useful especially because NWE v. 2.0.1 seems to have much difficulty to handle files having many footnotes -- NWE has probably a better performance with endnotes than footnotes.

Now, how to "toogle" footnotes to endnotes, and endnotes to footnotes? In NWE 2.0.x, footnotes and endnotes are distinguished by four style ids, and a keyword. Namely, we have in the raw rtf code these lines (style names, as well as the order, may be different):

{\stylesheet {\s5566 \nisusnoteplacement0 \nisusreferencestyle5567 \sbasedon5568 {\*\nsmpltxt Sample text for Foot/End Notes Style}
\f1 Footnote;}
{\*\cs5567 {\*\nsmpltxt The quick brown fox jumped over the lazy dogs.}
\f1 \super footnote reference;}
{\s5568 \snext5568 {\*\nsmpltxt Some text goes here so you can see what your style will look like.}
{\*\keycode \ncmd `}
\f3 \fs24 \cf1 \ql \sb0 \sa120 \sl240 \slmult1 \li0 \fi0 \ri0 Normal;}
{\*\cs5569 {\*\nsmpltxt The quick brown fox jumped over the lazy dogs.}
\f1 \super Endote Reference;}
{\s5570 \nisusnoteplacement2 \nisusreferencestyle5569 \sbasedon5568 {\*\nsmpltxt Sample text for Foot/End Notes Style}
\f1 Endnote;}

The id-numbers of these styles are different for each file: they seem to be generated as random numbers, at the saving time (so, even an identical file can have different style id-numbers, when it is saved...).

Now, a footnote in rtf code is like this:

{\cs5567 \f1 \super \chftn {\footnote \pard \plain {\s5566 {\cs5567 \f1 \super \chftn }
{\pard \ql \sb0 \sa120 \sl240 \slmult1 \li900 \fi0 \ri520 \tx1280 \tx3420 \tx6660 {\f1 \fs24 \cf1 \lang1033 footnote text.}}}}}

Here, the footnote contents is simply the final "footnote text."; all the preceding "words" are rtf code.

You see that "\cs5567" is the id-number of the style "footnote reference" (it is repeated twice in the rtf code), and "\s5566" is the id-number of the style "Footnote".

Now, here is an endnote in rtf code:

{\cs5569 \f1 \super \chftn {\footnote \ftnalt \pard \plain {\s5570 {\cs5569 \f1 \super \chftn }
{\pard \ql \sb0 \sa120 \sl240 \slmult1 \li0 \fi0 \ri0 {\f1 \fs24 \cf1 \lang1033 footnote text.}}}}}

The differences are:
1. The endnote uses "\cs5569" (twice) which is the id-number of "Endote Reference"
2. It uses "\s5570" which is the id-number of the style "Endnote"
3. After the keyword "\footnote", it inserts another keyword "\ftnalt"

So, if you want to toogle between footnotes and endnotes, you will have to parse the style-sheet information of the file, to get the id-numbers of "Endnote Reference", "Endnote", "Footnote Reference", and "Footnote", and parse the body-text, to do two simple Find/Replace -- in fact, if the id-numbers of styles were fixed, instead of random numbers, we could have avoided the first part of the process...

The version that I posted on 04.10.17 had some important bugs. The new version, 0.7.5, that I post today (04.11.08) should work better...

Anyway, such an operation could be done easily with a Classic Nisus macro. I wrote a Perl macro for NWE, which seems to work.

In Nisus Writer Express 2.5 and later (? -- I am not really sure, but I am sure that this can be done after version 2.6x), one can toggle between footnotes and endnotes (individually, or globally) using a built-in method:

  1. Be sure that you have both footnote and endnote styles (you can verify that in Style View); if you don't have them, you should insert manually, either a dummy endnote, or a dummy footnote;
  2. Select one, or all the footnotes (or endnotes); at the bottom of the window, you see the "Status Bar" with different icons; press the green square with a star inside (the icon which is at the left side): see the image below:
    note_style_tag picture
  3. Select either Endnote or Footenote in the pop-up menu...

Still, my toggle_footnote_endnote macro may be useful in some cases. So I continue to privide this script. [added 06-05-20]

You can download the Perl script from here (1K to download).

Here (1K to download) is a version that should work for Nisus Writer Express 2.7x.

Go to Nisus Macros and Nisus/Frontier combo page
Go to NI Home Page

Mail to Nobumi Iyanaga

frontierlogo picture

This page was last built with Frontier on a Macintosh on Sun, May 21, 2006 at 1:04:20 PM. Thanks for checking it out! Nobumi Iyanaga