4

I would like to cite ibid when the same citation is used in succession.

So, instead of it reading Apple is this [1]. This is a pear [1]. It would be Apple is this [1]. This is a pear [ibid]. However, I have not found how to do this with the numeric style. Using authoryear also just printed the whole reference. How can I get the numeric citations with ibid?

My code:

\documentclass[a4paper,oneside, 11pt, openany]{memoir}
\usepackage[english]{babel}
\usepackage[T1]{fontenc} 
\usepackage{txfonts}
\usepackage[utf8]{inputenc}
\usepackage{wallpaper}
\usepackage{palatino}
\setlength{\parindent}{2.5em}
\usepackage[backend=biber, style= numeric-comp, ibidpage=true]{biblatex}
\addbibresource{biblio.bib}
\usepackage{rotating}
\usepackage[inner=2.5cm,outer=2.5cm,  tmargin=2.5cm, bmargin=2.5cm]{geometry}
\setcounter{secnumdepth}{2}
\usepackage{titlesec}
\usepackage{color}
\titleformat{\chapter}[display]

Example text: Coding capacity is considered to surpass that of the human genome \cite{Vipperla2012}. The specific taxa associated with a given species have the power to influence the host’s health \cite{Vipperla2012}.

  • This is not really related to the memoir class as all your citations come from biblatex. BTW: you are much more likely to get help if you take the time to provide a fully compilable minimal example. In this case I'll have to provide a lot of extra time to test your example. – daleif Sep 6 '16 at 13:29
  • That is a very unusual choice. Do you insist on taking numeric-comp as base or would you be OK with numeric as well? – moewe Sep 6 '16 at 13:57
  • numericwould be fine as well – user4476006 Sep 6 '16 at 13:58
  • OK, I think I can make something work with numeric-comp, but it may have rough edges. – moewe Sep 6 '16 at 14:01
  • Note that for future reference what you have shown us there still is not an MWE. If you need an example, I consider the full code at the end of my answer fairly MWE-y. – moewe Sep 6 '16 at 14:12
3

The standard numeric styles don't come with an -ibid version, so we will have to build our own. Note that the reason why those styles don't exist is that they are highly unusual, with numeric citations repeating the citation usually is shorter than "ibid." (which I believe only serves the purpose of not cluttering the text by repeating long citation labels over and over again).

Anyhow for the numeric-comp style, we just insert an ibid-test into cite:comp and define the necessary macros

\makeatletter
\renewbibmacro*{cite:comp}{%
  \addtocounter{cbx@tempcntb}{1}%
  \iffieldundef{shorthand}
    {\ifthenelse{\ifciteibid\AND\NOT\iffirstonpage}
       {\usebibmacro{cite:ibid}}
       {\ifbool{bbx:subentry}
          {\iffieldundef{entrysetcount}
             {\usebibmacro{cite:comp:comp}}
             {\usebibmacro{cite:comp:inset}}}
          {\usebibmacro{cite:comp:comp}}}}
    {\usebibmacro{cite:comp:shand}}}

\providecommand*{\mkibid}[1]{#1}
\newbibmacro*{cite:ibid}{%
  \printtext[bibhyperref]{\bibstring[\mkibid]{ibidem}}}
\makeatother

In order for this to work you need to load biblatex with the ibidtracker=constrict option (the option ibidpage is not recognised by numeric-like styles and will throw an error).

Then the full MWE

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[british]{babel}
\usepackage{csquotes} 
\usepackage[style=numeric-comp, backend=biber, ibidtracker=constrict]{biblatex}

\addbibresource{biblatex-examples.bib}

\makeatletter
\renewbibmacro*{cite:comp}{%
  \addtocounter{cbx@tempcntb}{1}%
  \iffieldundef{shorthand}
    {\ifthenelse{\ifciteibid\AND\NOT\iffirstonpage}
       {\usebibmacro{cite:ibid}}
       {\ifbool{bbx:subentry}
          {\iffieldundef{entrysetcount}
             {\usebibmacro{cite:comp:comp}}
             {\usebibmacro{cite:comp:inset}}}
          {\usebibmacro{cite:comp:comp}}}}
    {\usebibmacro{cite:comp:shand}}}

\providecommand*{\mkibid}[1]{#1}
\newbibmacro*{cite:ibid}{%
  \printtext[bibhyperref]{\bibstring[\mkibid]{ibidem}}}
\makeatother


\begin{document}
  \cite{sigfridsson} and \cite{sigfridsson} and \cite{worman} and \cite{sigfridsson}

  \printbibliography
\end{document}

gives

[1] and [ibid.] and [2] and [1]

  • Where do I enter cite:comp ? – user4476006 Sep 6 '16 at 15:22
  • @user4476006 Sorry, I don't understand. Just copy the suggested first code block into your preamble (after you load biblatex) and you should be good to go (compare what I did in the full example at the end). – moewe Sep 6 '16 at 16:28
  • I see, thanks! I thought I had to put both code blocks. Its working now - much appreciated! – user4476006 Sep 6 '16 at 16:41
  • Is there a way to remove the dot from the ibid reference? So its not [ibid.] but [ibid] – user4476006 Sep 7 '16 at 9:24
  • @user4476006 The dot is of course to be expected, "ibid." is an abbreviation after all. If you write in English (or British/American/...) try \DefineBibliographyStrings{english}{ibidem = {ibid}}. – moewe Sep 7 '16 at 10:10

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.