我有以下代码:
\documentclass{article}
\usepackage[style = authoryear-comp]{biblatex}
\AtEveryBibitem{\ifentrytype{article}{\clearfield{number}}{}} % don't print issue for article entries
\renewbibmacro{in:}{\ifentrytype{article}{}{\printtext{\bibstring{in}\intitlepunct}}} % don't print "in" for articles
\renewcommand{\bibpagespunct}{\ifentrytype{article}{\addcolon}{\addperiod\addspace}} % colon between volume and page ranges for journal articles, period plus space for articles in books
\DeclareFieldFormat[article, incollection, unpublished]{pages}{#1} % no word 'pages' for articles in the bibliography (print as is)
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@ARTICLE{jensen1916,
AUTHOR = "Alfred Jensen",
TITLE = "Bemerkninger til dagligtalen i Kristiania",
JOURNALTITLE = "Maal og Minne",
YEAR = "1916",
NUMBER = "1--2",
PAGES = "60--89"}
\end{filecontents}
\addbibresource{\jobname.bib}
\begin{document}
\nocite{*}
\printbibliography
\end{document}
书目条目是期刊中不使用卷号的文章(因为每年出版一卷,所以年份本身就足够了)。上面的代码将在期刊名称和页码范围之间打印一个冒号分隔符。我觉得这看起来很奇怪。
在这种情况下,我更喜欢使用空格:
詹森,阿尔弗雷德(1916 年)。 “对克里斯蒂安尼亚的每日新闻的评价”。马尔奥格明内60-89。
或者逗号加空格:
詹森,阿尔弗雷德(1916 年)。 “对克里斯蒂安尼亚的每日新闻的评价”。马尔奥格明内,60-89。
我怎样才能实现这一点,以便当期刊有卷号时打印冒号,而当没有卷号时打印空格或逗号加空格?
答案1
\renewcommand{\bibpagespunct}{\ifentrytype{article}{\addcolon}{\addperiod\addspace}}
我们可以进一步充实逻辑
\renewcommand*{\bibpagespunct}{%
\ifentrytype{article}{%
\iffieldundef{volume}
{\addcomma\space}
{\addcolon}}
{\addperiod\addspace}}
@article
如果条目没有音量,则打印逗号;如果带有@article
音量,则打印冒号;否则打印句号。
\documentclass{article}
\usepackage[style = authoryear-comp]{biblatex}
\AtEveryBibitem{\ifentrytype{article}{\clearfield{number}}{}} % don't print issue for article entries
\renewbibmacro{in:}{\ifentrytype{article}{}{\printtext{\bibstring{in}\intitlepunct}}} % don't print "in" for articles
% colon between volume and page ranges for journal articles, period plus space for articles in books
\DeclareFieldFormat[article, incollection, unpublished]{pages}{#1} % no word 'pages' for articles in the bibliography (print as is)
\renewcommand{\bibpagespunct}{%
\ifentrytype{article}{%
\iffieldundef{volume}
{\addcomma\space}
{\addcolon}}
{\addperiod\addspace}}
\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@ARTICLE{jensen1916,
AUTHOR = "Alfred Jensen",
TITLE = "Bemerkninger til dagligtalen i Kristiania",
JOURNALTITLE = "Maal og Minne",
YEAR = "1916",
NUMBER = "1--2",
PAGES = "60--89"}
\end{filecontents*}
\addbibresource{\jobname.bib}
\addbibresource{biblatex-examples.bib}
\begin{document}
\nocite{angenendt,jensen1916}
\printbibliography
\end{document}
答案2
这就像你想要的吗?
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[style = authoryear-comp]{biblatex}
\AtEveryBibitem{\ifentrytype{article}{\clearfield{number}}{}} % don't print issue for article entries
\renewbibmacro{in:}{\ifentrytype{article}{}{\printtext{\bibstring{in}\intitlepunct}}} % don't print "in" for articles
\renewcommand{\bibpagespunct}{\ifentrytype{article}{\addcolon}{\addperiod\addspace}} % colon between volume and page ranges for journal articles, period plus space for articles in books
\DeclareFieldFormat[article, incollection, unpublished]{pages}{#1} % no word 'pages' for articles in the bibliography (print as is)
\renewcommand\bibpagespunct{\iffieldundef{volume}{\addcomma\space}{\addcolon\space}}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@ARTICLE{jensen1916,
AUTHOR = "Alfred Jensen",
TITLE = "Bemerkninger til dagligtalen i Kristiania",
JOURNALTITLE = "Maal og Minne",
YEAR = "1916",
NUMBER = "1--2",
PAGES = "60--89"}
@ARTICLE{Ricoeur:2000ga,
AUTHOR = {Ricœur, Paul},
TITLE = {{L'écriture de l'histoire et la représentation du passé}},
JOURNAL = {AHESS},
YEAR = {2000},
VOLUME = {55},
NUMBER = {4},
PAGES = {731--747},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\begin{document}
\nocite{*}
\printbibliography
\end{document}