jspitz / covington

Maintenance of the covington LaTeX package
9 stars 0 forks source link

How to set up a separate numbering in footnote? #12

Closed ganlinghui closed 2 years ago

ganlinghui commented 2 years ago

How can I make it automatically use a separate numbering in footnote, for instance, I want the examples in the footnotes to be continuously listed in roman numbers (i), (ii), (iii). Thank you in advance!

jspitz commented 2 years ago

Quick and dirty:

\makeatletter
\newif\ifinfootnote\infootnotefalse
\let\origfootnotetext\@footnotetext
\long\def\@footnotetext#1{\infootnotetrue\origfootnotetext{#1}\infootnotefalse}

\newcounter{fnex}[footnote]
\renewcommand{\thefnex}{\roman{fnex}}

\renewenvironment{covexamples}%
{%
    \begin{list}{\covexamplenofs\covexnumber{\ifinfootnote\thefnex\else\@@exampleno\fi}}%
        {%
            \addtolength{\labelwidth}{\examplenumbersep}%
            \addtolength{\leftmargin}{\examplenumbersep}%
            \addtolength{\leftmargin}{\exampleind}%
            \ifinfootnote
              \setcounter{covexsave}{\arabic{fnex}}%
              \usecounter{fnex}%
              \setcounter{fnex}{\arabic{covexsave}}%
            \else
              \ifownexcounter
                \setcounter{covexsave}{\arabic{covex}}%
                \usecounter{covex}%
                \setcounter{covex}{\arabic{covexsave}}%
              \else
                \setcounter{covexsave}{\arabic{equation}}%
                \usecounter{equation}%
                \setcounter{equation}{\arabic{covexsave}}%
              \fi
            \fi
            \setlength{\listparindent}{0pt}%
            \def\makelabel##1{##1\hfil}%
        }%
        \raggedright\covexamplefs}%
    {\end{list}}
\makeatother
ganlinghui commented 2 years ago

Thanks a lot! It partially worked. The roman number list only continues within a footnote but not across footnotes. Each footnote starts with (i) instead of resuming from the previous footnote example. How can I make the new counter work across footnotes? something like the following. Thank you!!


  1. xxxx(Footnote 1) (i) Example 1 (ii) Example 2

  2. xxxx (Footnote 2) (iii)

Best, Eva

On Wed, Jun 29, 2022 at 2:06 AM Jürgen Spitzmüller @.***> wrote:

Quick and dirty:

@.**@.#1{\infootnotetrue\origfootnotetext{#1}\infootnotefalse} \newcounter{fnex}[footnote]\renewcommand{\thefnex}{\roman{fnex}} \renewenvironment{covexamples}% {% \begin{list}{\covexamplenofs\covexnumber{\ifinfootnote\thefnex\else\@@exampleno\fi}}% {% \addtolength{\labelwidth}{\examplenumbersep}% \addtolength{\leftmargin}{\examplenumbersep}% \addtolength{\leftmargin}{\exampleind}% \ifinfootnote \setcounter{covexsave}{\arabic{fnex}}% \usecounter{fnex}% \setcounter{fnex}{\arabic{covexsave}}% \else \ifownexcounter \setcounter{covexsave}{\arabic{covex}}% \usecounter{covex}% \setcounter{covex}{\arabic{covexsave}}% \else \setcounter{covexsave}{\arabic{equation}}% \usecounter{equation}% \setcounter{equation}{\arabic{covexsave}}% \fi \fi \setlength{\listparindent}{0pt}% \def\makelabel##1{##1\hfil}% }% \raggedright\covexamplefs}% {\end{list}}\makeatother

— Reply to this email directly, view it on GitHub https://github.com/jspitz/covington/issues/12#issuecomment-1169570430, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANUJXD3B4HKW5GK47TTJ4J3VRPRXFANCNFSM52EBAMUQ . You are receiving this because you authored the thread.Message ID: @.***>

jspitz commented 2 years ago

Changing \newcounter{fnex}[footnote] to \newcounter{fnex} should do it.

jspitz commented 2 years ago

The next version will feature an option ownfncounter which adds a continuous roman counter within footnotes and an option resetownfncounter which will reset this counter at each footnote.

jspitz commented 2 years ago

The next version will feature an option ownfncounter which adds a continuous roman counter within footnotes and an option resetownfncounter which will reset this counter at each footnote.

Now renamed to ownfncounter (not reset) and ownfncounter* (reset).

ganlinghui commented 2 years ago

That’s great! Thank you!

On Tue, Jul 26, 2022 at 10:36 Jürgen Spitzmüller @.***> wrote:

The next version will feature an option ownfncounter which adds a continuous roman counter within footnotes and an option resetownfncounter which will reset this counter at each footnote.

Now renamed to ownfncounter (not reset) and ownfncounter* (reset).

— Reply to this email directly, view it on GitHub https://github.com/jspitz/covington/issues/12#issuecomment-1195567636, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANUJXD2ZDQQWVVGQ7EPQODTVV7ZWFANCNFSM52EBAMUQ . You are receiving this because you authored the thread.Message ID: @.***>

jspitz commented 2 years ago

V. 2.8 with this feature has just been uploaded to CTAN.