带有自定义引用命令的 Biblatex 检查选项

带有自定义引用命令的 Biblatex 检查选项

我对 的一些自定义功能有疑问biblatex。出于某些原因,我想使用特殊命令来引用规范性文件:我想让它们(在文本和参考书目中)以简称而不是作者姓名或数字出现。另外,我需要在打印参考书目时使用检查选项。这是我的问题,在我的情况下,这两者的组合效果不佳:规范性文本未出现在参考书目中。

我认为这只是命令定义的问题,但我没有找到 biblatex 的文档来解决这个问题。

以下是 MWE:

\documentclass{book}

\usepackage[utf8]{inputenc}     
\usepackage[T1]{fontenc}        

\usepackage{hyperref}           

\usepackage[citestyle=alphabetic,
    bibstyle=alphabetic, 
    citetracker=true,   
    mcite=true,             
    backend=biber           
    ]{biblatex}

\addbibresource[datatype=bibtex]{./biblio.bib}

\DeclareBibliographyDriver{standard}{\usedriver{\newblock}{manual}
    \usebibmacro{pageref}
    \finentry}


\DeclareCiteCommand{\parencitetitle}[\mkbibparens]
{\boolfalse{citetracker}
    \boolfalse{pagetracker}
    \usebibmacro{prenote}}
{\ifciteindex
    {\indexfield{indextitle}}
    {}%
    %\printfield[citetitle]{labeltitle}}
    \printtext[bibhyperref]{\printfield[citetitle]{labeltitle}}}
{\multicitedelim}
{\usebibmacro{postnote}}


\defbibcheck{mynocite}{
    \ifboolexpr{test{\ifciteseen} or test {\ifkeyword{secondary}}}
    {}
    {\skipentry}
}

\begin{document}        

    Firsts references: \cite{banks92}               
    Eurocode : \parencitetitle{en1998}

    \printbibliography[check=mynocite]

\end{document}

使用 bib 文件biblio.bib

@STANDARD{en1998,
  shorttitle = {EN 1998},
  title = {EN 1998, Eurocode 8: contruction norms},
  organization = {CEN},
  address = {Brussels, Belgium},
  year = {2005},
}

@book{banks92,
  title={Control and Estimation in Distributed Parameter Systems},
  author={Banks, H.T.},
  isbn={9780898712971},
  lccn={92027712},
  series={Frontiers in Applied Mathematics},
  url={http://books.google.fr/books?id=Gp5usSwk31wC},
  year={1992},
  publisher={Society for Industrial and Applied Mathematics}
}

当然,在这个例子中可以删除检查选项,但是在更大的情况下我需要它。

答案1

随着\boolfalse{citetracker}

\DeclareCiteCommand{\parencitetitle}[\mkbibparens]
{\boolfalse{citetracker}
    \boolfalse{pagetracker}
    \usebibmacro{prenote}}
{\ifciteindex
    {\indexfield{indextitle}}
    {}%
    %\printfield[citetitle]{labeltitle}}
    \printtext[bibhyperref]{\printfield[citetitle]{labeltitle}}}
{\multicitedelim}
{\usebibmacro{postnote}}

(请注意,%\boolfalse{citetracker}和之后缺少两个\boolfalse{pagetracker},正如您在打开的圆括号后不需要的空格所看到的)您关闭了该命令的引用跟踪。特别是,仅使用 引用的条目\parencitetitle在使用 进行测试时会给出错误\ifciteseen

解决方案是删除\boolfalse定义中的两个\parencitetitle

\DeclareCiteCommand{\parencitetitle}[\mkbibparens]
  {\usebibmacro{prenote}}
  {\ifciteindex
    {\indexfield{indextitle}}
    {}%
    \printtext[bibhyperref]{\printfield[citetitle]{labeltitle}}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

en1998在参考书目中仍然会显得有点愚蠢,所以我建议你使用shorthand

@STANDARD{en1998,
  shorthand    = {EN 1998},
  shorttitle   = {EN 1998},
  title        = {EN 1998, Eurocode 8: contruction norms},
  organization = {CEN},
  address      = {Brussels, Belgium},
  year         = {2005},
}

事实上,如果您使用,shorthand您只需使用正常方法即可\cite获得几乎相同的效果\parencitetitle(只有括号不同)。

平均能量损失

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[style=alphabetic, citetracker=true, backend=biber]{biblatex}
\usepackage{hyperref}

\DeclareBibliographyDriver{standard}{\usedriver{\newblock}{manual}
  \usebibmacro{pageref}%
  \finentry}

\DeclareCiteCommand{\parencitetitle}[\mkbibparens]
  {\usebibmacro{prenote}}
  {\ifciteindex
    {\indexfield{indextitle}}
    {}%
    \printtext[bibhyperref]{\printfield[citetitle]{labeltitle}}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

\defbibcheck{mynocite}{
  \ifboolexpr{test {\ifciteseen} or test {\ifkeyword{secondary}}}
    {}
    {\skipentry}}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@STANDARD{en1998,
  shorthand    = {EN 1998},
  shorttitle   = {EN 1998},
  title        = {EN 1998, Eurocode 8: contruction norms},
  organization = {CEN},
  address      = {Brussels, Belgium},
  year         = {2005},
}
@STANDARD{en1999,
  shorthand    = {EN 1999},
  title        = {EN 1999, Eurocode 9: contruction norms},
  organization = {CEN},
  address      = {Brussels, Belgium},
  year         = {2006},
}
@book{banks92,
  title     = {Control and Estimation in Distributed Parameter Systems},
  author    = {Banks, H.T.},
  isbn      = {9780898712971},
  series    = {Frontiers in Applied Mathematics},
  year      = {1992},
  publisher = {Society for Industrial and Applied Mathematics},
}
\end{filecontents}

\addbibresource{\jobname.bib}

\begin{document}
  First references: \cite{banks92}
  Eurocode : \parencitetitle{en1998} or \cite{en1999}

  \printbibliography[check=mynocite]
\end{document}

首次引用:[Ban92] 欧洲规范:(EN 1998)或 [EN 1999]//参考文献//[Ban92] HT Banks。分布参数系统中的控制和估计。应用数学前沿。工业和应用数学学会,1992 年。isbn:9780898712971。//[EN 1998] EN 1998,欧洲规范 8:施工规范。CEN。布鲁塞尔,比利时,2005 年。//[EN 1999] EN 1999,欧洲规范 9:施工规范。CEN。布鲁塞尔,比利时,2006 年。

相关内容