reledmac :在另一个命令/环境中禁用关键脚注

reledmac :在另一个命令/环境中禁用关键脚注

我有一个自定义命令,它接受一个参数并打印它,同时将其添加到脚注中。我使用的是普通脚注和关键脚注,均来自 Reledmac。

在这篇文章中(避免在脚注内添加脚注),我学会了在命令内部重新定义宏,并且解决了一些冲突。

\newcommand{\FoundBelowLine}[1]{%
    {#1}\footnoteA{%
        \begingroup%
        \let\footnoteE\@gobble%
        {#1} - इति पङ्क्तेरधो लब्द्धम् ।%
        \endgroup%
    }%
}%

现在,在某些情况下,我必须在文本中添加关键的脚注。在这种情况下,我面临! Package reledmac Error: \edtext outside numbered paragraph (\pstart ... \pend ).

因此,我尝试使用之前学习的@gobble命令在命令中重新定义它。但是,它仍然会产生相同的错误。

\newcommand{\FoundBelowLine}[1]{%
    {#1}\footnoteA{%
        \begingroup%
        \let\footnoteE\@gobble%
        \let\Afootnote\@gobble%
        {#1} - इति पङ्क्तेरधो लब्द्धम् ।%
        \endgroup%
    }%
}%

显然,在普通脚注中添加 \Afootnote 对关键脚注不起作用。

再次澄清一下,我提供了一个参数并将其打印为正文和脚注,并且向该参数(文本)添加关键脚注以将其仅添加到正文中是行不通的。

任何帮助都将受到赞赏。

MWE 附于下面。

\documentclass[twoside]{book}

\usepackage[paperheight=8.3in,paperwidth=5.8in,margin=1in]{geometry}
\usepackage[parapparatus]{reledmac}

\makeatletter
%\newcommand{\FoundBelowLine}[1]{{#1}\footnoteA{{#1} - was found below line.}}
\newcommand{\FoundBelowLine}[1]{%
    {#1}\footnoteA{%
        \begingroup%
        \let\MSSWrongReading\@gobble%
        \let\MSSLineEnd\@gobble%
        {#1} - इति पङ्क्तेरधो लब्द्धम् ।%
        \endgroup%
    }%
}%

\newcommand{\FoundLeftMargin}[1]{{#1}\footnoteA{{#1} - was found in left margin.}}
\newcommand{\FoundRightMargin}[1]{{#1}\footnoteA{{#1} - was found in right margin.}}
\newcommand{\MSSWrongReading}[2]{{#1}\footnoteC{{#1} - is not correct. It should be {#2}.}}
\newcommand{\MSSLineEnd}[1]{\footnoteD{{#1} line ends here.}}
\makeatother
\begin{document}
    \beginnumbering
    \pstart
        %This compiles, obviously.
        \FoundBelowLine{
            \textbf{
                Some text in the main body of MSS.
            }
        }
    
        %This doesn't. 
        %I'll like to use the first argument of \MSSWrongReading{arg1}{arg2} so that footnote has all words. So, we can't fully ignore the macro.
        % We solved it a few months ago.
        \FoundBelowLine{
            \textbf{
                Some text in the main \MSSWrongReading{doby}{body} of MSS.
            }
        }
    
    
        %This also doesn't compile. Here I want to use the \MSSLineEnd{arg1} when it is use by \FoundBelowLine{arg1} as main text, but want to totally ignore when it is used by the same command inside \footnote command.
        % We solved it a few months ago.
        \FoundBelowLine{
            \textbf{
                Some text in the main body of\MSSLineEnd{1} MSS.
            }
        }
        % The below is a sample of critical footnote. It work.
        \edtext{below}{%
            \lemma{}%
            \Afootnote{%
                What do you mean by below?
                Below means just below the line, not at bottom of the page  
            }%
        } 
        % The below is a sample of critical footnote inside a normal footnote, caused by my multipurpose command.
        %   This fails.
        \FoundBelowLine{%
                Here is some text which was just \edtext{below}{%
                    \lemma{}%
                    \Afootnote{}%
                } line.%
            }
        
        
    \pend
    \endnumbering
\end{document}

答案1

我不太明白你期望的最终输出是什么。但是,我知道你不想在熟悉的脚注里放关键的脚注(即使想要,relemac 也无法做到,我也没时间做这件事),

您真正需要的不是禁用关键脚注,而是将 edtext 转换为仅读取第一个参数的宏。事实上,\edtext 必须包含关键注释(或尾注)。如果不包含,reledmac 会给出错误。

所以你只需要让它edtext发生@firstoftwo

\documentclass[twoside]{book}

\usepackage[paperheight=8.3in,paperwidth=5.8in,margin=1in]{geometry}
\usepackage[parapparatus]{reledmac}

\makeatletter
%\newcommand{\FoundBelowLine}[1]{{#1}\footnoteA{{#1} - was found below line.}}
\newcommand{\FoundBelowLine}[1]{%
    {#1}\footnoteA{%
        \begingroup%
        \let\edtext\@firstoftwo
        \let\MSSWrongReading\@gobble%
        \let\MSSLineEnd\@gobble%
        {#1} - इति पङ्क्तेरधो लब्द्धम् ।%
        \endgroup%
    }%
}%

\newcommand{\FoundLeftMargin}[1]{{#1}\footnoteA{{#1} - was found in left margin.}}
\newcommand{\FoundRightMargin}[1]{{#1}\footnoteA{{#1} - was found in right margin.}}
\newcommand{\MSSWrongReading}[2]{{#1}\footnoteC{{#1} - is not correct. It should be {#2}.}}
\newcommand{\MSSLineEnd}[1]{\footnoteD{{#1} line ends here.}}
\makeatother
\begin{document}
    \beginnumbering
    \pstart
        %This compiles, obviously.
        \FoundBelowLine{
            \textbf{
                Some text in the main body of MSS.
            }
        }

        %This doesn't.
        %I'll like to use the first argument of \MSSWrongReading{arg1}{arg2} so that footnote has all words. So, we can't fully ignore the macro.
        % We solved it a few months ago.
        \FoundBelowLine{
            \textbf{
                Some text in the main \MSSWrongReading{doby}{body} of MSS.
            }
        }


        %This also doesn't compile. Here I want to use the \MSSLineEnd{arg1} when it is use by \FoundBelowLine{arg1} as main text, but want to totally ignore when it is used by the same command inside \footnote command.
        % We solved it a few months ago.
        \FoundBelowLine{
            \textbf{
                Some text in the main body of\MSSLineEnd{1} MSS.
            }
        }
        % The below is a sample of critical footnote. It work.
        \edtext{below}{%
            \lemma{}%
            \Afootnote{%
                What do you mean by below?
                Below means just below the line, not at bottom of the page
            }%
        }
        % The below is a sample of critical footnote inside a normal footnote, caused by my multipurpose command.
        %   This fails.
        \FoundBelowLine{%
                Here is some text which was just \edtext{below}{%
                    \lemma{}%
                    \Afootnote{}%
                } line.%
            }


    \pend
    \endnumbering
\end{document}

相关内容