期刊缩写列表打印缩写而不是长期刊名称

期刊缩写列表打印缩写而不是长期刊名称

我正在使用 BiblatexDeclareSourceMap和文件shortjournal中的一个字段.bib来获取引文中的缩写期刊标题。以下是 MWE:

\documentclass{article} 
\usepackage[style=oscola]{biblatex}  
 \addbibresource{mwe.bib}  

  \DeclareBibliographyDriver{shortjournal}{%                                                
 \printfield{journaltitle}} 
   
\DeclareSourcemap{% 
\maps[datatype=bibtex]{ 
 \map[overwrite]{ 
 \step[fieldsource=shortjournal] 
 \step[fieldset=journaltitle,origfieldval] 
} } } 
\begin{document} 
   
 \section{First Section} 
 
 Here is a reference to an article with an abbreviated journal name\autocite{Herlin2008aa} 
 
 
\printbiblist[title={Journal Shorthands}]{shortjournal} 
\end{document}

将其放入 mwe.bib 中:

@article{Herlin2008aa,
    author = {Herlin-Karnell, Ester},
    number = {10},
    pages = {1115 -- 1130},
    title = {What Principles Drive (or Should Drive) European Criminal Law?},
    volume = {11},
    date = {2008},
    journaltitle = {Common Market Law Review},
    shortjournal = {CMLRev.}
    }

这是可行的,而且特别好的是,我的参考书目风格(oscola)采用了这个值shortjournal并从中去除任何句点,就像它对字符串所做的那样journaltitle

但是,打印缩写列表时,一列的shortjournal值带有句点,而另一列的shortjournal值不带有句点。当然,我想要的是第二列显示完整的期刊标题,换句话说,journaltitle显示受到 之前的原始值DeclareSourceMap

据我所知(完全新手……),DeclareSourceMap首先应用(参见Biber手册第 3.1.2 节)。因此,当我把

\DeclareBibliographyDriver{shortjournal}{%
\printfield{journaltitle}}

在我的序言中,journaltitle已经被重新映射。

journaltitle那么,为了达到这个列表的目的,我该如何打印原始值呢?

如果做不到这一点,那是不是意味着你永远无法创建期刊缩写列表?毕竟,这不是DeclareSoureMap在 biblatex 中使用期刊缩写的标准方法吗?

答案1

使用源映射,您实际上只是在从文件中读取条目数据时对其进行操作.bib。这意味着,无论出于何种目的,使用源映射进行覆盖都journaltitle意味着shortjournal现在journaltitle包含字段的内容shortjournal,并且无法在侧面恢复旧字段值biblatex

一种解决方案是将原始内容保存journaltitle在不同的字段中(比如longjournaltitle,我们需要在数据模型文件中声明这个新字段),并在日记简写列表中需要时使用该字段。

\documentclass{article}

\begin{filecontents}{longjournaltitle.dbx}
\DeclareDatamodelFields[type=field, datatype=literal]{longjournaltitle}

\DeclareDatamodelEntryfields[article,perioduical]{longjournaltitle}
\end{filecontents}

\usepackage[style=oscola, datamodel=longjournaltitle]{biblatex}

\DeclareBibliographyDriver{shortjournal}{%
  \printfield{longjournaltitle}}

\DeclareSourcemap{%
  \maps[datatype=bibtex]{
    \map[overwrite]{
      \step[fieldsource=shortjournal, final]
      \step[fieldsource=journaltitle]
      \step[fieldset=longjournaltitle, origfieldval]
      \step[fieldsource=shortjournal]
      \step[fieldset=journaltitle, origfieldval] 
    }
  }
}


\begin{filecontents}{\jobname.bib}
@article{Herlin2008aa,
  author       = {Herlin-Karnell, Ester},
  number       = {10},
  pages        = {1115 -- 1130},
  title        = {What Principles Drive (or Should Drive) European Criminal Law?},
  volume       = {11},
  date         = {2008},
  journaltitle = {Common Market Law Review},
  shortjournal = {CMLRev.},
}
\end{filecontents}
\addbibresource{\jobname.bib}

\begin{document}
\null\vfill % just for the MWE
Here is a reference to an article with an abbreviated journal name\autocite{Herlin2008aa}

\printbiblist[title={Journal Shorthands}]{shortjournal}
\end{document}

CMLRev. 共同市场法律评论


另一个解决方案是根本不重新映射字段。相反,我们指示您的样式shortjournal在可用时打印。

这是通过重新定义journalbibmacro 来完成的biblatex.def

源映射不再重新映射任何字段,它仅从字段中删除s (这是from 的.源映射的副本)。journaltitleoscola.bbx

\documentclass{article}
\usepackage[style=oscola]{biblatex}

\DeclareBibliographyDriver{shortjournal}{%
  \printfield{journaltitle}}

\DeclareSourcemap{%
  \maps[datatype=bibtex]{
    \map[overwrite]{
     \step[fieldsource=shortjournal,
           match=\regexp{(\d)\.(\d)},
           replace=\regexp{$1.$2}]
     \step[fieldsource=shortjournal,
           match=\regexp{(\D)\.(\d)},
           replace=\regexp{$1 $2}]
     \step[fieldsource=shortjournal,
            match=\regexp{\.(\D)},
            replace=\regexp{$1}]
     \step [fieldsource=shortjournal,
            match=\regexp{(\D)\.},
            replace=\regexp{$1}]
    }
  }
}

\renewbibmacro*{journal}{%
  \iffieldundef{shortjournal}
    {\ifboolexpr{
       test {\iffieldundef{journaltitle}}
       and
       test {\iffieldundef{journalsubtitle}}
     }
       {}
       {\printtext[journaltitle]{%
          \printfield[titlecase]{journaltitle}%
          \setunit{\subtitlepunct}%
          \printfield[titlecase]{journalsubtitle}}%
        \newunit}}
    {\printtext[journaltitle]{\printfield[titlecase]{shortjournal}}}%
  \iffieldundef{journaltitleaddon}
    {}
    {\printfield{journaltitleaddon}}}

\begin{filecontents}{\jobname.bib}
@article{Herlin2008aa,
  author       = {Herlin-Karnell, Ester},
  number       = {10},
  pages        = {1115 -- 1130},
  title        = {What Principles Drive (or Should Drive) European Criminal Law?},
  volume       = {11},
  date         = {2008},
  journaltitle = {Common Market Law Review},
  shortjournal = {CMLRev.},
}
\end{filecontents}
\addbibresource{\jobname.bib}

\begin{document}
\null\vfill % just for the MWE
Here is a reference to an article with an abbreviated journal name\autocite{Herlin2008aa}

\printbiblist[title={Journal Shorthands}]{shortjournal}
\end{document}

CMLRev 共同市场法律评论

相关内容