方法古斯布斯对我的问题Biblatex:两种不同风格和排序的书目 II,它基于以下解决方案Biblatex:两种具有不同风格和排序的书目经过莫威,这就是我想要实现的。这种方法(古斯布斯) 以此numeric-comp
为基础风格,labelalpha
为现场带来信息shorthand
。
然而,在引用标签中嵌入的真实变音字符或变音命令(分别为ä
或)的编码存在问题。{\"a}
通过增加:
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
到原来的平均能量损失 并包括嵌入的真实变音符号字符以及变音符号命令:
{Author Aaa}, --> {Author Ät{\"a}},
{Author Bbb}, --> {Author Bb\"{a}},
{Author Ccc}, --> {Author Ccö},
引用标签(在文本中)似乎被“去标记化”并变成了普通的 UTF-8 字符,例如:
[BbÃď02]
代替
[Bbä02]
或者
[第 03 版]
代替
[星期六]
但引用标签在参考书目中显示正确。
通过添加 biblatex 包选项,safeinputec
引用标签将转换为 Ascii 符号(如预期),因为utf8
被忽略。例如:
[Bb\"{a}02]
或者
[\"{A}t\"{a}b03]
有没有什么解决方法可以解决这个问题并正确显示引用标签中的变音符号?
梅威瑟:
\documentclass{article}
\usepackage{filecontents}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\begin{filecontents}{biblatextest1.bib}
@BOOK{BookA03,
author = {Author Ät{\"a}},
title = {Some Title},
publisher = {Some Publisher},
year = 2003,
}
@BOOK{BookB02,
author = {Author Bb\"{a}},
title = {Some Title},
publisher = {Some Publisher},
year = 2002,
}
@BOOK{BookB09,
author = {Author Jjj},
title = {Some Title},
publisher = {Some Publisher},
year = 2002,
}
@BOOK{BookB10,
author = {Author Kkk},
title = {Some Title},
publisher = {Some Publisher},
year = 2002,
}
@BOOK{BookB11,
author = {Author Lll},
title = {Some Title},
publisher = {Some Publisher},
year = 2002,
}
\end{filecontents}
\begin{filecontents}{biblatextest2.bib}
@MISC{LinkC04,
author = {Author Ccc},
title = {Some Title},
year = 2004,
url = {www.test1.com/bild.jpg},
}
@MISC{LinkD01,
author = {Author Ddd},
title = {Some Title},
year = 2001,
url = {www.test2.com/bild.jpg},
}
@MISC{LinkD05,
author = {Author Eee},
title = {Some Title},
year = 2004,
url = {www.test3.com/bild.jpg},
}
@MISC{LinkD06,
author = {Author Fff},
title = {Some Title},
year = 2001,
url = {www.test4.com/bild.jpg},
}
@MISC{LinkD07,
author = {Author Ggg},
title = {Some Title},
year = 2004,
url = {www.test5.com/bild.jpg},
}
@MISC{LinkD08,
author = {Author Hhh},
title = {Some Title},
year = 2001,
url = {www.test6.com/bild.jpg},
}
\end{filecontents}
\usepackage[style = numeric-comp, labelalpha, defernumbers]{biblatex}
\addbibresource{biblatextest1.bib}
\addbibresource{biblatextest2.bib}
\usepackage{hyperref}
%Append keywords to identify different bibliography entries.
\DeclareSourcemap{
\maps[datatype=bibtex, overwrite]{
\map{
\perdatasource{biblatextest1.bib}
\step[fieldset=KEYWORDS, fieldvalue=primary]
}
\map{
\perdatasource{biblatextest2.bib}
\step[fieldset=KEYWORDS, fieldvalue=secondary]
}
}
}
\makeatletter
\newcommand*{\labelalphatoshorthand}{\csdef{abx@field@shorthand}
{\strfield{labelprefix}\strfield{labelalpha}\strfield{extraalpha}}}
\makeatother
\AtEveryCitekey{\ifkeyword{primary}{\labelalphatoshorthand}{}}
\DeclareFieldFormat{labelalphawidth}{\mkbibbrackets{#1}}
\defbibenvironment{bibliographyALPHA}
{\list
{\printtext[labelalphawidth]{%
\printfield{labelprefix}%
\printfield{labelalpha}%
\printfield{extraalpha}}}
{\setlength{\labelwidth}{\labelalphawidth}%
\setlength{\leftmargin}{\labelwidth}%
\setlength{\labelsep}{\biblabelsep}%
\addtolength{\leftmargin}{\labelsep}%
\setlength{\itemsep}{\bibitemsep}%
\setlength{\parsep}{\bibparsep}}%
\renewcommand*{\makelabel}[1]{##1\hss}}
{\endlist}
{\item}
\begin{document}
The first two citations \cite{LinkD07,LinkC04} and
\cite{BookB10,BookB11,BookB02,BookB09}.
Mixing both primary and secondary
\cite{LinkD08,LinkD01,LinkD05,LinkD06,BookB10,BookB11,BookB02,BookB09}.
The others are \cite{LinkD08,LinkD01,LinkD05,LinkD06,LinkD07}
and \cite{BookA03}.
\printbibliography[env=bibliographyALPHA, title=Bibliography, keyword=primary]
\newrefcontext
\printbibliography[title=References, keyword=secondary, resetnumbers]
\end{document}
提前非常感谢您。
答案1
你需要
\makeatletter
\newcommand*{\labelalphatoshorthand}{%
\csdef{abx@field@shorthand}{%
\thefield{labelprefix}\thefield{labelalpha}\thefield{extraalpha}}}
\makeatother
使用而\thefield
不是\strfield
。\strfield
清理/反标记该字段,使其可以安全地用于命令名称等。这不是您想要的,您需要的是用于排版的字段内容,因此您可以使用\thefield
。