[uplatex] rensuji + macro

[uplatex] rensuji + macro

- K Shen の投稿
返信数: 2

Apologies for posting in English.

I'm trying implement in footnote referring only to the line number and if the line number is the same as previous footnote, it's ignored. I save the line number in a counter using \setcounterref from refcount, and compare the counter with line number of the current footnote. 

A minimal working example is as follows. If I use \mynoteref seems work as expected, but \rensuji{\mynoteref{foo}} does not. 

Many thanks in advance. 

\documentclass{utarticle}
\usepackage{lineno}
\usepackage[para*]{manyfoot}
\usepackage{refcount}
\DeclareNewFootnote[para]{A}[alph]
\newcounter{mynotecounter}
\newcounter{mynoterefctr}
\setcounter{mynoterefctr}{0}

\newcommand{\mynote}[2][]{%
  \stepcounter{mynotecounter}%
  \def\temp{#1}% 
  \ifx\temp\empty%
  \FootnotetextA{}{#2}%
  \else%
  \FootnotetextA{}{{\linenumberfont\rensuji{#1}} #2}
  % \FootnotetextA{}{#1 #2} % This works! 
  \fi%
}

\newcommand{\mynoteref}[1]{%
\ifnum \getrefnumber{#1}=\value{mynoterefctr}%
\else%
\setcounterref{mynoterefctr}{#1}%
\ref{#1}%
\fi}

\begin{document}

\linenumbers
Lorem ipsum dolor\linelabel{n1}\mynote[\mynoteref{n1}]{note 1} sit amet, consectetur adipiscing elit\linelabel{n2}\mynote[\mynoteref{n2}]{note 2}. Etiam a urna lacinia\linelabel{n20}\mynote[\mynoteref{n20}]{note 20}, eleifend nulla vel, ullamcorper lectus. Ut gravida odio erat, sed facilisis arcu aliquet sit amet. Mauris venenatis, orci eu pulvinar aliquet, nibh lacus faucibus massa, vel iaculis arcu eros eget lectus. Aenean sed vestibulum orci, et euismod ante. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec in vulputate ligula. Phasellus euismod purus id dictum lobortis. \linelabel{n3}\mynote[\mynoteref{n3}]{note 3}

\end{document}
K Shen への返信

Re: [uplatex] rensuji + macro

- K Shen の投稿
I think I found a workaround by moving \rensuji inside \mynoteref

\newcommand{\mynoteref}[1]{%
\ifnum \getrefnumber{#1}=\value{mynoterefctr}%
\else%
\setcounterref{mynoterefctr}{#1}%
\rensuji{\ref{#1}}%
\fi}
K Shen への返信

Re: [uplatex] rensuji + macro

- 和田 勇 の投稿

Since I'm not very good at English either, I enlisted the help of Deepl and “Mirai Translation https://miraitranslate.com/trial/”.

I inferred that the request was to have consecutive footnote numbers for the footnote section due to the vertical writing,
so I looked into it using [manyfoot.sty][1] manyfoot.sty as a reference.

Before presenting the proposed solution, note that \FootnotetextA{}{#1 #2} is written as % This works!,

but since the footnote number (specified as alph in this case) is not displayed, characters like a or b are not shown.
Is this the intended behavior? If so, the following discussion becomes irrelevant.

Nevertheless, assuming the footnote number should be displayed as usual, here is the proposed solution.

Since \DeclareNewFootnote is declared, \FootnotetextA is being used.
Referencing the URL manyfoot.sty, using \footnteA allows the footnote number to render as a sequence number without needing the \rensuji macro. How about trying the following?

        diff --git a/example.tex b/example.tex
        index 02faa10..d85f5fd 100644
        --- a/example.tex
        +++ b/example.tex
        @@ -11,12 +11,15 @@
        \newcommand{\mynote}[2][]{%
          \stepcounter{mynotecounter}%
          \def\temp{#1}%
          \ifx\temp\empty%
        +    \message{DEBUG in mynote T-side 「\temp」「#1」「#2」}
            \FootnotetextA{}{#2}%
          \else%
        -    \FootnotetextA{}{{\linenumberfont\rensuji{#1}} #2}
        +    \message{DEBUG in mynote F-side 「\temp」「#1」「#2」}
        +    % \FootnotetextA{}{{\linenumberfont\rensuji{#1}} #2}
             % \FootnotetextA{}{#1 #2} % This works!
        +    \footnoteA{#1 #2}% <================= LOOK THIS LINE
          \fi%
        }

If the above is acceptable, it might be possible to define it more simply like this:

        \newcommand{\mynote}[2][]{%
          \stepcounter{mynotecounter}%
          \footnoteA{#1 #2}%
        }