Как совместить повторяющиеся библиографические записи при использовании футсайта?

Dec 10 2020

Если я процитирую один и тот же источник несколько раз подряд, получится библиографический список, состоящий из идентичных элементов:


  1. автор, название
  2. автор, название
\begin{filecontents}{database.bib}
@Misc{key,
    author      = {author},
    title       = {title},
}
\end{filecontents}

\documentclass{article}
\usepackage[autocite=footnote,style=authortitle]{biblatex}
\bibliography{database.bib}
\begin{document}
\begin{itemize}
\item one point\autocite{key}
\item another one\autocite{key}
\end{itemize}
\end{document}

Как сжать список в сноске, чтобы он выглядел так:


1,2 автор, название

Ответы

1 R.N Dec 18 2020 at 21:36

Я предлагаю решение, которое не сжимает список сносок, а печатает сноску только один раз на странице.

Идея состоит в том, чтобы переопределить команду cite под названием \footcite. Затем, чтобы принять autociteвариант biblatex, я помещаю его в biblatex.cfgфайл в соответствии с этим вопросом и называю его myfootnote.

И \footciteпри вызове всегда создает, \footnotemarkиспользуя номер метки ключа. Затем, согласно этому вопросу , если \footciteвызывается впервые на этой странице, он также создает \footnotetext.

Вот полученный MWE:

\documentclass{article}
\usepackage{filecontents}
\begin{filecontents}{biblatex.cfg}
    \ProvidesFile{biblatex.cfg}
    \DeclareCiteCommand{\footcite}%
    {\usebibmacro{prenote}}% 
    {%
        %   \renewcommand{\thefootnote}{\arabic{footnote}}% Switch to footnote with numbers
        \footnotemark[\thefield{labelnumber}]% Add the mark corresponding to the number entry% 
        \iffirstonpage{
            \footnotetext[\thefield{labelnumber}]{% Add the footnote text with same number entry.
                %\printfield{labelnumber}
                \printnames{labelname}% The name 
                \setunit{\printdelim{nametitledelim}}% separator
                \printfield[citetitle]{labeltitle}% The title
                \setunit{\addperiod\space}% separator
                \printfield{year}% The year
        }
        }{}% if not first on page
        %   \renewcommand{\thefootnote}{\alph{footnote}}% Switch back to footnote with letters.
    }%
    {\multicitedelim}
    {\usebibmacro{postnote}}
    \DeclareAutoCiteCommand{myfootnote}{\footcite}{\footcite}
    \endinput
\end{filecontents}

\begin{filecontents}{database.bib}
    @Misc{key,
        author      = {author},
        title       = {title},
    }
\end{filecontents}

\usepackage[autocite=myfootnote, style=numeric, pagetracker=true, backend=biber]{biblatex}
\bibliography{database.bib}
\begin{document}
\begin{itemize}
    \item one point\autocite{key}
    \item another one\autocite{key}
\end{itemize}
\newpage
\begin{itemize}
    \item one point\autocite{key}
    \item another one\autocite{key}
\end{itemize}
\end{document}

Одно из возможных улучшений, которое я не знаю, как сделать, - это сделать этот хак совместимым с другими стилями. В самом деле, если кто - то переключатель стиль alphabetic, например, хотел бы получить ошибку компиляции: missing number; так как footnotemarkбудет получен не номер, а текст, заданный \thefield{labelnumber}.