使用 biblatex-chicago 在同一文档中使用方括号和花括号

使用 biblatex-chicago 在同一文档中使用方括号和花括号

我的代码如下:

\documentclass[]{book}
\usepackage[natbib,authordate,backend=biber]{biblatex-chicago}%
\makeatletter
\AtEveryBibitem{\global\undef\bbx@lasthash}%
\setlength{\bibhang}{5\p@}%
\setlength{\bibitemsep}{3.5\p@}%
%\setlength{\biblabelsep}{-10\p@}%
\def\bibfont{\footnotesize}%
%\setlength{\bibhang}{1cm}
%%%
\newlength{\bibleftadd}%
\setlength{\bibleftadd}{-5\p@}%
%%
\defbibenvironment{bibliography}
  {\vspace{-2\p@}\markboth{\bibname}{\bibname}\list%
     {}%
     {\setlength{\topsep}{\z@}\setlength{\leftmargin}{\bibhang}%
      \setlength{\itemindent}{-\leftmargin}%
      \addtolength{\leftmargin}{\bibleftadd}%
      \setlength{\itemsep}{\bibitemsep}%
      \setlength{\parsep}{\bibparsep}}}
  {\endlist}
  {\item}
\makeatother

\addbibresource{test.bib}

\begin{document}

This is for test \citet{antibayes} and \citep{pijnacker2}

\printbibliography

\end{document}

%%测试内容.bib%

@incollection{antibayes,
Address = {The Press},
Author = {G. Author1 and K. Author2 and M. Author3},
Booktitle = {The {U}niversity},
Date-Added = {2014-02-06 15:25:25 +0100},
Date-Modified = {2014-02-06 15:28:59 +0100},
Editor = {M. Editor1 and P. Editor2},
Publisher = {The {U}niversity},
Title = {The {C}ognitive {I}nterface},
Year = {2021}}

@article{pijnacker2,
Author = {J. Author4 and B. Author5 and M. Author6 and J. Author7 and P. Author8},
Date-Added = {2014-02-06 15:14:32 +0100},
Date-Modified = {2014-02-06 15:17:39 +0100},
Journal = {Journal of {T}ext},
Number = {2},
Pages = {471--480},
Title = {Study},
Volume = {23},
Year = {2010}}

它工作正常,但每当嵌套样式出现时,我都需要将括号从圆形更改为方形,例如:

在此处输入图片描述

在这里,我标记了我想要更改的括号。这可以通过使用natbib包、使用标签轻松更改\setcitestyle{square},然后再次使用标签恢复\setcitestyle{round},是否有任何类似的选项可用,biblatex-chicago或者有任何建议如何实现我的要求?请提出建议...

请注意,我使用的MikTeX 2.9biber

答案1

如果我正确理解了您要做的事情,您不需要新的命令或本地设置来更改括号样式,您所需要的只是告诉biblatex括号跟踪器您手动插入的外括号。

最优雅的方法是不要将外括号输入为(...),而是使用宏\parentext{...}biblatex将了解外括号并自动将内括号切换为方括号。

\documentclass[]{book}
\usepackage[natbib,authordate,backend=biber]{biblatex-chicago}%

\addbibresource{biblatex-examples.bib}

\begin{document}
This is for test \parentext{\citet{sigfridsson} and \citep{worman}}

\printbibliography
\end{document}

这是用于测试(Sigfridsson 和 Ryde [1998] 和 [Worman 2002])

答案2

您可以为 ever citation 命令定义一个别名,并在本地重新定义要使用的括号:

\let\citetb\citet
\let\citepb\citep
\def\switchparen{%
  \let\bibopenparen\bibopenbracket%
  \let\bibcloseparen\bibclosebracket}
\pretocmd{\citetb}{\switchparen}{}{}
\pretocmd{\citepb}{\switchparen}{}{}

平均能量损失

\begin{filecontents}[overwrite]{\jobname.bib}
@incollection{antibayes,
 Address = {The Press},
 Author = {G. Author1 and K. Author2 and M. Author3},
 Booktitle = {The {U}niversity},
 Date-Added = {2014-02-06 15:25:25 +0100},
 Date-Modified = {2014-02-06 15:28:59 +0100},
 Editor = {M. Editor1 and P. Editor2},
 Publisher = {The {U}niversity},
 Title = {The {C}ognitive {I}nterface},
 Year = {2021}}

@article{pijnacker2,
 Author = {J. Author4 and B. Author5 and M. Author6 and J. Author7 and P. Author8},
 Date-Added = {2014-02-06 15:14:32 +0100},
 Date-Modified = {2014-02-06 15:17:39 +0100},
 Journal = {Journal of {T}ext},
 Number = {2},
 Pages = {471--480},
 Title = {Study},
 Volume = {23},
 Year = {2010}}

\end{filecontents}

\documentclass[]{book}
\usepackage[natbib,authordate,backend=biber]{biblatex-chicago}%

\addbibresource{\jobname.bib}

\let\citetb\citet
\let\citepb\citep
\def\switchparen{%
  \let\bibopenparen\bibopenbracket%
  \let\bibcloseparen\bibclosebracket}
\pretocmd{\citetb}{\switchparen}{}{}
\pretocmd{\citepb}{\switchparen}{}{}


\begin{document}
 
This is for test (\citetb{antibayes} and \citepb{pijnacker2})
 
\printbibliography
 
\end{document}

在此处输入图片描述

相关内容