我必须为我的论文使用一种非常独特的引用样式,因此开始自定义 biblatex.cfg 文件。我使用详细样式作为基础,并且已经在其他项目中取得了很大进展,但是,文章仍然存在问题。文章必须采用以下格式引用:
作者、标题、期刊年份、首页(pageref)。
在后续引用中,标题被删除。如果没有 journalshort,那么我必须使用 journaltitle
目前我有以下 biblatex.cfg:
% -- comma between bibliography units
\renewcommand*{\newunitpunct}{\addcomma\space}
% -- No prefix for pages
\DeclareFieldFormat{pages}{#1}
\DeclareFieldFormat{postnote}{#1}
\DeclareFieldFormat{multipostnote}{#1}
% -- No italic titles
\DeclareFieldFormat{title}{#1}
\DeclareFieldFormat{booktitle}{#1}
\DeclareFieldFormat{citetitle}{#1}
\DeclareFieldFormat{journaltitle}{#1}
% -- No "'" for title
\DeclareFieldFormat[article,inbook,incollection,inproceedings,patent,thesis,unpublished]{citetitle}{#1}
\DeclareFieldFormat[article,inbook,incollection,inproceedings,patent,thesis,unpublished]{title}{#1}
% -- Authors and editors in italic and only show surname
\DeclareNameFormat{family}{\mkbibemph{%
\usebibmacro{name:family}
{\namepartfamily}
{\namepartgiven}
{\namepartprefix}
{\namepartsuffix}}%
\usebibmacro{name:andothers}}
\DeclareNameAlias{default}{family}
\DeclareNameAlias{sortname}{default}
\DeclareNameAlias{labelname}{default}
% -- "/" between names but "," and "and" in textcite
\DeclareDelimFormat{multinamedelim}{\slash}
\DeclareDelimAlias{finalnamedelim}{multinamedelim}
\DeclareDelimFormat[textcite]{multinamedelim}{\addcomma\space}
\DeclareDelimFormat[textcite]{finalnamedelim}{\addnbspace\bibstring{and}\space}
\DeclareBibliographyDriver{article}{%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\usebibmacro{author}%
\setunit{\printdelim{nametitledelim}}\newblock
\usebibmacro{maintitle+title}%
\setunit{\addcomma\addspace}\newblock
\iffieldundef{shortjournal}{\iffieldundef{journaltitle}{}{\printtext[journaltitle]{\printfield{journaltitle}}}}{\printtext[journaltitle]{\printfield[titlecase]{shortjournal}}}%
\setunit{\addspace}\newblock
\printfield{year}%
\mkfirstpage{\printfield{pages}}%
\setunit{\addspace}\newblock
\parentext{\usebibmacro{pageref}}%
\newunit\newblock
\iftoggle{bbx:related}{\usebibmacro{related:init}%
\usebibmacro{related}}{}%
\usebibmacro{finentry}}
使用这个例子:
\documentclass{article}
\usepackage[backend=biber, style=verbose]{biblatex}
\addbibresource{\jobname.bib}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@article{citation,
title = {Short title: Long title},
shorttitle = {Short title},
author = {Doe, John},
date = {1995},
journaltitle = {Journal Title},
shortjournal = {JT},
pages = {120--130}
}
\end{filecontents}
\begin{document}
\cite[125]{citation}
\cite[127]{citation}
\printbibliography
\end{document}
我得到:
多伊, 简称:长标题,JT 1995(),125
多伊,简称,127
参考
多伊,简称:长标题,JT 1995120–130()。
但我需要:
多伊,简称:长标题,JT 1995,120(125)。
多伊,JT 1995,120(128)。
参考
多伊,简称:长标题,JT 1995,120。
- 我如何显示文章的第一页?我似乎无法显示 \mkfirstpage{\printfield{pages}}。
- 我怎样才能将 pageref 放在括号中?
- 我怎样才能在后续引用中删除标题?
答案1
\mkfirstpage{\printfield{pages}}
无法按预期工作。您需要使用\mkfirstpage
in\DeclareFieldFormat
,因为它需要简单文本而不是复杂的宏作为输入。(此外总是建议仅在 bibmacros 或驱动程序中使用格式化命令,\DeclareFieldFormat
而不是直接在 bibmacros 或驱动程序中使用。使用宏\printfield
可能会产生其他意想不到的后果,特别是当字段恰好为空时。)所以你想要\DeclareFieldFormat[article]{pages}{\mkfirstpage{#1}}
宏
pageref
不会格式化您传递给命令的页码\cite
。该页码的格式为postnote
。pageref
用于反向引用。您需要修改postnote
字段格式,并且可能不想管它pageref
。这比较棘手。在后续的简短引文中打印期刊名称,但不打印标题显然只对
@article
条目有意义,而对其他类型则没有意义,因此您需要特定类型的简短引文。这可以按如下所示实现自定义详细引用样式,自定义类型在后续引用中消失和使 style=verbose 的 @online 简短引文更加详细。
总之你可以尝试这样的事情
\documentclass{article}
\usepackage[backend=biber, style=verbose]{biblatex}
\renewcommand*{\newunitpunct}{\addcomma\space}
\renewcommand*{\mkbibnamefamily}{\mkbibemph}
\DeclareNameFormat{family}{%
\usebibmacro{name:family}
{\namepartfamily}
{\namepartgiven}
{\namepartprefix}
{\namepartsuffix}%
\usebibmacro{name:andothers}}
\DeclareNameAlias{default}{family}
\DeclareNameAlias{sortname}{default}
\DeclareNameAlias{labelname}{default}
\DeclareDelimFormat{multinamedelim}{\slash}
\DeclareDelimAlias{finalnamedelim}{multinamedelim}
\DeclareDelimFormat[textcite]{multinamedelim}{\addcomma\space}
\DeclareDelimFormat[textcite]{finalnamedelim}{\addnbspace\bibstring{and}\space}
\DeclareFieldFormat{title}{#1}
\DeclareFieldFormat[article,inbook,incollection,inproceedings,patent,thesis,unpublished]{title}{#1}
\DeclareFieldFormat{booktitle}{#1}
\DeclareFieldFormat{citetitle}{#1}
\DeclareFieldFormat[article,inbook,incollection,inproceedings,patent,thesis,unpublished]{citetitle}{#1}
\DeclareFieldFormat{journaltitle}{#1}
\renewcommand*{\subtitlepunct}{\addcolon\space}
\DeclareFieldFormat{pages}{#1}
\DeclareFieldFormat[article]{pages}{\mkfirstpage{#1}}
\DeclareFieldFormat{postnote}{\mknormrange{#1}}
\DeclareFieldFormat[article]{postnote}{%
\ifpages{#1}
{\mkbibparens{\mknormrange{#1}}}
{\mknormrange{#1}}}
\DeclareFieldFormat{multipostnote}{#1}
\DeclareDelimFormat{postnotedelim}{%
\ifboolexpr{
test {\ifentrytype{article}}
and test {\iffieldpages{postnote}}}
{\addspace}
{\addcomma\space}%
}
\DeclareBibliographyDriver{article}{%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\usebibmacro{author}%
\setunit{\printdelim{nametitledelim}}\newblock
\usebibmacro{maintitle+title}%
\setunit{\addcomma\addspace}\newblock
\iffieldundef{shortjournal}
{\printfield{journaltitle}}
{\printtext[journaltitle]{%
\printfield[titlecase]{shortjournal}}}%
\setunit{\addspace}\newblock
\printdate
\setunit{\bibpagespunct}%
\printfield{pages}%
\setunit{\bibpagerefpunct}\newblock
\usebibmacro{pageref}%
\newunit\newblock
\iftoggle{bbx:related}
{\usebibmacro{related:init}%
\usebibmacro{related}}
{}%
\usebibmacro{finentry}}
\renewbibmacro*{cite:short}{%
\ifbibmacroundef{cite:short:@\strfield{entrytype}}
{\usebibmacro{cite:short:standard}}
{\usebibmacro*{cite:short:@\strfield{entrytype}}}}
\newbibmacro*{cite:short:standard}{%
\printnames{labelname}%
\setunit*{\printdelim{nametitledelim}}%
\printtext[bibhyperlink]{%
\printfield[citetitle]{labeltitle}}}
\newbibmacro*{cite:short:@article}{%
\printnames{labelname}%
\setunit*{\printdelim{nametitledelim}}%
\printtext[bibhyperlink]{%
\iffieldundef{shortjournal}
{\printfield{journaltitle}}
{\printtext[journaltitle]{%
\printfield[titlecase]{shortjournal}}}%
\setunit{\addspace}\newblock
\printdate
\setunit{\bibpagespunct}%
\printfield{pages}}}
\begin{filecontents}{\jobname.bib}
@article{citation,
author = {Doe, John},
title = {Short title},
subtitle = {Long title},
date = {1995},
journaltitle = {Journal Title},
shortjournal = {JT},
pages = {120--130},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\begin{document}
\cite[125]{citation}
\cite[127]{citation}
\printbibliography
\end{document}