
Моя цель — процитировать несколько источников shortauthor
(без даты) и заключить цитату в скобки. Поскольку команды нет \parenciteauthor
, я определил одну, которая опирается на \citeauthor
.
Кроме того, я хотел бы исключить эти записи из списка литературы, используя опцию skipbib=true
или skipbiblist=true
.
Мой подход работает всякий раз, когда я цитируюодинокийисточник. К сожалению, я могу заставить работать только одно из этих двух требований, когда я цитируюнесколькоисточники.
Если я использую опцию skipbiblist=true
, я могу ссылаться на оба источника одновременно (см. строку 2 вывода). Однако записи все равно отображаются в списке ссылок. Если я вместо этого использую опцию skipbib=true
, записи успешно исключаются из списка ссылок. Ссылка на один источник также работает нормально (строка 3 вывода). Но если я ссылаюсь на несколько источников одновременно, скобки с цитатой остаются пустыми (строка 4 вывода).
Есть ли способ выполнить оба требования одновременно? Почему скобки пустые при использовании skipbib=true
?
Вот как выглядит мой вывод:
МЭУ:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[style=authoryear-icomp,
backend=biber,
bibstyle=authoryear
]{biblatex}
\newcommand{\parenciteauthor}[1]{(\citeauthor{#1})}
\begin{filecontents*}[overwrite]{publist.bib}
@misc{test1,
author = {Author1},
shortauthor = {T1},
title = {Paper 1},
year = {2010},
howpublished = {Paper presented at the meeting of Organization Name, Location},
options = {skipbiblist=true}
}
@misc{test2,
author = {Author2},
shortauthor = {T2},
title = {Paper 2},
year = {2010},
howpublished = {Paper presented at the meeting of Organization Name, Location},
options = {skipbiblist=true}
}
@misc{test3,
author = {Author3},
shortauthor = {T3},
title = {Paper 3},
year = {2010},
howpublished = {Paper presented at the meeting of Organization Name, Location},
options = {skipbib=true}
}
@misc{test4,
author = {Author4},
shortauthor = {T4},
title = {Paper 4},
year = {2010},
howpublished = {Paper presented at the meeting of Organization Name, Location},
options = {skipbib=true}
}
\end{filecontents*}
\addbibresource{publist.bib}
\begin{document}
Cite paper 1 \parenciteauthor{test1} and paper 2 \parenciteauthor{test2}, both with the option skipbiblist=true.
Cite paper 1 and 2 together: \parenciteauthor{test1,test2}. % This is how I want to output to look like. Unfortunately, the sources still show up in the list of references.
Cite paper 3 \parenciteauthor{test3} and paper 4 \parenciteauthor{test4}, both with the option skipbib=true.
Cite paper 3 and 4 together: \parenciteauthor{test3,test4}. % The sources are omitted from the list of references as desired, but the citation does not work.
\printbibliography
\end{document}
решение1
Обновлять
Найденная здесь ошибка была исправлена в biblatex
v3.18 (2022-06-22). Обновите систему, если эта проблема все еще возникает.
Эта проблема не вызвана ни одним из ваших определений. Она вызвана тем, что, возможно, является ошибкой в biblatex
:https://github.com/plk/biblatex/issues/1225.
Если вам нужно, чтобы все работало прямо сейчас, вы можете включить исправление дляhttps://github.com/plk/biblatex/issues/1225следующим образом. Не забудьте удалить \makeatletter ... \makeatother
блок после biblatex
обновления.
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[
backend=biber,
style=authoryear-icomp,
]{biblatex}
\makeatletter
\protected\def\blx@bbl@endentry{%
\csuse\blx@bbl@data
\ifcsundef{blx@pref@\the\c@refsection @\abx@field@entrykey}
{}
{\blx@addpageref{\abx@field@entrykey}}%
\nottoggle{blx@setonly}
{}
{\global\toggletrue{blx@addset}%
\toggletrue{blx@skipbib}%
\toggletrue{blx@skipbiblist}%
\toggletrue{blx@skiplab}}%
\expandafter\ifstrequal\expandafter{\blx@dlist@type}{entry}
{\listcsxadd{blx@type@\the\c@refsection @\abx@field@entrytype}{\abx@field@entrykey}%
\ifdef\abx@field@entrysubtype
{\listcsxadd{blx@subt@\the\c@refsection @\abx@field@entrysubtype}{\abx@field@entrykey}}
{}%
\nottoggle{blx@setonly}
{\listcsxadd{blx@dlist@centry@\the\c@refsection @\blx@dlist@name}{\abx@field@entrykey}}
{}%
\nottoggle{blx@skipbib}
{\listcsxadd{blx@dlist@entry@\the\c@refsection @\blx@dlist@name}{\abx@field@entrykey}}
{}}%
{}%
\nottoggle{blx@skipbiblist}
{\expandafter\ifstrequal\expandafter{\blx@dlist@type}{list}
{\blx@bbl@labelfields
\listcsxadd{blx@dlist@\blx@dlist@type @\the\c@refsection @\blx@dlist@name}{\abx@field@entrykey}}
{}}%
{}%
\nottoggle{blx@skiplab}
{\iftoggle{blx@labelnumber}
{\blx@bbl@labelnumber}
{}%
\iftoggle{blx@labelalpha}
{\blx@bbl@labelalpha}
{}%
\iftoggle{blx@labeltitle}
{\blx@bbl@labeltitle}
{}%
\iftoggle{blx@labeltitleyear}
{\blx@bbl@labeltitleyear}
{}%
\iftoggle{blx@labeldateparts}
{\blx@bbl@labeldate}
{}%
\blx@bbl@labelname}
{}%
\blx@bbl@titles
\blx@bbl@hooks
\endgroup}
\makeatother
\newcommand{\parenciteauthor}[1]{(\citeauthor{#1})}
\begin{filecontents*}[overwrite]{\jobname.bib}
@misc{test1,
author = {Author1},
title = {Paper 1},
year = {2010},
options = {skipbiblist=true},
}
@misc{test2,
author = {Author2},
title = {Paper 2},
year = {2010},
options = {skipbiblist=true}
}
@misc{test3,
author = {Author3},
title = {Paper 3},
year = {2010},
options = {skipbib=true}
}
@misc{test4,
author = {Author4},
title = {Paper 4},
year = {2010},
options = {skipbib=true}
}
\end{filecontents*}
\addbibresource{\jobname.bib}
\begin{document}
Cite paper 1 \parenciteauthor{test1}
and paper 2 \parenciteauthor{test2}, both with the option skipbiblist=true.
Cite paper 1 and 2 together: \parenciteauthor{test1,test2}.
Cite paper 3 \parenciteauthor{test3} and paper 4 \parenciteauthor{test4},
both with the option skipbib=true.
Cite paper 3 and 4 together: \parenciteauthor{test3,test4}.
\printbibliography
\end{document}
Как я уже упоминал выше, проблема вовсе не в ваших определениях, а в том,
\DeclareCiteCommand{\parenciteauthor}[\mkbibparens]
{\boolfalse{citetracker}%
\boolfalse{pagetracker}%
\usebibmacro{prenote}}
{\ifciteindex
{\indexnames{labelname}}
{}%
\printnames{labelname}}
{\multicitedelim}
{\usebibmacro{postnote}}
будет немного более идиоматичным - хотя, конечно, гораздо длиннее, чем
\newcommand{\parenciteauthor}[1]{(\citeauthor{#1})}