4

Based on code from biblatex-apa, I have created a \fullcitebib command to enter complete references in the text. I can use multiple commands of this type to create lists of complete references without having to follow the ordering of citations in the document. This leads to a lot of white space between references, presumably because it is processing the references as items in separate lists. Is it possible to avoid having this space between consecutive \fullcitebib commands?

EDIT: Ah, I can avoid the vertical space issue with a different definition of \fullcitebib which doesn't use list items, which gets closer to what I want. There is still the problem that the references are indented (which I don't want) as well as having hanging indentation (which I do want). Any suggestions as to how to get the references against the left margin, without a manual \noindent? Sample code and output below.

\documentclass{article}
\usepackage[backend=biber,%
            style=authoryear,%
            ]{biblatex}

\begin{filecontents}{bib.bib}
@book{tras1996,
    Address = {London},
    Author = {R. L. Trask},
    Publisher = {Routledge},
    Title = {A dictionary of phonetics and phonology},
    Year = {1996}}
@book{crys2010,
    Address = {Cambridge},
    Author = {David Crystal},
    Edition = {3},
    Publisher = {Cambridge University Press},
    Title = {The {C}ambridge Encyclopaedia of Language},
    Year = {2010}}
@book{matt2005,
    Address = {Oxford},
    Author = {Matthews, P.H.},
    Publisher = {Oxford University Press},
    Title = {The Concise {O}xford Dictionary of Linguistics},
    Year = {2005}}
\end{filecontents}
\addbibresource{bib.bib} 

\DeclareCiteCommand{\fullcitebib}
  {}
  {\hangindent=3em\usedriver{}{\thefield{entrytype}}\finentry\par}
  {}
  {\usebibmacro{postnote}
   }

\begin{document}

\fullcitebib{tras1996}\fullcitebib{crys2010}\fullcitebib{matt2005}

The references above should have a hanging indent, as they do now, but be against
the left margin, like the references list below.

\printbibliography
\end{document}

enter image description here

7
  • Would you mind to mark in the image, which lines should be intended? Aug 25 '16 at 19:34
  • code and image modified Aug 25 '16 at 19:54
  • 2
    Would {\hskip-\parindent\hangindent=\parindent\usedriver{}{\thefield{entrytype}}\finentry\par} do the job? Aug 25 '16 at 20:01
  • The purpose of this command "I can use multiple commands of this type to create lists of complete references without having to follow the ordering of citations in the document." sounds a bit odd. What exactly do you use the command for? You can sort bibliographies and citations independently. I don't think it is a good idea to use \fullcitebib to get the entire bibliography with a different sorting.
    – moewe
    Aug 26 '16 at 9:26
  • I don't want to use \fullcitebib for an entire bibliography. I want to use it to include a small number of full references within a document (within a handout for a class, for example). Aug 26 '16 at 13:48
3

To answer your problem

To insert a small subset of references, you can simply use refsection and get a good formatting without any hacks.

\documentclass{article}
\usepackage[backend=biber, style=authoryear]{biblatex}

\begin{filecontents}{bib.bib}
@book{tras1996,
Address = {London},
Author = {R. L. Trask},
Publisher = {Routledge},
    Title = {A dictionary of phonetics and phonology},
Year = {1996}}
    @book{crys2010,
    Address = {Cambridge},
    Author = {David Crystal},
Edition = {3},
Publisher = {Cambridge University Press},
Title = {The {C}ambridge Encyclopaedia of Language},
Year = {2010}}
@book{matt2005,
Address = {Oxford},
Author = {Matthews, P.H.},
Publisher = {Oxford University Press},
Title = {The Concise {O}xford Dictionary of Linguistics},
Year = {2005}}
\end{filecontents}

\addbibresource{bib.bib} 

\begin{document}

\begin{refsection}
        \newrefcontext[sorting=none]
    \nocite{tras1996,crys2010}
    \printbibliography[heading=none]
\end{refsection}


\newrefcontext[sorting=nyt]
\nocite{tras1996,crys2010,matt2005}
The references above should have a hanging indent, as they do now, but be against
the left margin, like the references list below.

\printbibliography
\end{document}

enter image description here

To answer your question:

The first line of your custom reference gets indented, as it is the first line of a paragraph. This can be reverted by a liitle hack: \hskip-\parindent

\documentclass{article}
\usepackage[backend=biber,%
style=authoryear,%
]{biblatex}

\begin{filecontents}{bib.bib}
@book{tras1996,
Address = {London},
Author = {R. L. Trask},
Publisher = {Routledge},
Title = {A dictionary of phonetics and phonology},
Year = {1996}}
@book{crys2010,
Address = {Cambridge},
Author = {David Crystal},
Edition = {3},
Publisher = {Cambridge University Press},
Title = {The {C}ambridge Encyclopaedia of Language},
Year = {2010}}
@book{matt2005,
Address = {Oxford},
Author = {Matthews, P.H.},
Publisher = {Oxford University Press},
Title = {The Concise {O}xford Dictionary of Linguistics},
Year = {2005}}
\end{filecontents}
\addbibresource{bib.bib} 

\DeclareCiteCommand{\fullcitebib}
{}
{\hskip-\parindent\hangindent=\parindent\usedriver{}{\thefield{entrytype}}\finentry\par}
{}
{\usebibmacro{postnote}
}

\begin{document}

\fullcitebib{tras1996}\fullcitebib{crys2010}\fullcitebib{matt2005}

The references above should have a hanging indent, as they do now, but be against
the left margin, like the references list below.

\printbibliography
\end{document}

enter image description here

3
  • Thanks, for both parts. I can see that the refsection method is probably best. Is it possible to have a refsection where the entries are unsorted, where other citations are sorted with sortcites=true and sorting=ynt in the preamble? It seems I can change the sorting in the refsection with e.g. \newrefcontext[sorting=nyt] in the refsection, but what if I want them unsorted? Aug 30 '16 at 9:18
  • 1
    @GarethWalker Can you have a look at my edited code? Aug 30 '16 at 9:52
  • great - that seems to work perfectly. thanks. Aug 30 '16 at 10:01
3

I believe you should have stuck with the original definition based on biblatex-apa.

\DeclareCiteCommand{\fullcitebib}
  {\usebibmacro{prenote}%
   \renewcommand*{\finalnamedelim}{%
     \finalandcomma\addspace\bibstring{and}\space}
   \list{}
     {\setlength{\leftmargin}{\bibhang}%
      \setlength{\itemindent}{-\leftmargin}%
      \setlength{\itemsep}{\bibitemsep}%
      \setlength{\parsep}{\bibparsep}}%
   \item}
  {\usedriver
     {}
     {\thefield{entrytype}}\finentry}
  {\item}
  {\endlist
   \usebibmacro{postnote}}

Instead of

\fullcitebib{tras1996}\fullcitebib{crys2010}\fullcitebib{matt2005}

which starts a new list for every entry (as you rightly noted), you should have used

\fullcitebib{tras1996,crys2010,matt2005}

where all three entries are in the same list

MWE

\documentclass{article}
\usepackage[backend=biber,%
            style=authoryear,%
            ]{biblatex}

\addbibresource{biblatex-examples.bib}

\DeclareCiteCommand{\fullcitebib}
  {\usebibmacro{prenote}%
   \renewcommand*{\finalnamedelim}{%
     \finalandcomma\addspace\bibstring{and}\space}
   \list{}
     {\setlength{\leftmargin}{\bibhang}%
      \setlength{\itemindent}{-\leftmargin}%
      \setlength{\itemsep}{\bibitemsep}%
      \setlength{\parsep}{\bibparsep}}%
   \item}
  {\usedriver
     {}
     {\thefield{entrytype}}\finentry}
  {\item}
  {\endlist
   \usebibmacro{postnote}}

\begin{document}

\fullcitebib{sigfridsson}\fullcitebib{worman}\fullcitebib{cicero}

\fullcitebib{sigfridsson,worman,cicero}

\printbibliography
\end{document}

example output

2
  • As far as I can tell with this approach a\fullcitebib command containing multiple citations will order them in the same way as other kinds of citations in the document. Sometimes (but not always) I want them in a different order (e.g. instead of chronologically, in alphabetical order, order of importance, or whatever). Aug 26 '16 at 14:03
  • @GarethWalker That is only if you have the sortcites option enabled. As I said in my comment above, if you want to have the whole block of references again there are other and better ways to get a different sorting. (samcarter's answer shows some.)
    – moewe
    Aug 26 '16 at 16:29

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.