I would like to have multiple bibliographies (reference lists) as described in Airminded · Multiple bibliographies in LaTeX (TeX Frequently Asked Questions — question label "multbib").
However, I'd like to use with a single .tex file, which would contain the bibliography database embedded, as in LaTeX/Bibliography Management: #1 Embedded system …
Now, I want to use letter
documentclass, for which the bibliography needs to be defined (Re: Environment thebibliography undefined when using letter)
So what I end up is with this example (code below, compiled with just pdflatex
, no bibtex
(which I'd like to avoid in this case)):
… obviously, something works (multibib
recognized primary and secondary cites, assigning them number "1" as start) — however I don't get two, separate primary and secondary list of references; would that be possible in this context? (doesn't have to be with multibib
, but I'd like to avoid a separate .bib
file and a bibtex
call)
EDIT: I'd also like separate cite keys (i.e. rendered as [a1]
and [b1]
; not yet sure if multibib
can do that; edit: no it cant, multibib.pdf says "You can also edit the .bbl files created by BibTEX and add 'a', 'b',. . . to the labels, but your changes will be overwritten by subsequent BibTEX runs." and recommends \cite[a]{key}
) – how possible would that be?
The code is this:
\documentclass{letter}
% Environment thebibliography undefined when using letter: http://www.latex-community.org/forum/viewtopic.php?f=4&t=3359
\makeatletter
\setlength \labelsep {.5em}
\newcommand\newblock{\hskip
.11em\@plus.33em\@minus.07em} \let\@openbib@code\@empty
\newcommand\refname{References}
\newcommand\section{\@startsection
{section}{1}{\z@}%
{-3.5ex \@plus -1ex \@minus -.2ex}%
{2.3ex \@plus.2ex}%
{\normalfont\Large\bfseries}}
\newenvironment{thebibliography}[1]
{\section*{\refname}%
\@mkboth{\MakeUppercase\refname}{\MakeUppercase\refname}%
\list{\@biblabel{\@arabic\c@enumiv}}%
{\settowidth\labelwidth{\@biblabel{#1}}%
\leftmargin\labelwidth \advance\leftmargin\labelsep \@openbib@code
\usecounter{enumiv}%
\let\p@enumiv\@empty \renewcommand\theenumiv{\@arabic\c@enumiv}}%
\sloppy \clubpenalty4000 \@clubpenalty \clubpenalty
\widowpenalty4000%
\sfcode`\.\@m} {\def\@noitemerr {\@latex@warning{Empty
`thebibliography' environment}}%
\endlist}
\makeatother
\usepackage{multibib}
\newcites{pri}{Primary sources}
\newcites{sec}{Secondary sources}
\begin{document}
\begin{letter}{Addressee}
Blah, blah - content...
Primary cite: \citepri{lamport94} ...
Secondary cite: \citesec{lamport94} ...
\begin{thebibliography}{9}
\bibitem{lamport94}
Leslie Lamport,
\emph{\LaTeX: A Document Preparation System}.
Addison Wesley, Massachusetts,
2nd Edition,
1994.
\bibitem{lamport95}
Leslie Lamport,
\emph{\LaTeX: A Document Preparation System}.
Addison Wesley, Massachusetts,
2nd Edition,
1995.
\end{thebibliography}
\end{letter}
\end{document}
Best Answer
Under your
keyword
filter approach withbiblatex
, superficial adjustments to thelabelnumber
field (such as adding the suffixa
orb
and resetting the secondary entry count) can be made by redefining thelabelnumber
format. Here's an example.This solution assumes that all entries are assigned one of the keywords
primary
orsecondary
, but entries without the latter keyword can be treated as primary by replacing the filterkeyword=primary
withnotkeyword=secondary
.The same problem but with prefixes to the
labelnumber
is relatively easy using theprefixnumbers
option.