是否让 biblatex 数字样式在同一作者的参考书目条目中使用行?

是否让 biblatex 数字样式在同一作者的参考书目条目中使用行?

我还需要添加什么内容,以便以下源文件与指示的自定义.bbx文件一起打印一条水平线来替换具有相同作者的后续参考书目条目的作者姓名?

\documentclass[12pt]{memoir}

\usepackage[bibstyle=mybooknumeric,citestyle=numeric,backend=bibtex,,dashed=true]{biblatex}

\begin{filecontents}{euler.bib}
@article{EulerE1776,
    Author = {Euler, Leonhard},Title = {All about E},
    Journal = {Math.\ Psychol.},
    Year = {1776},Volume = {4},number={1},
    pages={1--2718}
}
@article{EulerE1748,
    Author = {Euler, Leonhard},Title = {My formula},
    Journal = {Math.\ Formulas},
    Year = {1748},Volume = {4},
    pages={233--234}
}
\end{filecontents}

\addbibresource{euler.bib}

\begin{document}
\nocite{*}
\printbibliography
\end{document}

我的自定义样式文件:

\ProvidesFile{mybooknumeric.bbx}

\RequireBibliographyStyle{standard}
\RequireBibliographyStyle{numeric}
%
\DeclareBibliographyOption[boolean]{dashed}[true]{%
  \ifstrequal{#1}{true}
    {\ExecuteBibliographyOptions{pagetracker}%
     \renewbibmacro*{bbx:savehash}{\savefield{fullhash}{\bbx@lasthash}}}
    {\renewbibmacro*{bbx:savehash}{}}}
%
\newbibmacro*{bbx:savehash}{%
  \savefield{fullhash}{\bbx@lasthash}}

这是我现在得到的输出:

重复作者不替换为水平线

答案1

以下是在 中如何操作的authortitle.bbx,但请注意,我只为作者操作,而不是编辑或翻译人员。(您可以在 中看到如何操作.bbx。)

\RequirePackage{filecontents}
\begin{filecontents}{mybooknumeric.bbx}
\ProvidesFile{mybooknumeric.bbx}

\RequireBibliographyStyle{standard}
\RequireBibliographyStyle{numeric}
%
\DeclareBibliographyOption[boolean]{dashed}[true]{%
  \ifstrequal{#1}{true}
    {\ExecuteBibliographyOptions{pagetracker}%
     \renewbibmacro*{bbx:savehash}{\savefield{fullhash}{\bbx@lasthash}}}
    {\renewbibmacro*{bbx:savehash}{}}}
%
\newbibmacro*{bbx:savehash}{%
  \savefield{fullhash}{\bbx@lasthash}}

\renewbibmacro*{author}{%
  \ifboolexpr{
    test \ifuseauthor
    and
    not test {\ifnameundef{author}}
  }
  {\usebibmacro{bbx:dashcheck}
    {\bibnamedash}
    {\printnames{author}%
      \setunit{\addcomma\space}%
      \usebibmacro{bbx:savehash}}%
    \usebibmacro{authorstrg}}
  {\global\undef\bbx@lasthash}}

\newbibmacro*{bbx:dashcheck}[2]{%
  \ifboolexpr{
    test {\iffieldequals{fullhash}{\bbx@lasthash}}
    and
    not test \iffirstonpage
    % NOTE: the follow only matters if you have defined and set up the boolean `bbx@inset` (which is defined in authortitle.bbx).
    % and
    % (
    %   not bool {bbx@inset}
    %   or
    %   test {\iffieldequalstr{entrysetcount}{1}}
    % )
  }
  {#1}
  {#2}}

\end{filecontents}

\begin{filecontents}{euler.bib}
@article{EulerE1776,
    Author = {Euler, Leonhard},Title = {All about E},
    Journal = {Math.\ Psychol.},
    Year = {1776},Volume = {4},number={1},
    pages={1--2718}
}
@article{EulerE1748,
    Author = {Euler, Leonhard},Title = {My formula},
    Journal = {Math.\ Formulas},
    Year = {1748},Volume = {4},
    pages={233--234}
}
\end{filecontents}


\documentclass[12pt]{memoir}

\usepackage[bibstyle=mybooknumeric, citestyle=numeric, backend=bibtex,,dashed=true]{biblatex}
\addbibresource{euler.bib}

\renewcommand*{\bibnamedash}{\rule{3em}{0.4pt}\hskip 0.16667em plus 0.01em minus 0.002em\relax \addcomma} 

\begin{document}
\nocite{*}
\printbibliography
\end{document}

简单的 bibnamedash 示例

相关内容