我遇到了以下情况:
我有我们复制如下,与包组合一起使用:
- babel[czech] v. 3.33 于 2019/07/19 开始
- biblatex v. 3.13a 自 2019/08/31 起
但不适用于这两个软件包的最新版本。编译甚至在biber
运行之前就失败了,并出现错误biblatex package: Patching babel failed
这个错误对我来说完全陌生,在 biblatex 文档中我找不到它的解决方案。我怀疑这个状态(从数据角度来看)来自 20.1.2020,这可能指向更新到 v. 3.38 的babel
遗憾的是,我只有我们(不是最小的),因为我不知道哪个部分导致我的代码与babel
和最近不兼容biblatex
;至少我希望版本本地化可以满足要求。
我们:
\documentclass[12pt,twoside]{book}
\usepackage [czech] {babel}
\usepackage{fontspec}
\usepackage{comment}
\usepackage{filecontents}
%definition of new entry type
\begin{filecontents}{speclegislation.dbx}
\DeclareDatamodelEntrytypes{speclegislation}
\DeclareDatamodelFields[type=field,datatype=literal]{
document,
short,
number,
year,
title,
paragraph,
article,
letter,
sortkey,
}
\DeclareDatamodelEntryfields[speclegislation]{
document,
short,
number,
year,
title,
paragraph,
article,
letter,
keywords,
sortkey,
}
\end{filecontents}
\usepackage{csquotes}
\usepackage[style=numeric, backend=biber, datamodel=speclegislation, refsegment=chapter, mincrossrefs=1, backref=true, backrefstyle=three]{biblatex}
\usepackage{nameref}
\DeclareBibliographyDriver{speclegislation}{%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\printfield{document}%
\newblock
\printfield{number}%
\newblock
\printfield{year}%
\newunit
\printfield{title}
\newblock
\printfield{paragraph} %
\newblock
\printfield{article} %
\newblock
\printfield{letter}%
\usebibmacro{pageref}%
\iftoggle{bbx:related}
{\usebibmacro{related:init}%
\usebibmacro{related}}
{}%
\usebibmacro{finentry}}
\DeclareSourcemap{
\maps[datatype=bibtex,overwrite=true]{
\map{
\pertype{speclegislation}
\step[fieldsource=paragraph]
\step[fieldset=sortkey, origfieldval]
}
}
}
\DeclareBibliographyCategory{zakon263}
\DeclareBibliographyCategory{vyhlaska329}
\AtDataInput{%
\ifkeyword{zakon263}
{\addtocategory{zakon263}{\thefield{entrykey}}}
{}%
\ifkeyword{vyhlaska329}
{\addtocategory{vyhlaska329}{\thefield{entrykey}}}
{}%
}
%Formátování polí jak v citacích (pomocí \printfield, tak v bibliografii
\DeclareFieldFormat{document}{#1 }
\DeclareFieldFormat{number}{#1/}
\DeclareFieldFormat{year}{#1 Sb., }
\DeclareFieldFormat{title}{#1 }
\DeclareFieldFormat{paragraph}{§ #1 }
\DeclareFieldFormat{article}{odst. #1 }
\DeclareFieldFormat{letter}{písm. #1)}
\DeclareFieldFormat{short}{#1 }
\renewcommand{\finentrypunct}{}%Vypnutí tečky na konci každé citace v bibliografii
\DefineBibliographyStrings{czech}{%Změna formy nadpisu Bibliografie na ``Reference''
bibliography = {Reference},
}
\defbibheading{subbib}{\section{Reference v kapitole~\ref{refsegment:\therefsection\therefsegment}: \nameref{refsegment:\therefsection\therefsegment} }}
\defbibheading{zakon263}{\section{Reference ze zákona 263/2016 Sb., Atomového zákona}}
\defbibheading{vyhlaska329}{\section{Reference z vyhlášky 329/2017 Sb., o požadavcích na projekt jaderného zařízení}}
%citations
\begin{filecontents}{citations.bib}
@speclegislation{v329p10o2pa,
paragraph = {10},
article = {2},
letter = {a},
keywords = {vyhlaska329},
crossref = {v329}
}
@speclegislation{v329p11pa,
paragraph = {11},
letter = {a},
keywords = {vyhlaska329},
crossref = {v329}
}
@speclegislation{v329,
document = {Vyhláška},
short = {v.},
number = {329},
year = {2017},
title = {Decree title},
keywords = {vyhlaska329}
}
@speclegislation{z263,
document = {Zákon},
short = {AtZ},
number = {263},
year = {2016},
title = {Atomic Act},
keywords = {zakon263}
}
\end{filecontents}
\addbibresource{citations.bib}
\DeclareCiteCommand{\legcite}%citace zákona
{\usebibmacro{prenote}}
{\usebibmacro{citeindex}%
\printfield{document}\printfield{number}\printfield{year}\printfield{title} %
\printtext[bibhyperref]{%
\printfield{labelprefix}%
[\printfield{labelnumber}]}%
}
{\addcomma\addspace}
{\usebibmacro{postnote}}
\DeclareCiteCommand{\parcite}%citace paragrafu
{\usebibmacro{prenote}}
{\usebibmacro{citeindex}%
\printfield{short}\printfield{number}\printfield{year}\printfield{paragraph}\printfield{article}\printfield{letter} %
\printtext[bibhyperref]{%
\printfield{labelprefix}%
[\printfield{labelnumber}]}%
}
{\addcomma\addspace}
{\usebibmacro{postnote}}
\usepackage{hyperref}
\begin{document}
\tableofcontents
\clearpage
\chapter{Test chapter}
Test of an custom citation \parcite{v329p10o2pa}.
\clearpage
Test of an custom citation \parcite{v329p10o2pa} on new page.
\clearpage
Test of an custom citation \parcite{v329p10o2pa} on new page.
Test of citation with no article \parcite{v329p11pa}.
\clearpage
\printbibheading[heading=bibintoc]
\printbibliography[heading=subbib, segment=\therefsegment]
\clearpage
\chapter{Another test chapter}
Test of an decree citation for this one \legcite{v329}.
\clearpage
\printbibheading[heading=bibintoc]
\printbibliography[heading=subbib, segment=\therefsegment]
\clearpage
\chapter{Yet more test chapter}
Test of an law citation \legcite{z263} and again the first citation \parcite{v329p10o2pa}.
\clearpage
\printbibheading[heading=bibintoc]
\printbibliography[heading=subbib, segment=\therefsegment]
\clearpage
\printbibheading
\bibbycategory
\end{document}
注意:此代码是我在尝试学习创建自己的参考书目驱动程序时编写的,但效果并不理想(很多时候我都不知道自己在做什么),它用于biblatex
创建自定义立法引文列表,并且包含捷克语和英语的混合。我只是问是否有一个命令/语句需要修补才能与最新版本的babel
和进行编译biblatex
。
答案1
捷克语使连字符-
有效,这意味着 biblatex 不再可以在\select@language
其定义文本包含非有效连字符时将其代码添加到前面。您可以\select@language
先通过修补来解决这个问题,但我建议 babel 避免在此处使用连字符。
\documentclass[12pt,twoside]{book}
\usepackage [czech] {babel}
\usepackage{fontspec}
\usepackage{etoolbox}
\makeatletter
\newcommand\my@hyphen{-}
\patchcmd\select@language{-}{\my@hyphen }{}{\fail}
\makeatother
\usepackage[]{biblatex}
\addbibresource{citations.bib}
\begin{document}
blub
\end{document}