从集合中删除标题后的逗号,

从集合中删除标题后的逗号,

引用某项@incollection内容时,格式为

chapterauthor, “标题”, 在 booktitle, …

然而,应该

chapterauthor,booktitle 中的“标题”,…

“Title” 后面没有逗号。

我尝试修改定义集合引用的命令,但无济于事。我尝试的另一件事是从这里实施以下黑客攻击: 如何在 biblatex 中删除 ieee 样式的标题 bibmacro 中的逗号?

删除了逗号但将“in”大写。

您知道删除逗号的方法吗?我附加了一个 MWE,它将逗号放在标题后面(补丁已被注释掉)。

下面是完整工作示例。您可以简单地将文件复制并粘贴到文本文档中,并按如下所示命名,然后在 overleaf 中运行它们。

main.tex

\documentclass{article}

% Language setting
% Replace `english' with e.g. `spanish' to change the document language
\usepackage[english]{babel}
\usepackage{csquotes}

% Set page size and margins
% Replace `letterpaper' with `a4paper' for UK/EU standard size
\usepackage[letterpaper,top=2cm,bottom=2cm,left=3cm,right=3cm,marginparwidth=1.75cm]{geometry}

% Useful packages
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage[colorlinks=true, allcolors=blue]{hyperref}
\usepackage{xpatch}
\usepackage[backend=biber, style=mhra]{biblatex}

%hack number one
%\xpatchbibmacro{bbx:title}{\addcomma\space}{\addspace}{}{}

%hack number two
%\xpatchbibdriver{incollection}
%{\usebibmacro{title}}
%{\setunit{\printdelim{nametitledelim}}{}\usebibmacro{title}\printunit%{\intitlepunct}}
%{}
%{}
%\renewcommand{\intitlepunct}{\addbthinspace}



\addbibresource{sample.bib}

\title{Your Paper}
\author{You}

\begin{document}
\maketitle

\begin{abstract}
Your abstract.
\end{abstract}

\section{Introduction}

\href{https://www.overleaf.com/help/97-how-to-include-a-bibliography-using-bibtex}{video tutorial here} to learn more about BibTeX. We ask for\footnote{\cite[xi.]{crut1997}}. We switch reference\footcite{fuentes1986} and come back in the next sentence. Lately, \footnote{\cite[22.]{crut1997}} shows how the "in" is capitalized\footnote{\cite{Taschen-Belifante}}.

\printbibliography

\end{document}

然后,参考书目sample.bib

@article{greenwade93,
    author  = "George D. Greenwade",
    title   = "The {C}omprehensive {T}ex {A}rchive {N}etwork ({CTAN})",
    year    = "1993",
    journal = "TUGBoat",
    volume  = "14",
    number  = "3",
    pages   = "342--351"
}
@book{crut1997,
  address   = {Cambridge},
  author    = {Alan Cruttenden},
  edition   = {2},
  publisher = {Cambridge University Press},
  title     = {Intonation},
  year      = 1997,
}
@book{mcarthur1986,
  author    = {Tom McArthur},
  title     = {Worlds of Reference},
  subtitle  = {Lexicography, Learning and Language from the Clay Tablet to the Computer},
  date      = {1986},
  publisher = {Cambridge University Press},
  location  = {Cambridge},
}
@book{fuentes1986,
  author    = {Carlos Fuentes},
  title     = {Aura},
  date      = {1986},
  editor    = {Peter Standish},
  publisher = {University of Durham},
  location  = {Durham},
  series    = {Durham Modern Language Series: Hispanic Texts},
  number    = {1},
}
@book{starobinski1986,
  author    = {Jean Starobinski},
  title     = {Montaigne in Motion},
  date      = {1986},
  translator= {Arthur Goldhammer},
  publisher = {University of Chicago Press},
  location  = {Chicago},
}

@incollection{Taschen-Belifante,
    author = {Judith C.E. Belifante},
    booktitle = {Charlotte Salomon Life? or Theatre? A Selection of 450 Gouaches},
    date-added = {2022-09-27 16:33:17 +0100},
    date-modified = {2022-09-28 11:42:46 +0100},
    publisher = {Taschen},
    title = {What is Life? or Theatre??},
    year = {2017}}

该文件mhra.cbx是(我相信这里可以修复):

\ProvidesFile{mhra.cbx}[$Id: 2011/11/6 v0.1 mhra biblatex citation style$]

%       see /usr/local/texlive/2018/texmf-dist/tex/latex/biblatex/cbx/verbose-ibid.cbx
\RequireCitationStyle{verbose-ibid}

% Custom strings
\DeclareLanguageMapping{british}{british-mhra}

% Long format for URL date
\ExecuteBibliographyOptions{citetracker=context,ibidtracker=constrict,
                            pagetracker, autocite=footnote,
                            urldate=long}

\DeclareLabelname[book]{%
  \field{author}
  \field{editor}
  \field{translator}
}

\renewcommand*{\newunitpunct}{\addcomma\addspace}
% "in " rather than "in: ", and don't display for articles
\renewcommand*{\intitlepunct}{\space}
\renewbibmacro{in:}{%
  \iffieldequalstr{entrytype}{article}
    {}
    {%
      \printtext{%
        \bibstring{in}\intitlepunct}}}
\renewbibmacro*{cite:citepages}{}

\renewbibmacro*{cite:full}{%
  \usebibmacro{cite:full:citepages}%
  \printtext[bibhypertarget]{%
    \usedriver
      {\DeclareNameAlias{sortname}{default}}
      {\thefield{entrytype}}}%
  \usebibmacro{shorthandintro}}

\renewbibmacro*{cite}{%
  \ifciteseen
    {\iffieldundef{shorthand}
       {\ifboolexpr{
          test {\ifciteibid}
         and
         not test {\iffirstonpage}
        }
          {\usebibmacro{cite:ibid}}
          {\usebibmacro{cite:short}}}
       {\usebibmacro{cite:shorthand}}}
    {\usebibmacro{cite:full}}}

\endinput

最后,文件mhra.bbx为:

\ProvidesFile{mhra.bbx}[2011/11/6 v0.1 biblatex bibliography style]

%       see /usr/local/texlive/2018/texmf-dist/tex/latex/biblatex/bbx/verbose-ibid.bbx
%        -> /usr/local/texlive/2018/texmf-dist/tex/latex/biblatex/bbx/authortitle.bbx
%        -> /usr/local/texlive/2018/texmf-dist/tex/latex/biblatex/bbx/standard.bbx
%           /usr/local/texlive/2018/texmf-dist/tex/latex/biblatex/biblatex.def
\RequireBibliographyStyle{verbose-ibid}

% Custom strings
\DeclareLanguageMapping{british}{british-mhra}

% TODO: Fix to add page number ({#1}) and parentheses (but no parentheses for subsequent references)
%       remove the comma , (pp. 1--2) (try extpostnotedelim)
%       for now, use \footnote{\cite{ref} (pp.\ 1--2).}
%\DeclareFieldFormat[article,incollection]{postnote}{\mkbibparens{\mkpageprefix[pagination]{#1}}}

% Don't show pp. before page numbers for article, except for newspapers (no volume number)
\DeclareFieldFormat[article]{pages}{%
  \iffieldundef{volume}
    {\mkpageprefix[bookpagination]{#1}}
    {#1}}

\renewbibmacro*{publisher+location+date}{%
  \addspace%
  \setunit{}%
  \mkbibparens{%
    \printlist{location}%
    \setunit*{\addcolon\space}%
    \iflistundef{publisher}
      {\setunit*{\addcomma\space}}
      {\setunit*{\addcolon\space}}%
    \printlist{publisher}%
    \setunit*{\addcomma\space}%
    \usebibmacro{date}%
  \newunit}}

\renewbibmacro*{journal+issuetitle}{%
  \usebibmacro{journal}%
  \setunit*{\addspace}%
  \iffieldundef{series}
    {}
    {\newunit
     \printfield{series}%
     \setunit{\addspace}}%
  \setunit{\addspace}%     
  \addcomma%
  \usebibmacro{volume+number+eid}%
  \setunit{\addspace}%
  \usebibmacro{issue+date}%
  \setunit{\addcolon\space}%
  \usebibmacro{issue}%
  \newunit}

% For newspapers (no volume number), do not put the date in parentheses
\renewbibmacro*{issue+date}{%
  \iffieldundef{volume}
    {\printfield{issue}%
     \setunit*{\addspace}%
     \usebibmacro{date}}
    {\printtext[parens]{%
      \printfield{issue}%
      \setunit*{\addspace}%
      \usebibmacro{date}}}%
  \newunit}

\DeclareBibliographyDriver{incollection}{%
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{author/translator+others}%
  \setunit{\labelnamepunct}\newblock
  \usebibmacro{title}%
  \newunit
  \printlist{language}%
  \newunit\newblock
  \usebibmacro{byauthor}%
  \newunit\newblock
  \usebibmacro{in:}%
  \usebibmacro{maintitle+booktitle}%
  \newunit\newblock
  \usebibmacro{byeditor+others}%
  \newunit\newblock
  \printfield{edition}%
  \newunit
  \iffieldundef{maintitle}
    {\printfield{volume}%
     \printfield{part}}
    {}%
  \newunit
  \printfield{volumes}%
  \newunit\newblock
  \usebibmacro{series+number}%
  \newunit\newblock
  \printfield{note}%
  \newunit\newblock
  \usebibmacro{publisher+location+date}%
  \newunit\newblock
  \usebibmacro{chapter+pages}%
  \newunit\newblock
  \iftoggle{bbx:isbn}
    {\printfield{isbn}}
    {}%
  \newunit\newblock
  \usebibmacro{doi+eprint+url}%
  \newunit\newblock
  \usebibmacro{addendum+pubstate}%
  \setunit{\bibpagerefpunct}\newblock
  \usebibmacro{pageref}%
  \usebibmacro{finentry}}

% incollectionshort - Hack to not include publisher+location+date (use booktitle + editor)
\DeclareFieldFormat[incollectionshort]{title}{\mkbibquote{#1\isdot}}
\DeclareFieldFormat[incollectionshort]{citetitle}{\mkbibquote{#1\isdot}}
\DeclareBibliographyDriver{incollectionshort}{%
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{author/translator+others}%
  \setunit{\labelnamepunct}\newblock
  \usebibmacro{title}%
  \newunit
  \printlist{language}%
  \newunit\newblock
  \usebibmacro{byauthor}%
  \newunit\newblock
  \printtext{in\addspace}%
  \usebibmacro{maintitle+booktitle}%
  \newunit\newblock
  \usebibmacro{byeditor+others}%
  \newunit\newblock
  \printfield{note}%
  \newunit\newblock
  \usebibmacro{chapter+pages}%
  \newunit\newblock
  \iftoggle{bbx:isbn}
    {\printfield{isbn}}
    {}%
  \newunit\newblock
  \usebibmacro{doi+eprint+url}%
  \newunit\newblock
  \usebibmacro{addendum+pubstate}%
  \setunit{\bibpagerefpunct}\newblock
  \usebibmacro{pageref}%
  \usebibmacro{finentry}}

% online - adapted from standard.bbx
% title in quotes
\DeclareFieldFormat[online]{title}{\mkbibquote{#1\isdot}}
% urls in angle brackets, in normal format using \StrSubstitute from xtring package (line breaks)
\DeclareFieldFormat{url}{\href{#1}{\printtext{<}\StrSubstitute{#1}{/}{\slash}}\printtext{>}}
% square brackets for seen date
\DeclareFieldFormat{urldate}{\mkbibbrackets{\bibstring{urlseen}\space#1}}
% no date
\DeclareBibliographyDriver{online}{%
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{author/editor+others/translator+others}%
  \setunit{\printdelim{nametitledelim}}\newblock
  \usebibmacro{title}%
  \newunit
  \printlist{language}%
  \newunit\newblock
  \usebibmacro{byauthor}%
  \newunit\newblock
  \usebibmacro{byeditor+others}%
  \newunit\newblock
  \printfield{version}%
  \newunit
  \printfield{note}%
  \newunit\newblock
  \printlist{organization}%
  \newunit\newblock
  \iftoggle{bbx:eprint}
    {\usebibmacro{eprint}}
    {}%
  \newunit\newblock
  \usebibmacro{url+urldate}%
  \newunit\newblock
  \usebibmacro{addendum+pubstate}%
  \setunit{\bibpagerefpunct}\newblock
  \usebibmacro{pageref}%
  \newunit\newblock
  \iftoggle{bbx:related}
    {\usebibmacro{related:init}%
     \usebibmacro{related}}
    {}%
  \usebibmacro{finentry}}

% inbook, adapted from standard.bbx
% don't show comma if bookauthor is same as author
\DeclareBibliographyDriver{inbook}{%
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{author/translator+others}%
  \setunit{\printdelim{nametitledelim}}\newblock
  \usebibmacro{title}%
  \newunit
  \printlist{language}%
  \newunit\newblock
  \usebibmacro{byauthor}%
  \newunit\newblock
  \usebibmacro{in:}%
  \usebibmacro{bybookauthor}%
  \ifnamesequal{author}{bookauthor}
    {}
    {\newunit\newblock}%
  \usebibmacro{maintitle+booktitle}%
  \newunit\newblock
  \usebibmacro{byeditor+others}%
  \newunit\newblock
  \printfield{edition}%
  \newunit
  \iffieldundef{maintitle}
    {\printfield{volume}%
     \printfield{part}}
    {}%
  \newunit
  \printfield{volumes}%
  \newunit\newblock
  \usebibmacro{series+number}%
  \newunit\newblock
  \printfield{note}%
  \newunit\newblock
  \usebibmacro{publisher+location+date}%
  \newunit\newblock
  \usebibmacro{chapter+pages}%
  \newunit\newblock
  \iftoggle{bbx:isbn}
    {\printfield{isbn}}
    {}%
  \newunit\newblock
  \usebibmacro{doi+eprint+url}%
  \newunit\newblock
  \usebibmacro{addendum+pubstate}%
  \setunit{\bibpagerefpunct}\newblock
  \usebibmacro{pageref}%
  \newunit\newblock
  \iftoggle{bbx:related}
    {\usebibmacro{related:init}%
     \usebibmacro{related}}
    {}%
  \usebibmacro{finentry}}

% inbookshort - Hack to not include publisher+location+date (use booktitle + bookauthor)
\DeclareFieldFormat[inbookshort]{title}{\mkbibquote{#1\isdot}}
\DeclareFieldFormat[inbookshort]{citetitle}{\mkbibquote{#1\isdot}}
\DeclareBibliographyDriver{inbookshort}{%
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{author/translator+others}%
  \setunit{\printdelim{nametitledelim}}\newblock
  \usebibmacro{title}%
  \newunit
  \printlist{language}%
  \newunit\newblock
  \usebibmacro{byauthor}%
  \newunit\newblock
  \usebibmacro{in:}%
  \usebibmacro{bybookauthor}%
  \ifnamesequal{author}{bookauthor}
    {}
    {\newunit\newblock}%
  \usebibmacro{maintitle+booktitle}%
  \newunit\newblock
  \usebibmacro{byeditor+others}%
  \newunit\newblock
  \printfield{edition}%
  \newunit
  \iffieldundef{maintitle}
    {\printfield{volume}%
     \printfield{part}}
    {}%
  \newunit
  \printfield{volumes}%
  \newunit\newblock
  \usebibmacro{series+number}%
  \newunit\newblock
  \printfield{note}%
  \newunit\newblock
  \usebibmacro{chapter+pages}%
  \newunit\newblock
  \iftoggle{bbx:isbn}
    {\printfield{isbn}}
    {}%
  \newunit\newblock
  \usebibmacro{doi+eprint+url}%
  \newunit\newblock
  \usebibmacro{addendum+pubstate}%
  \setunit{\bibpagerefpunct}\newblock
  \usebibmacro{pageref}%
  \newunit\newblock
  \iftoggle{bbx:related}
    {\usebibmacro{related:init}%
     \usebibmacro{related}}
    {}%
  \usebibmacro{finentry}}

% NB: DeclareFieldFormat above doesn't apply to bookinbookshort, so title will be in italics
\DeclareBibliographyAlias{bookinbookshort}{inbookshort}

\endinput

答案1

重新定义in:阅读

\renewbibmacro{in:}{%
  \iffieldequalstr{entrytype}{article}
    {}
    {\setunit{\addspace}%
     \bibncpstring{in}%
     \printunit{\intitlepunct}}}

强制\setunit{\addspace}在“in”前留一个空格,并从切换到\bibstring确保\bibncpstring即使标题以“??”之类的标点符号结尾,我们也不会得到大写的“in”,而这通常会导致biblatex以下文本大写。

相关内容