maieul / ledmac

package reledmac for latex
http://www.ctan.org/tex-archive/macros/latex/contrib/reledmac
54 stars 28 forks source link

How to disable only certain footnotes #956

Closed BatrachosPyktes closed 1 year ago

BatrachosPyktes commented 1 year ago

In only want to suggest: It would be cool if one could disable not all, but only certain Xfootnotes.

Version

2023/07/21 v2.39.5

TeX Engine

LuaLaTeX

Description

It is no problem, only a suggestion. Let me give you an example: Someone creates a selection of Latin texts for, e.g., classes in a gymnasium; at the same time he wants an expanded version of the document for teachers. The students need only help with unknown words (\Bfootnote), the teachers get also an apparatus criticus (\Afootnote) and additional information (\Cfootnote). One could even use filecontents for each text, so one document consists of the texts (\includefiles) with helps for Latin words (\Afootnote), the other of the same (or more) texts with \Afootnote, Bfootnote, \Cfootnote. It's much work to copy all texts from the second file and to remove all \Afootnotes and \Cfootnotes. And if you change the texts or add Xfootnotes, you have to be very careful not to miss anything in the other document.

That's it.

Minimal Working Example

\usepackage[nocritical={A,C}, series={B}]{reledmac}

maieul commented 1 year ago

Well, you made confusion : nocritical features does not disable critical footnotes, but avoid to define \footnoteX and related macro. It is ONLY a performance option, not a "disable in asking" option.

In your example case, the best would be to define you own macro. For the teacher

\newcommand{\apparatus}[2]{\edtext{#1}{\Afootnote{#2}}
\newcommand{\help}[2]{\edtext{#1}{\Bfootnote{#2}}
\newcommand{\more}[2]{\edtext{#1}{\Cfootnote{#2}}

for the student

\newcommand{\apparatus}[2]{#1}
\newcommand{\help}[2]{\edtext{#1}{\Bfootnote{#2}}
\newcommand{\more}[2]{#1}

(not tested yet, but the idea is here).

BatrachosPyktes commented 1 year ago

OK, let's call it not nocritical, but killcritical. As far as I can see, a problem arises with \lemma, but I'll try it and give you some feedback.

BatrachosPyktes commented 1 year ago

After two nights I found the following solution which takes (lemma) and [options after \Xfootnote] into account. For linenum one can add another optional command d with <> as delimiters. It's not the most elegant solution, but it works. Latest add: some %s are necessary to avoid unwanted spaces in the body text:

\NewDocumentCommand\apparatus{md()om}{% d = \lemma{}
  \IfNoValueTF{#2}
  {\IfNoValueTF{#3}
    {\edtext{#1}{\Afootnote{#4}}}
    {\edtext{#1}{\Afootnote[#3]{#4}}}}%
  {\IfNoValueTF{#3}
    {\edtext{#1}{\lemma{#2}\Afootnote{#4}}}
    {\edtext{#1}{\lemma{#2}\Afootnote[#3]{#4}}}%
}}
% \newcommandx\help[3][2=#1]{\edtext{#1}{\lemma{#2}\Bfootnote{#2}}}
\NewDocumentCommand\help{md()om}{% d = \lemma{}
  \IfNoValueTF{#2}
  {\IfNoValueTF{#3}
    {\edtext{#1}{\Bfootnote{#4}}}
    {\edtext{#1}{\Bfootnote[#3]{#4}}}}%
  {\IfNoValueTF{#3}
    {\edtext{#1}{\lemma{#2}\Bfootnote{#4}}}
    {\edtext{#1}{\lemma{#2}\Bfootnote[#3]{#4}}}%
}}
% \newcommandx{\more}[2]{\edtext{#1}{\Cfootnote{#2}}}
\NewDocumentCommand\more{md()om}{%
  \IfNoValueTF{#2}
  {\IfNoValueTF{#3}
    {\edtext{#1}{\Cfootnote{#4}}}
    {\edtext{#1}{\Cfootnote[#3]{#4}}}}%
  {\IfNoValueTF{#3}
    {\edtext{#1}{\lemma{#2}\Cfootnote{#4}}}
    {\edtext{#1}{\lemma{#2}\Cfootnote[#3]{#4}}}%
}}