3

I want to have a large capital letter before every alphabetic section in the bibliography. The following .bib entry causes the error "Package biblatex Error: Category 'Ç' not declared. \endentry":

@Article{Cakir2011,
  author    = {Esra {\c{C}}ak{\i}r and E. Allen Foegeding},
  journal   = {Food Hydrocolloids},
  title     = {Combining protein micro-phase separation and protein{\textendash}polysaccharide segregative phase separation to produce gel structures},
  year      = {2011},
  number    = {6},
  pages     = {1538-1546},
  volume    = {25},
}

In the .bbl file, it turns out this:

family={{Ç}ak{ı}r},
           familyi={Ç\bibinitperiod},

Hence, biblatex tries to sort this entry into the Category Ç, which doesn't exist. How do I force biblatex to sort entries with an accented first letter of the family name into the Category of the regular letter - in this case, C?

MWE:

\begin{filecontents}{\cakir.bib}

@Article{Cakir2011,
    author    = {Esra {\c{C}}ak{\i}r and E. Allen Foegeding},
    journal   = {Food Hydrocolloids},
    title     = {Combining protein micro-phase separation and protein{\textendash}polysaccharide segregative phase separation to produce gel structures},
    year      = {2011},
    number    = {6},
    pages     = {1538-1546},
    volume    = {25},
}

\end{filecontents}

\documentclass{scrreprt}
\usepackage[english]{babel}

\usepackage[
backend=biber,
style=authoryear,
citestyle=authoryear,
giveninits=true,
maxbibnames=10,
date=year,
isbn=false,
doi=false,
url=false
]{biblatex}

\addbibresource{\cakir.bib}

%%-- large initial letter before every new alphabetic section
\makeatletter
\def\ifskipbib{\iftoggle{blx@skipbib}}
\makeatother

\def\initlist{}
\forcsvlist{\listadd\initlist}{A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z}
\forlistloop{\DeclareBibliographyCategory}{\initlist}
\renewcommand*{\do}[1]{\defbibheading{#1}{\section*{#1}}}
\dolistloop{\initlist}
\AtDataInput{\ifskipbib{}{\addtocategory{\thefield{sortinit}}{\thefield{entrykey}}}}

\begin{document}

This scientist's last name begins with an accented letter: \cite{Cakir2011}.

\end{document}
4

It is probably simplest to fill the sortname field with the name stripped of all diacritics.

\documentclass{report}
\usepackage[english]{babel}

\usepackage[backend=biber,
  style=authoryear,
  giveninits=true, maxbibnames=10,
  date=year,
  isbn=false, doi=false, url=false
]{biblatex}


\makeatletter
\def\ifskipbib{\iftoggle{blx@skipbib}}
\makeatother

\def\initlist{}
\forcsvlist{\listadd\initlist}{A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z}
\forlistloop{\DeclareBibliographyCategory}{\initlist}
\renewcommand*{\do}[1]{\defbibheading{#1}{\section*{#1}}}
\dolistloop{\initlist}

\AtDataInput{%
  \ifskipbib
    {}
    {\addtocategory{\thefield{sortinit}}{\thefield{entrykey}}}}



\begin{filecontents}{\jobname.bib}
@article{Cakir2011,
  author    = {Esra Çakır and E. Allen Foegeding},
  sortname  = {Esra Cakir and E. Allen Foegeding},
  journal   = {Food Hydrocolloids},
  title     = {Combining protein micro-phase separation and
               protein--polysaccharide segregative phase separation
               to produce gel structures},
  year      = {2011},
  number    = {6},
  pages     = {1538-1546},
  volume    = {25},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\addbibresource{biblatex-examples.bib}

\nocite{sigfridsson,worman,geer,cicero,coleridge,cotton}
\begin{document}
This scientist's last name begins with an accented letter: \cite{Cakir2011}.

\printbibheading
\bibbycategory
\end{document}

Bibliography with Çakır listed under C.


For the fun of it, here is a solution that works with the Unicode (LuaLaTeX and XeLaTeX) engines and lets you remap accented chars.

You would say

\remapaccentedchar{Ç}{C}

to map Ç into the C category.

\documentclass{report}
\usepackage[english]{babel}

\usepackage[backend=biber,
  style=authoryear,
  giveninits=true, maxbibnames=10,
  date=year,
  isbn=false, doi=false, url=false
]{biblatex}


\makeatletter
\def\ifskipbib{\iftoggle{blx@skipbib}}
\makeatother

\def\initlist{}
\forcsvlist{\listadd\initlist}{A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z}
\forlistloop{\DeclareBibliographyCategory}{\initlist}
\renewcommand*{\do}[1]{\defbibheading{#1}{\section*{#1}}}
\dolistloop{\initlist}

\makeatletter
\newcommand*{\remapaccentedchar}[2]{%
  \csdef{remap@initial@#1}{#2}}

\AtDataInput{%
  \ifskipbib
    {}
    {\ifcsundef{remap@initial@\thefield{sortinit}}
       {\edef\my@init{\thefield{sortinit}}}
       {\letcs\my@init{remap@initial@\thefield{sortinit}}}
      \addtocategory{\my@init}{\thefield{entrykey}}}}
\makeatother

\remapaccentedchar{Ç}{C}


\begin{filecontents}{\jobname.bib}
@article{Cakir2011,
  author    = {Esra Çakır and E. Allen Foegeding},
  journal   = {Food Hydrocolloids},
  title     = {Combining protein micro-phase separation and
               protein--polysaccharide segregative phase separation
               to produce gel structures},
  year      = {2011},
  number    = {6},
  pages     = {1538-1546},
  volume    = {25},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\addbibresource{biblatex-examples.bib}

\nocite{sigfridsson,worman,geer,cicero,coleridge,cotton}
\begin{document}
This scientist's last name begins with an accented letter: \cite{Cakir2011}.

\printbibheading
\bibbycategory
\end{document}
| improve this answer | |
2

Here's a pragmatic solution. First, define the following, initially quaint-looking, macro:

\newcommand\noopsort[1]{}

Second, change the author field from

    author    = {Esra {\c{C}}ak{\i}r and E. Allen Foegeding},

to

    author    = {Esra \noopsort{Cakir}{\c{C}}ak{\i}r and E. Allen Foegeding},

Third, run a full recompile cycle: latex-biber-latex.

The point of the \noopsort macro is hopefully clear: While LaTeX will typeset the surname as Çakır (since it will discard the argument of \noopsort), biber will "see" and process the surname as CakirÇakır -- and thus correctly sort it under C.

By the way, the \noopsort trick has a decades-long history with BibTeX. Nice to see that it continues to work with biblatex/biber. :-)

| improve this answer | |

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.