8

I am trying to use biblatex together with the scrllttr2 class. The following MWE

\documentclass{scrlttr2}
\usepackage[english]{babel}
\usepackage{filecontents}
\usepackage[backend=biber]{biblatex}

\begin{filecontents}{\jobname.bib}
@article{A2012,
author = {Author, A},
title = {An interesting paper},
journal = {Journal},
year = {2012},
volume = {2},
pages = {70--76},
}

\end{filecontents}

\addbibresource{\jobname.bib}

\begin{document}

\begin{letter}{XXX
}


\opening{To whom it may concern,}

\cite{A2012}

\closing{Kind regards
}

\end{letter}

\printbibliography

\end{document} 

fails, because the \printbibliography command triggers the use of \section, which is not defined for letter classes. I can make the file work by using \printbibliography[heading=none], but this also kills the default heading. What is the best way to make the code run while still getting the default (language-specific) heading?

lockstep
  • 250,273
jpfeifer
  • 309
  • Define a new (unnumbered) level, \section, for the letter class, via the titlesec package? – Bernard Mar 22 '15 at 11:00
  • You could define a new bibliography heading \defbibheading{letterbib}[\refname]{#1} or \defbibheading{letterbib}[\bibname]{#1} (the difference being the title: in English it is either "Bibliography" or "References") and use that via \printbibliography[heading=letterbib]. Where you can replace the part in {#1} by any formatting scrlttr2 allows for. So you could go for \defbibheading{letterbib}[\refname]{\textbf{#1}}. – moewe Mar 22 '15 at 11:02
  • 3
    NOOOOOO, don't use titlesec!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! – Johannes_B Mar 22 '15 at 11:03
  • @moewe Yours is the most obvious and simplest solution. Please make that an answer :-) – Johannes_B Mar 22 '15 at 11:15
  • @Johannes_B why the titlesec comment? is that a generic comment against the use of titlesec or just in this case? care to elaborate? – ArTourter Mar 22 '15 at 19:37
  • @ArTourter titlesec is incompatible with KOMA and breaks several functionalities. When using, you get a huge warning in the log, but more and more users ignore warnings. – Johannes_B Mar 23 '15 at 07:19

2 Answers2

9

The trouble is that scrlttr2 does not provide a \section command (which biblatex uses by default for the bibliography heading).

We can define our own heading though via

\defbibheading{letterbib}[\refname]{#1}

We can change \refname for \bibname here - \refname prints "References" while \bibname prints "Bibliography". You can let your imagination run wild in the #1 part and use any formatting you like, for example \defbibheading{letterbib}[\refname]{\textbf{#1}}.

We then use this new heading in \printbibliography like so

\printbibliography[heading=letterbib]
moewe
  • 175,683
3

Use the classes and packages, that do the job. ;-)

You can also load personalised lco files using \LoadLetterOptions, you just cannot do it globally.

jpfeiferLcoScrletterBib

\begin{filecontents}{\jobname.lco}
    \setkomavar{fromname}{j pfeifer}
    \setkomavar{fromaddress}{duckburg}
\end{filecontents}
\documentclass{scrartcl}
\usepackage{scrletter}
\LoadLetterOptions{\jobname}
\usepackage[english]{babel}
\usepackage[backend=biber]{biblatex}

\begin{filecontents}{\jobname.bib}
@article{A2012,
author = {Author, A},
title = {An interesting paper},
journal = {Journal},
year = {2012},
volume = {2},
pages = {70--76},
}

\end{filecontents}

%\defbibheading{jpfeifer}{\large\bfseries\noindent MY BIB TITLE}
\addbibresource{\jobname.bib}
\begin{document}

\begin{letter}{XXX}

\opening{To whom it may concern,}
\cite{A2012}

\closing{Kind regards}

\printbibliography%[heading=jpfeifer]
\end{letter}
\end{document} 
Johannes_B
  • 24,235
  • 10
  • 93
  • 248