以 biblatex 风格构建最小日期范围

以 biblatex 风格构建最小日期范围

我正在使用这个问题自定义日期格式。不幸的是,日期范围(例如)的eventdate结果格式非常冗长2009 Sept. 16–2009 Sept. 18。如果只生成最小的日期范围就好了,这样可以尽可能跳过年份和月份的重复。

梅威瑟:

\documentclass{article}

\usepackage{filecontents}

\usepackage[style=numeric,backend=biber]{biblatex}
\ExecuteBibliographyOptions{alldates = long}
\makeatletter
\DefineBibliographyExtras{english}{%
  \protected\def\mkbibdatelong#1#2#3{%
    \iffieldbibstring{#1}
      {\bibstring{\thefield{#1}}}
      {\dateeraprintpre{#1}\stripzeros{\thefield{#1}}}%
    \iffieldundef{#2}
      {}
      {\iffieldundef{#1}{}{\space}%
        \mkbibmonth{\thefield{#2}}%
        \iffieldundef{#3}{}{\space}}%
    \iffieldundef{#3}
      {}
      {\stripzeros{\thefield{#3}}}}%
%
\protected\gdef\lbx@us@mkdaterangetrunc@long#1#2{%
  \iffieldundef{#2year}
    {}
    {\datecircaprint
     \printtext[#2date]{%
       \iffieldundef{#2season}
         {\csuse{mkbibdate#1}{#2year}{#2month}{#2day}%
          \dateeraprint{#2}}
         {\csuse{mkbibseasondate#1}{#2year}{#2season}}%
          \dateeraprint{#2}}%
       \dateuncertainprint
       \iffieldundef{#2endyear}
         {}
         {\iffieldequalstr{#2endyear}{}
           {\mbox{\bibdaterangesep}}
           {\bibdaterangesep
            \enddatecircaprint
            \iffieldundef{#2season}
              {\iffieldsequal{#2year}{#2endyear}
                {\iffieldsequal{#2month}{#2endmonth}
                  {\csuse{mkbibdate#1}{}{}{#2endday}}
                  {\csuse{mkbibdate#1}{}{#2endmonth}{#2endday}}}
                {\csuse{mkbibdate#1}{#2endyear}{#2endmonth}{#2endday}}}
              {\csuse{mkbibseasondate#1}{#2endyear}{#2endseason}}%
            \enddateuncertainprint
            \dateeraprint{#2}}}}}%
 }%
\makeatother

\begin{filecontents}{test.bib}
@inproceedings{Bannach2009,
 author = {Bannach, David and Amft, Oliver and Lukowicz, Paul},
 booktitle = {Smart Sensing and Context},
 eventdate = {2009-09-16/2009-09-18},
 eventtitle = {Smart Sensing and Context (EuroSCC 2009)},
 pages = {135--148},
 publisher = {Springer},
 title = {Automatic Event-Based Synchronization of Multimodal Data Streams from Wearable and Ambient Sensors},
 venue = {Guilford, UK},
 year = {2009}
}
\end{filecontents}

\bibliography{test}

\begin{document}
\nocite{*}
\printbibliography{}
\end{document}

在此处输入图片描述

答案1

我给出的代码具有日期范围的 biblatex eventdate 的自定义格式修改日期的输出comp。所以我们需要

\ExecuteBibliographyOptions{alldates = comp}

享受所有日期的变更。

相关内容