help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how to renumber footnotes?


From: Sharon Kimble
Subject: Re: how to renumber footnotes?
Date: Fri, 17 Apr 2020 18:03:34 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.90 (gnu/linux)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Andreas Röhler <andreas.roehler@easy-emacs.de> writes:

> On 17.04.20 05:58, Sharon Kimble wrote:
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA512
>>
>>
>> Please, can someone help me sort out an org-mode footnote problem?
>>
>> I have 2 org-mode documents called 'file-a' and 'file-b', and both have
>> got several hundred footnotes starting with 1. I'm adding file-b on to
>> the end of file-a, and trying to renumber the footnotes, so that even if
>> file-a has 354 footnotes, and file-b has 421 footnotes, the whole file
>> renumbers the footnotes and continues on from 354 to 355, 356, 357, etc
>> and onwards.
>>
>> But how can I do this please? The org-mode footnote program can't do it,
>> so how do I do it please?
>>
>> (The footnote numbers I've shown are purely arbitrary, some files that
>> I'm wanting to do this with have up to 700 footnotes in their combined
>
> Make sure there is only one footnote-section at the end of file and all fn 
> appear in correct order:
>
> (defun ar-org-footnote-renumber-intern ()
>   (let ((c 0))
>     (while (re-search-forward org-footnote-re nil t)
>       (backward-char 2)
>       (when (looking-at "[0-9]+")
>     (replace-match (number-to-string (cl-incf c)))))))
>
> (defun ar-org-footnote-renumber ()
>   "Renumber footnotes."
>   (interactive "*")
>   (save-restriction
>     (widen)
>     (goto-char (point-min))
>     (when (re-search-forward "^* Footnotes" nil t)
>       ;; first renumber fns in text section, afterwards the
>       ;; fn-definitions
>       (save-restriction
>     (narrow-to-region (point-min) (line-beginning-position))
>     (goto-char (point-min))
>     (ar-org-footnote-renumber-intern)
>     (widen)
>     (when (re-search-forward "^* Footnotes" nil t)
>       (narrow-to-region (line-beginning-position) (point-max))
>       (goto-char (point-min))
>       (ar-org-footnote-renumber-intern))))))
>

Thanks Andreas, but all my footnotes are inline. Perhaps I should've
said that earlier on, sorry!

Perhaps I could put them at the end but I'm too tired at the moment to
think about it, but plenty of time at the weekend, hooray!

Thanks
  Sharon.  
- -- 
A taste of linux = http://www.sharons.org.uk
TGmeds = http://www.tgmeds.org.uk
DrugFacts = https://www.drugfacts.org.uk
Debian 10.2, fluxbox 1.3.7, emacs 27.0.90, org 9.3.6
-----BEGIN PGP SIGNATURE-----

iQJPBAEBCgA5FiEELSc/6QwVBIYugJDbNoGAGQr4g1sFAl6Z4W8bHGJvdWRpY2Nh
c0Bza2ltYmxlLnBsdXMuY29tAAoJEDaBgBkK+INbkEYP/2dwUATppGxBm+wUz4sM
KD76bdvePUB82SN5aXMEy8fBUvgs+ts/zgi/wqafh4s/HHgkxbfBftHaYqTXJXsI
djcNGg84yQBZ28PKZpbpeqB52bjs5pIaUtfoQNUbto0/cS++u0GaLbf4n4nNAR6D
Xu76+45RxOhlMRkJaS89GfvK4rl1ii7UMhyrx054NStQWZg/obz0ihMub7ADzdMq
tajsdfo2/vWbZSk2vlFR4Wt46G334jczz7hVggh8JaIM2Z04ias+SqTfLd47sUE3
QJNAjlRMpnUhC+4Z6lC0P607bU2UKuwPut1rMk7jDds5R06SidkJCDM4T1HwUgv0
ZzSRI30Zqb28FzZ0aP9ec6hAgrADEqsqh+6ueOVR/YUOiIs0vSw2b0E65V+ZfGTP
TuQQV+pzZnvPeOgaVrGcnLEOW5g6skIdC8YWbjpjkyCq+gyV0BUmu6D9jUanjZMT
ZdJouKRHl/MhovcyF6mHgVF+GDvCBM6jI4nT8+iyr3ZFPCU4iLtMReItTFK66nuU
5WVrob1IVi2zr9Vu5g+ku78u7shfQ/2/rSu94uAT5egYZF8q2XUVV1BpyKdItY21
zb54mJci4W0WBOEo28f1NRJlSmFyO36SrDjnALvFYEaomSWQKSLWDhU1J/JKwZ3A
Ot/8PlVpIIwQkNbgBELgRorX
=akPr
-----END PGP SIGNATURE-----



reply via email to

[Prev in Thread] Current Thread [Next in Thread]