1

The approach of gusbrs to my question Biblatex: Two bibliographies with different styles and sortings II, which is based on the solution of Biblatex: Two bibliographies with different styles and sortings by moewe, is what I wanted to achieve. This approach (of gusbrs) takes numeric-comp as a base style and brings labelalpha information to the shorthand field.

Nevertheless, there is a problem with the encoding of embedded real umlaut-characters or umlaut-commands (ä or {\"a}, respectively) in the citation label.

By adding:

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

to the original MWE and including embedded real umlaut-characters as well as umlaut-commands:

{Author Aaa}, -->  {Author Ät{\"a}},
{Author Bbb}, -->  {Author Bb\"{a}},
{Author Ccc}, -->  {Author Ccö},

the citation labels (in the text) seem to be "detokenized" and become as plain UTF-8 characters, for example:

[BbÃď02]

instead of

[Bbä02]

or

[ÃĎtÃď03]

instead of

[Ätä03]

But the citation labels are display correctly in the bibliography.

By adding the biblatex package option safeinputec the cite labels are converted to Ascii notation (as expected), because utf8 is ignored. For instance:

[Bb\"{a}02]

or

[\"{A}t\"{a}b03]

Is there any workaround to solve this problem and display correctly the umlaut-characters in the citation labels?

MWE:

\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}

enter image description here

Thank you very much in advance.

2

You need

\makeatletter
\newcommand*{\labelalphatoshorthand}{%
  \csdef{abx@field@shorthand}{%
    \thefield{labelprefix}\thefield{labelalpha}\thefield{extraalpha}}}
\makeatother

with \thefield instead of \strfield. \strfield sanitises/detokenizes the field to make it safe for use in command names and the like. This is not what you want here, you want the field contents for typesetting, so you can use \thefield.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.