8

I am using the style=ieee in biblatex; however, when it comes to multiple cites, I would like to emulate the style=numeric of biblatex. Consider the MWE:

% rebuild command - bash:
% (shopt -s extglob; rm test.!(tex)) && pdflatex test.tex && biber test && pdflatex test.tex && pdflatex test.tex

\documentclass{book}

\usepackage[colorlinks=true,citecolor=blue]{hyperref}
\usepackage[%
  style=ieee,
%   style=numeric,
  isbn=true,
  doi=false,
  sorting=none,
  url=true,
  defernumbers=true,
  bibencoding=utf8,
  backend=biber
]{biblatex}

\addbibresource{biblatex-examples.bib}
% https://tex.stackexchange.com/questions/74296/to-have-no-pagebreak-before-bibliography
\defbibheading{secbib}[\bibname]{%
  \section*{#1}%
  \markboth{#1}{#1}}

\begin{document}

\noindent
Style is: \makeatletter \texttt{\blx@bbxfile} \makeatother

Testing single \verb!\cite!: \cite{aristotle:poetics}, \cite{augustine}, \cite{aksin}, \cite{angenendt};

Testing multiple \verb!\cite!: \cite{augustine, angenendt, aristotle:poetics, aksin}

Testing \verb!\cites!: \cites{aksin}{augustine}{aristotle:poetics}

\printbibliography[heading=secbib]

\end{document}

The results for ieee vs numeric styles are like this:

test-out.png

As it is visible, in ieee, the output of multiple cites in a single command like \cite{citA,citB...} is compacted to [1]-[2], while the biblatex \cites{citA}{citB}... outputs full citations with square brackets with commas in-between: [1], [2], ....

In contrast, for either of those commands, the numeric style opens a single pair of square brackets, and has the citation indexes inside, separated with a comma [1, 2, ...] (and the ordering of citations kept, related Biblatex, numeric style, multicite: Order of references) - which is what I want to achieve with the ieee style.

What would be a way to achieve this? I wouldn't mind using a custom citation command for this ( I just don't know really where to start ), so I could keep keep the default behavior of \cite and \cites in ieee as-is - but ultimately, any suggestion for a fix is welcome :)

  • 2
    Why are you using the ieee style then? If you need it only for the bibliography and not for the citations, you can use citestyle=numeric, bibstyle=ieee – karlkoeller Feb 6 '15 at 9:31
  • @karlkoeller - I guess it's psychological; I simply trust the Institute :) – sdaau Feb 6 '15 at 13:23
9

With biblatex it is possible to combine different "style" of bibliography, in particular, you can combine the ieee style to control how the bibliography is printed, and numeric-comp to control the output of cite commands:

What you need is:

\usepackage[%
  bibstyle=ieee,
  citestyle=numeric,
  isbn=true,
  doi=false,
  sorting=none,
  url=true,
  defernumbers=true,
  bibencoding=utf8,
  backend=biber
]{biblatex} 

which produces the following output (with the provided MWE)

enter image description here

  • Many thanks for that, @Guido - had no idea about this facility in biblatex; cheers! – sdaau Feb 6 '15 at 13:24
  • 1
    Thanks for converting my comment into an answer. You've already started the "Answer the unanswered" day ;-) – karlkoeller Feb 6 '15 at 13:33
  • 1
    @karlkoeller well, we did more or less concurrently. I didn't see your comment when I posted the answer ;-) – Guido Feb 6 '15 at 22:47
1

I was kinda curious to see how could I go about if I wanted to keep all cite commands in ieee as they are, and simply have a new cite command that would behave as numeric \cite in this environment; so I'll post the example here. It's a bit of a hack, but a new command \nmcite is introduced, which exhibits this behavior:

test.png

... and the code (with relevant comments), here:

% rebuild command - bash:
% (shopt -s extglob; rm test.!(tex)) && pdflatex test.tex && biber test && pdflatex test.tex && pdflatex test.tex

\documentclass{book}

\usepackage[colorlinks=true,citecolor=blue]{hyperref}

% \usepackage{trace}

\usepackage[%
  style=ieee,
%   style=numeric,
  isbn=true,
  doi=false,
  %sorting=none, % ieee.cbx does sorting=none
  url=true,
  defernumbers=true,
  bibencoding=utf8,
  backend=biber
]{biblatex}


\addbibresource{biblatex-examples.bib}
% http://tex.stackexchange.com/questions/74296/to-have-no-pagebreak-before-bibliography
\defbibheading{secbib}[\bibname]{%
  \section*{#1}%
  \markboth{#1}{#1}}

% defernumbers=true: "... numeric labels (i. e., the labelnumber field discussed in § 4.2.4) are assigned the first time an entry is printed in any bibliography. ... requires two LaTeX runs ..."
%
% ieee.cbx: \RequireCitationStyle{numeric-comp}
% numeric-comp; "A compact variant of the numeric style which prints a list of more than two consecutive numbers as a range. This style is similar to the cite package and the sort&compress option of the natbib package in numerical mode. For example, instead of “[8, 3, 1, 7, 2]” this style would print “[1–3, 7, 8]”."
% numeric-comp.cbx: \ExecuteBibliographyOptions{labelnumber,sortcites,autocite=inline}
% numeric.cbx: \ExecuteBibliographyOptions{labelnumber,autocite=inline}
%
% \DeclareBibliographyOption{sortcites}[true]{%
%     {\let\blx@thecitesort\blx@citesort % \blx@citenosort
%
% > \blx@thecitesort=macro: ->\ifnum \blx@tempcnta >\@ne \blx@filtercitesort %% which loops through list: \ifinlistcs {##1}{#2} {\listadd #1{##1}\advance ...
%
% \protected\def\blx@citeloop#1{% uses \blx@thecitesort !
%
% so: {\makeatletter \let\blx@thecitesort\blx@citenosort \makeatother \nmcite{} } works to suppress cite sorting; if \nmcite is just direct copy from numeric.cbx
% BUT - it can also be localised if \let..\blx@citenosort is right before the \mkbibbrackets option (it doesn't interfere then with rest of code; ieee \cite works as usual = probably that runs inside local scope grouping)
%
% these are otherwise just renamed copies from biblatex/cbx/numeric.cbx:

\newbibmacro*{nmcite}{%
  \printtext[bibhyperref]{%
    \printfield{prefixnumber}%
    \printfield{labelnumber}%
    \ifbool{bbx:subentry}
      {\printfield{entrysetcount}}
      {}}}
\makeatletter
\DeclareCiteCommand{\nmcite}[%
 \let\blx@thecitesort\blx@citenosort%
 \mkbibbrackets]
  {\usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
   \usebibmacro{nmcite}}
  {\multicitedelim}
  {\usebibmacro{postnote}}
\makeatother

\begin{document}

\noindent
Style is: \makeatletter \texttt{\blx@bbxfile};
% \show\blx@filtercitesort
\makeatother

Testing single \verb!\cite!: \cite{aristotle:poetics}, \cite{augustine}, \cite{aksin}, \cite{angenendt};

Testing multiple \verb!\cite!: \cite{augustine, angenendt, aristotle:poetics, aksin}

Testing \verb!\cites!: \cites{aksin}{augustine}{aristotle:poetics}

% \traceon
% {
% \makeatletter
% \let\blx@thecitesort\blx@citenosort \makeatother
Testing \verb!\nmcite!: \nmcite{augustine, angenendt, aristotle:poetics, aksin}
% }
% \traceoff

Testing \verb!\nmcite!: \nmcite{angenendt, aristotle:poetics, aksin}

Testing multiple \verb!\cite!: \cite{angenendt, aristotle:poetics, aksin}

Testing multiple \verb!\cite!: \cite{augustine, angenendt, aristotle:poetics, aksin}

\printbibliography[heading=secbib]

\end{document}

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.