使用 biblatex 删除“in”而不添加双倍空格

使用 biblatex 删除“in”而不添加双倍空格

biblatex我有一个使用和样式的LaTex 文档verbose-trad2,这里是 MWE:

\documentclass[chapterprefix,twoside,12pt,DIV=12,appendixprefix=true,headings=onelineappendix]{scrbook}
\KOMAoptions{headsepline=true, chapterprefix=true}
\usepackage{lmodern}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{csquotes}
\usepackage[main=french,english]{babel}
\usepackage[backend=biber,style=verbose-trad2,url=false,citepages=omit,dateabbrev=false,singletitle=true]{biblatex}
\DefineBibliographyStrings{french}{
  pages = {pp\adddot},
  page = {p\adddot},
  editors = {(dir.),},
  in = \iffieldequalstr{entrytype}{article}{}{dans},
  opcit = \iffieldequalstr{entrytype}{article}{art\adddotspace cit\adddot}{op\adddotspace cit\adddot}
}

\begin{filecontents}{testbibliography.bib}
 @incollection{kraatzOrganizationalImplicationsInstitutional2008,
  title = {Organizational {{Implications}} of {{Institutional Pluralism}}},
  booktitle = {The {{SAGE Handbook}} of {{Organizational Institutionalism}}},
  author = {Kraatz, Matthew and Block, Emiliy},
  editor = {Greenwood, Royston and Oliver, Christine and Suddaby, Roy and Sahlin, Kerstin},
  date = {2008},
  pages = {243--275},
  publisher = {{SAGE Publications Ltd}},
  location = {{London}},
  url = {https://sk.sagepub.com/reference/hdbk_orginstitution},
  urldate = {2020-11-14},
  langid = {english}
}
@article{krackhardtPredictingNetworksNonparametric1988,
  title = {Predicting with Networks: {{Nonparametric}} Multiple Regression Analysis of Dyadic Data},
  shorttitle = {Predicting with Networks},
  author = {Krackhardt, David},
  date = {1988-12},
  journaltitle = {Social Networks},
  shortjournal = {Social Networks},
  volume = {10},
  pages = {359--381},
  url = {http://www.sciencedirect.com/science/article/pii/0378873388900044},
  urldate = {2016-03-02},
  langid = {english},
  number = {4}
}
\end{filecontents}
\addbibresource{testbibliography.bib}

\DeclareAutoCiteCommand{footnote}{\smartcite}{\smartcites}
\ExecuteBibliographyOptions{autocite=footnote}

\renewcommand{\newunitpunct}[0]{\addcomma\addspace}
\renewcommand*{\intitlepunct}{\space} 

\DeclareNameAlias{sortname}{last-first} 
\renewcommand*{\revsdnamepunct}{} 

% op cit avec une seule oeuvre
\renewbibmacro*{cite:title}{%
    \printtext[bibhyperlink]{%
        \ifsingletitle{}{\printfield[citetitle]{labeltitle}}%
            \setunit{\nametitledelim}%
            \bibstring[\mkibid]{opcit}}}
            
% numéro de revue entre parenthèse
\renewbibmacro*{volume+number+eid}{%
  \printfield{volume}%
%  \setunit*{\adddot}% DELETED
  \setunit*{\addnbspace}% NEW (optional); there's also \addnbthinspace
  \printfield{number}%
  \setunit{\addcomma\space}%
  \printfield{eid}}
\DeclareFieldFormat[article]{number}{\mkbibparens{#1}}

% comma after journal 
\renewbibmacro*{journal+issuetitle}{%
 \usebibmacro{journal}%
 \setunit*{\addcomma\space}%
 \iffieldundef{series}
 {}
{\newunit
 \printfield{series}%
 \setunit{\addspace}}%
\usebibmacro{volume+number+eid}%
 \setunit{\addspace}%
\usebibmacro{issue+date}%
 \setunit{\addcolon\space}%
\usebibmacro{issue}%
\newunit}
% paranthèse date
\renewbibmacro*{issue+date}{%
  \setunit{\addcomma\space}% NEW
%  \printtext[parens]{% DELETED
    \iffieldundef{issue}
      {\usebibmacro{date}}
      {\printfield{issue}%
       \setunit*{\addspace}%
%       \usebibmacro{date}}}% DELETED
       \usebibmacro{date}}% NEW
  \newunit}

% remettre le nom de l'auteur en première note de page, pas ibidem
\renewbibmacro*{cite}{%
  \usebibmacro{cite:citepages}%
  \global\togglefalse{cbx:fullcite}%
  \global\togglefalse{cbx:loccit}%
  \bibhypertarget{cite\the\value{instcount}}{%
    \ifciteseen
      {\iffieldundef{shorthand}
        {\iffirstonpage% NEW
           {\usebibmacro{cite:name}% NEW
            \usebibmacro{cite:title}}% NEW
           {\ifciteibid
              {\usebibmacro{cite:ibid}}
              {\ifthenelse{\ifciteidem\AND\NOT\boolean{cbx:noidem}}
                 {\usebibmacro{cite:idem}}
                 {\usebibmacro{cite:name}}%
               \usebibmacro{cite:title}}%
%       \usebibmacro{cite:save}}% DELETED
        \usebibmacro{cite:save}}}% NEW
         {\usebibmacro{cite:shorthand}}}
      {\usebibmacro{cite:full}%
       \usebibmacro{cite:save}}}}

\begin{document}

\mainmatter
test\autocite{krackhardtPredictingNetworksNonparametric1988} and test\autocite{kraatzOrganizationalImplicationsInstitutional2008}

\end{document}

此代码给出了以下结果: 在此处输入图片描述

如您所见,文章的期刊标题前添加了双倍空格。问题出在这行:

  in = \iffieldequalstr{entrytype}{article}{}{dans},

通过删除期刊标题前的“in”,它会在 in 前后留下两个空格。我该如何避免这种情况?

答案1

我认为抑制条目中的“in:”的最佳方法是使用我的包和选项@article的样式。另请参阅biblatex-extarticlein=false抑制“在:” biblatex

让 bibstring 为空(更有条件地为空)几乎从来都不是一个好主意,因为biblatex可能会认为它打印了一些东西,而实际上它并没有打印任何东西。

这些biblatex-ext样式还使您对输出的其他修改变得@article更加容易。

\documentclass[chapterprefix, twoside, 12pt, DIV=12,
  appendixprefix=true, headings=onelineappendix]{scrbook}
\KOMAoptions{headsepline=true, chapterprefix=true}
\usepackage{lmodern}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{csquotes}
\usepackage[main=french,english]{babel}
\usepackage[
  backend=biber,
  style=ext-verbose-trad2,
  url=false,
  citepages=omit,
  dateabbrev=false,
  singletitle=true,
  articlein=false,
]{biblatex}

\DefineBibliographyStrings{french}{
  pages   = {pp\adddot},
  page    = {p\adddot},
  in      = {dans},
  opcit   = \iffieldequalstr{entrytype}{article}
              {art\adddotspace cit\adddot}
              {op\adddotspace cit\adddot},
}

\DeclareAutoCiteCommand{footnote}{\smartcite}{\smartcites}
\ExecuteBibliographyOptions{autocite=footnote}

\renewcommand{\newunitpunct}[0]{\addcomma\addspace}
\renewcommand*{\intitlepunct}{\space}

\DeclareNameAlias{sortname}{family-given}
\renewcommand*{\revsdnamepunct}{}

\DeclareFieldFormat{editortype}{\mkbibparens{#1}}
\DeclareDelimFormat{editortypedelim}{\addspace}

\DeclareFieldAlias{translatortype}{editortype}
\DeclareDelimAlias{translatortypedelim}{editortypedelim}

% op cit avec une seule oeuvre
\renewbibmacro*{cite:title}{%
  \printtext[bibhyperlink]{%
    \ifsingletitle{}{\printfield[citetitle]{labeltitle}}%
      \setunit{\nametitledelim}%
      \bibstring[\mkibid]{opcit}}}

\renewcommand*{\volnumdelim}{\addnbspace}
\DeclareFieldFormat[article]{number}{\mkbibparens{#1}}

\renewcommand*{\jourvoldelim}{\addcomma\space}

\DeclareFieldFormat{issuedate}{#1}

% remettre le nom de l'auteur en première note de page, pas ibidem
\renewbibmacro*{cite}{%
  \usebibmacro{cite:citepages}%
  \global\togglefalse{cbx:fullcite}%
  \global\togglefalse{cbx:loccit}%
  \bibhypertarget{cite\the\value{instcount}}{%
    \ifciteseen
      {\iffieldundef{shorthand}
        {\iffirstonpage% NEW
           {\usebibmacro{cite:name}% NEW
            \usebibmacro{cite:title}}% NEW
           {\ifciteibid
              {\usebibmacro{cite:ibid}}
              {\ifthenelse{\ifciteidem\AND\NOT\boolean{cbx:noidem}}
                 {\usebibmacro{cite:idem}}
                 {\usebibmacro{cite:name}}%
               \usebibmacro{cite:title}}%
%       \usebibmacro{cite:save}}% DELETED
        \usebibmacro{cite:save}}}% NEW
         {\usebibmacro{cite:shorthand}}}
      {\usebibmacro{cite:full}%
       \usebibmacro{cite:save}}}}


\begin{filecontents}{\jobname.bib}
@incollection{kraatzOrganizationalImplicationsInstitutional2008,
  title     = {Organizational Implications of Institutional Pluralism},
  booktitle = {The SAGE Handbook of Organizational Institutionalism},
  author    = {Kraatz, Matthew and Block, Emiliy},
  editor    = {Greenwood, Royston and Oliver, Christine
               and Suddaby, Roy and Sahlin, Kerstin},
  date      = {2008},
  pages     = {243--275},
  publisher = {SAGE Publications Ltd},
  location  = {London},
  url       = {https://sk.sagepub.com/reference/hdbk_orginstitution},
  urldate   = {2020-11-14},
  langid    = {english},
}
@article{krackhardtPredictingNetworksNonparametric1988,
  title        = {Predicting with Networks},
  subtitle     = {Nonparametric Multiple Regression Analysis of Dyadic Data},
  author       = {Krackhardt, David},
  date         = {1988-12},
  journaltitle = {Social Networks},
  shortjournal = {Social Networks},
  volume       = {10},
  pages        = {359--381},
  url          = {http://www.sciencedirect.com/science/article/pii/0378873388900044},
  urldate      = {2016-03-02},
  langid       = {english},
  number       = {4},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\begin{document}

\mainmatter
test\autocite{krackhardtPredictingNetworksNonparametric1988}
and test\autocite{kraatzOrganizationalImplicationsInstitutional2008}
\end{document}

David Krackhardt,“使用网络进行预测,二元数据的非参数多元回归分析”,社交网络,1988 年 12 月 10(4),第 359-381 页。//Matthew Kraatz 和 Emiliy Block,“制度多元化的组织含义”,在《SAGE 组织制度主义手册》中,由 Royston Greenwood 等编著,伦敦:SAGE Publications Ltd,2008 年,第 243-275 页。

相关内容