1

I am using the WinEdt QuickGuide.tex as a template and tried to put in my bibliography with the following in my preamble:

\usepackage[refsection=chapter,defernumbers=true,sorting=none,sortcites=true,autopunct=true,babel=hyphen,hyperref=true,abbreviate=false,backref=true,backend=biber]{biblatex}
\addbibresource{C:/Superstar/Desktop/HomeWork/References/chap1.bib}
 \defbibheading{bibempty}{}
 \newcommand*{\refname}{Bibliography}

then in the document I used:

\chapter*{Bibliography}
\addcontentsline{toc}{chapter}{Bibliography}
\section*{Books}
\addcontentsline{toc}{section}{Books}
\printbibliography[heading=bibempty,type=book,prefixnumbers={B}]
\section*{Articles}
\addcontentsline{toc}{section}{Articles}
\printbibliography[heading=bibempty,type=article,prefixnumbers={A}]
\section*{Online}
\addcontentsline{toc}{section}{Online}
\printbibliography[heading=bibempty,type=misc,prefixnumbers={O}]

but then I get the error \protect...ing=bibempty,type=book,...

Is it because I am using this command in the scrbook class instead of the book class? If so, how do I get around this issue in the scrbook class?

Here is a minimum example where the problem comes in:

\documentclass{scrbook}
\usepackage{biblatex}
\addbibresource{biblatex-examples.bib}

\usepackage{expl3,xparse}
\ExplSyntaxOn% syntax of expl3 on
%
\cs_new_eq:Nc \emph_old:n { emph~ } % Copying the old definition of `\emph`
\cs_new_eq:NN \emph_braces:n \textup % Braces should be typeset upright.
%
\cs_new:Npn \emph_new:n #1 {
  \tl_set:Nn \l_emph_tl {#1}
  \tl_replace_all:Nnn \l_emph_tl {(}{\emph_braces:n{(}}
  \tl_replace_all:Nnn \l_emph_tl {)}{\emph_braces:n{)}}
  \tl_replace_all:Nnn \l_emph_tl {[}{\emph_braces:n{[}}
  \tl_replace_all:Nnn \l_emph_tl {]}{\emph_braces:n{]}}
  \exp_args:NV \emph_old:n \l_emph_tl
}
%
% \emph umdefinieren, Sternvariante mit altem (=kursivem) Verhalten
\RenewDocumentCommand {\emph} {sm} {
  \IfBooleanTF {#1} {\emph_old:n {#2}} {\emph_new:n {#2}}
}
%
\ExplSyntaxOff% syntax of expl3 on


\begin{document}


\backmatter
\printbibheading[heading=bibintoc,title=\bibname]
\printbibliography[heading=subbibintoc,type=book,prefixnumbers={B},title={Books}]
\printbibliography[heading=subbibintoc,type=article,prefixnumbers={A},title={Articles}]
\printbibliography[heading=subbibintoc,type=online,prefixnumbers={O},title={Online}]

\end{document}

Here is the error that I get:

Package biblatex Warning: Setting 'defernumbers=true' recommended.


Package biblatex Warning: Option 'prefixnumbers' requires global
(biblatex)                'defernumbers=true' on input line 33.

! Missing \endcsname inserted.
<to be read again> 
                   \protect 
l.33 ...type=book,prefixnumbers={B},title={Books}]
lockstep
  • 250,273
Joe
  • 9,080
  • 2
    Don't use unnumbered sections, then add manually a toc entry and then use an empty bib-heading. use heading=subbibintoc as option to \printbibliography. – Johannes_B Jun 09 '15 at 15:45
  • Can you extend your question to a compilable example? If that is really a matter with scrbook i will drop i note to the maintainer. – Johannes_B Jun 09 '15 at 15:55
  • @Johannes_B, I have included a min example of where the problem lies. – Joe Jun 09 '15 at 17:00
  • Please show the complete error message. btw, there won't be any bibliography because nothing is cited. If i add \nocite{*} i don't see any problem. – Johannes_B Jun 09 '15 at 17:03
  • There is no indication, that this is related to scrbook. The first two are warning/recommendations, and in fact, option defernumbers is a very very good idea here. Is your version of biblatex up to date? – Johannes_B Jun 09 '15 at 19:28
  • @Johannes_B my biblatex is updated – Joe Jun 09 '15 at 19:46
  • LaTeX stops compiling at the command: \printbibliography[heading=subbibintoc,type=book,prefixnumbers={B},title={Books}] – Joe Jun 09 '15 at 19:51
  • You keep insisting that it doesn't work he? Good, i checked and it really doesn't. I want to apologize. The missing \nocite confused me, it is the L3 stuff that is making trouble. I'll take a look, but i have nearly no experience with L3. – Johannes_B Jun 09 '15 at 19:58
  • Where does the redefiniton of emph come from? – Johannes_B Jun 09 '15 at 20:00
  • See the update below – Johannes_B Jun 09 '15 at 20:20

1 Answers1

3

That bit of LaTeX3 code to set brackets and parenthesis upright inside emphasized parts heavily fights with the titlecase mechanism (maybe more) of biblatex.

One way to prevent this, is to locally switch back to the normal behaviour. That of course means, that parenthesis and brackets inside the bibliography or a cite will be italic. On the other hand, every command with an optional argument will fail within the new emph.

joeNewEmph

\documentclass{article}
\usepackage[defernumbers=true]{biblatex}
\addbibresource{biblatex-examples.bib}

\usepackage{expl3,xparse}
\usepackage{graphicx}
\ExplSyntaxOn% syntax of expl3 on

\cs_new_eq:Nc \emph_old:n { emph~ } % Copying the old definition of `\emph`
\cs_new_eq:NN \emph_braces:n \textup % Braces should be typeset upright.
\cs_new:Npn \emph_new:n #1 {
    \tl_set:Nn \l_emph_tl {#1}
    \tl_replace_all:Nnn \l_emph_tl {(}{\emph_braces:n{(}}
    \tl_replace_all:Nnn \l_emph_tl {)}{\emph_braces:n{)}}
    \tl_replace_all:Nnn \l_emph_tl {[}{\emph_braces:n{[}}
    \tl_replace_all:Nnn \l_emph_tl {]}{\emph_braces:n{]}}
    \exp_args:NV \emph_old:n \l_emph_tl
}
\RenewDocumentCommand {\emph} {sm} {
    \IfBooleanTF {#1} {\emph_old:n {#2}}
    {\emph_new:n {#2}}
}
          %
\AtEveryCitekey{\RenewDocumentCommand{\emph}{m}{%
    \emph_old:n {#1}}
}
\AtBeginBibliography{\RenewDocumentCommand{\emph}{m}{%
    \emph_old:n {#1}}
}
\ExplSyntaxOff% syntax of expl3 on


\begin{document}
\nocite{averroes/hercz}

\emph{(Vater und Sohn)}\par
\emph*{(Vater und Sohn)}
\printbibliography
\end{document}

joeBiblatexL3Emph

\documentclass{article}
\usepackage[defernumbers=true]{biblatex}
\addbibresource{biblatex-examples.bib}

\usepackage{expl3,xparse}
\ExplSyntaxOn% syntax of expl3 on

\cs_new_eq:Nc \emph_old:n { emph~ } % Copying the old definition of `\emph`
\cs_new_eq:NN \emph_braces:n \textup % Braces should be typeset upright.
\cs_new:Npn \emph_new:n #1 {
    \tl_set:Nn \l_emph_tl {#1}
    \tl_replace_all:Nnn \l_emph_tl {(}{\emph_braces:n{(}}
    \tl_replace_all:Nnn \l_emph_tl {)}{\emph_braces:n{)}}
    \tl_replace_all:Nnn \l_emph_tl {[}{\emph_braces:n{[}}
    \tl_replace_all:Nnn \l_emph_tl {]}{\emph_braces:n{]}}
    \exp_args:NV \emph_old:n \l_emph_tl
}
\RenewDocumentCommand {\emph} {sm} {
    \IfBooleanTF {#1} {\emph_old:n {#2}}
    {\emph_new:n {#2}}
}
          %
\AtEveryCitekey{\RenewDocumentCommand{\emph}{m}{%
    \emph_old:n {#1}}
}
\AtBeginBibliography{\RenewDocumentCommand{\emph}{m}{%
    \emph_old:n {#1}}
}
\ExplSyntaxOff% syntax of expl3 on


\begin{document}
\fullcite{companion}

\emph{[test]}

\printbibliography

\nocite{*}

\printbibheading[heading=bibintoc,title=\bibname]
\printbibliography[heading=subbibintoc,type=book,prefixnumbers={B},title={Books}]
\printbibliography[heading=subbibintoc,type=article,prefixnumbers={A},title={Articles}]
\printbibliography[heading=subbibintoc,type=online,prefixnumbers={O},title={Online}]


\emph{[test)}\par
\emph*{[test)}

\end{document}

Package biblatex provides a bunch of macros to save you trouble. It takes care of setting the right title and puts it in the table of contents if you want it to be there.

\documentclass{scrbook}
\usepackage{biblatex}
\addbibresource{biblatex-examples.bib}
\begin{document}
\nocite{*}
\tableofcontents
\printbibheading[heading=bibintoc,title=\bibname]
\printbibliography[heading=subbibintoc,type=book, title={books}]
\printbibliography[type=online, heading=subbibintoc, title={Online}]
\printbibliography[heading=subbibintoc,type=article,title={Articles}]
\end{document}
Johannes_B
  • 24,235
  • 10
  • 93
  • 248