Multiple citations on the same footnote throughout all the document

biblatexfootnotes

I am trying to use the same footnote (to be specific, footcite) on replicated citations with BibLaTeX, as shown in this answer to a related question. However, there are several aspects I want for it to be suitable for what I want to do. I tried to understand the code and modify it, but becuase I am inexperienced on TeX in general, I could not do it.

In a paper I am writing, there are several replicated citations, but sometimes they use the postnote to reference certain pages of the source, which is not possible to do on the answer I referenced, as it ignores the pre- and postnote of the footcite. So I would like for it to be able to avoid multiple footcites on the replicated citations with either the pre- or postnote or both.

Also, I saw that by using the code from the answer, if the same footnote is used on another page, it is still cited at the end of the document. I would not like for it to be like that, as for me, even if it could be useful to the reader, it just uses more space than what I would like, specially if I use so much footcites from previous pages. I don't need this functionality, but I would like it to be implemented.

Here's the template from the document I am writing, in case any of my modifications could interfere with the code needed for this:

\documentclass{article}
\usepackage[style=apa, citestyle=ext-authoryear-comp, backend=biber]{biblatex}


\addbibresource{main.bib}

\DeclareFieldFormat*[misc]{title}{#1\nopunct} % Deletes dot between title and date in miscallaneous entries

% Replaces pp./p. with colon
\DeclareFieldFormat*{postnote}{#1}
\renewcommand{\postnotedelim}{\addcolon\addthinspace}

% Spacing between bibliography entries
\setlength{\bibitemsep}{\baselineskip}

% Reduces indentation from bibliography entries
\setlength{\bibhang}{0.5cm}

% Adds parenthesis around the date in footcite (extracted from https://tex.stackexchange.com/questions/458151/parentheses-around-year-normal-number-in-footnote-and-a-word-before-footnote)
\DeclareInnerCiteDelims{footcite}{\bibopenparen}{\bibcloseparen}

% Adds spacing between the footcite superscript and text (extracted from https://tex.stackexchange.com/questions/504573/reduce-the-space-between-inline-footnotes-style-verbose-inote)
\makeatletter
\long\def\@makefntext#1{\leavevmode
    \@makefnmark\nobreak
    \hskip.20em\relax#1%
}
\makeatother

% Adds spacing between footcite entries
\setlength{\footnotesep}{0.75\baselineskip}

% Adds spacing before the footcite superscript (extracted from https://tex.stackexchange.com/a/180667)
\makeatletter
\patchcmd\@footnotemark{\edef}{\,\edef}{}{}
\makeatother

\begin{document}
    \noindent 
    This is \footcite{github_tts} a \footcite{github_espeak} template \footcite[972]{klatt_1980} from the \footcite[972]{klatt_1980} original document \footcite[742]{klatt_1987}.
    
    \printbibliography[title=Bibliography]
\end{document}

main.bib:

@misc{github_tts,
  title = {GitHub Topics: text-to-speech},
  url = {https://github.com/topics/text-to-speech},
  organization = {GitHub}
}

@misc{github_espeak,
    title = {GitHub: espeak-ng/espeak-ng},
    url = {https://github.com/espeak-ng/espeak-ng},
    organization = {GitHub}
}

@article{klatt_1980,
    author = {Klatt, Dennis H.},
    month = {03},
    pages = {971-995},
    title = {Software for a cascade/parallel formant synthesizer},
    doi = {10.1121/1.383940},
    volume = {67},
    year = {1980},
    journal = {The Journal of the Acoustical Society of America}
}

@article{klatt_1987,
    author = {Klatt, Dennis H.},
    month = {09},
    pages = {737-793},
    title = {Review of text‐to‐speech conversion for English},
    doi = {10.1121/1.395275},
    volume = {82},
    year = {1987},
    journal = {The Journal of the Acoustical Society of America}
}

By the way, I also modified the APA citation style, here's the modified apa.bbx, which is the only file I modified.

Best Answer

As far as I have tried, I could not make an automated way to accomplish this by myself, and I would be glad if someone makes it. But I do not think I need an automatic method anymore, as it could bloat the document with code. Here are my attempts of writing an automatic method:

As I said on my comment, I could add both the pre- and postnote to the custom command, but only on the citation not on the footnote itself, and it shows them on the superscript. Furthermore, as I said, I tried changing the wrapper, which yielded undesirable results.

However, I tried afterward to modify the wrapper by comparing it to the biblatex.sty file, which show the original code of the commands used in the wrapper, but did not get to any real progress on it, other than "underscripting" the superscript and doing subtle changes on the footnote, you can see here my results and the code I used.

Now, I came up with an Stack Overflow answer (which I think I already found, but I did not take it in account becuase of some reason) which employs a manual workaround with \footnotemark[footnote index], and with some testing, I found out that satifies all I requested (it solves replicated citations and the footnote is not cited at the end of the document, contrary to what is shown on the answer I referenced on my question). So I think it might be the definite answer to my desires.

This made me change one of my customizations code in accordance to this answer, to this:

% Adds comma between multiple footcites (extracted from https://tex.stackexchange.com/a/62091/248557 and https://tex.stackexchange.com/a/285630/248557)
\let\oldFootcite\footcite
\let\oldFootnotemark\footnotemark
\newcommand\nextToken\relax
\renewcommand\footcite[2][]{%
    \oldFootcite[#1]{#2}\futurelet\nextToken\isFootciteOrFootmark}
\renewcommand\footnotemark[1]{%
    \unspace\oldFootnotemark[#1]\futurelet\nextToken\isFootciteOrFootmark} % Also deletes space before the superscript through /unspace
\newcommand\isFootciteOrFootmark{%
    \ifx\footcite\nextToken\textsuperscript{,}%
    \else\ifx\footnotemark\nextToken\textsuperscript{,}\fi%
    \fi}