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?

6
  • Define a new (unnumbered) level, \section, for the letter class, via the titlesec package?
    – Bernard
    Mar 22, 2015 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, 2015 at 11:02
  • 3
    NOOOOOO, don't use titlesec!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    – Johannes_B
    Mar 22, 2015 at 11:03
  • @moewe Yours is the most obvious and simplest solution. Please make that an answer :-)
    – Johannes_B
    Mar 22, 2015 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, 2015 at 19:37

2 Answers 2

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]
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} 
12
  • Unfortunately, this is only an option if you are not having your own personalized .lco file that requires scrlttr2. Otherwise, switching classes is problematic
    – jpfeifer
    Mar 22, 2015 at 11:15
  • @SoundsOfSilence Still a valid solution, you should keep it. I waited with my upvote though ;-)
    – Johannes_B
    Mar 22, 2015 at 11:18
  • @jpfeifer updated
    – Johannes_B
    Mar 22, 2015 at 11:21
  • @Johannes_B: Nope... I am more and more unhappy with the KOMA classes and the scarce documentation
    – user31729
    Mar 22, 2015 at 11:22
  • @Johannes_B Your suggestion works in general, but personalised lco files are not 100% compatible between scrletter and scrlttr2. Thus, I prefer @moewe solution.
    – jpfeifer
    Mar 22, 2015 at 11:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .