I'm working with some manuscript. The main text runs fluently, but sometimes author added some text in margin/below the line and indicated towards them with some sign. So, I've to add the margin-text to main-text and also make a footnote mentioning that it was found in margins. For this I created a macro \FoundBelowLine or \FoundInMargin macro which takes a single argument and prints it in main text and then uses the same text to create a footnote. Everything works.
Now, I've another footnote which mentions end of line according to manuscript, like "1st line of MSS ends here".
When the additional text was provided just below the current line and it runs for multiple lines, then I've to use the \FoundBelowLine macro and then use \MSSLineEnds macro inside it. This creates footnotes inside footnotes and I'm getting 'content already defined'.
For solution, I thought it will be better to somehow disable other macros like \MSSLineEnds when it is used by \FoundBelowLine macro. But, I don't know how to do it. Using Python-tex appeared a bit problematic for compiling.
Moreover, I've to use footnotes in the margin-text to note that the reading is not correct, etc. When such footnote has to be used inside \FoundBelowLine macro, it also creates same problem. But, this time I don't want to totally disable the footnote, but want to extract the argument so that it can be used to create the correct word.
When it compiles and when not are mentioned in the MWE. Please, have a look.
Here is MWE:
\documentclass[twoside]{book}
\usepackage[paperheight=8.3in,paperwidth=5.8in,margin=1in]{geometry}
\usepackage[parapparatus]{reledmac}
\newcommand{\FoundBelowLine}[1]{{#1}\footnoteA{{#1} - was found below line.}}
\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.}}
\begin{document}
%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.
\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.
\FoundBelowLine{
\textbf{
Some text in the main body of\MSSLineEnd{1} MSS.
}
}
\end{document}
=============================================================
SOLUTION as suggested by @Maïeul
\makeatletter
\newcommand{\FoundBelowLine}[1]{%
{#1}%
\footnoteA{%
\begingroup
\let\MSSWrongReading\@firstoftwo%
\let\MSSLineEnd\@gobble%
{#1} - was found below line.
\endgroup%
}%
}
\makeatother
This prints all the text which is intended to be printed in the body of book, and moves all my comments to footnotes avoiding conflict arising from footnote inside footnote.
FoundBelowLine
. The redefinition will be local toFoundBelowLine
.