4

I have created a BibLaTeX library, which contains entries in a custom made BibTeX format of all my colleagues. With help of DeclareCiteCommand, I have defined several custom 'cite' commands, which I can use in a LaTeX text. This is very helpful because I just need to use my custom made cite commands to automatically obtain, e.g., the telephone number, address, name, affiliation etc. of a colleague without typing all this explicitly into the text.

So far, so good, all works pretty well!

However, I have one issue: whenever I have a text that is a mixture of text, references inserted via \cite and my own 'cite' commands, the numbering of the references gets out-of-order (e.g., in section References) by my own 'cite' commands. In fact, whenever I use one of my own 'cite' commands, the reference counter is increased by +1.

Question: how can I avoid that the counter is increased by 1?

Here is a MWE, with a following output in form of an image. As it can be clearly see, the references start at 1 and continue at 3, because there is the \citeColleague{Colleague_1} command between Ref1 and Ref2.

Thanks for some help!

\RequirePackage{filecontents}

% __________________________________________________________ The BibTeX library
\begin{filecontents*}{\jobname.bib}
@Article{Bib1,
  Title          = {{Self-inhibition of water dissociation on magnesium oxide surfaces}},
  Author         = {Abriou, D. and Jupille, J.},
  Journal        = {Surf. Sci.},
  Year           = {1999},
  Number         = {1-3},
  Pages          = {L527--L532},
  Volume         = {430},
}

@Article{Bib2,
  Title          = {{Aggregation Pathways and Suzuki phase formation in doped Alkali Halides}},
  Author         = {Aceituno, P. and Cuss\'{o}, F. and de Andr\'{e}s, A. and Jaque, F.},
  Journal        = {Solid State Commun.},
  Year           = {1984},
  Pages          = {209},
  Volume         = {49},
}

@Article{Bib3,
  Title          = {{Precipitation of KCI:PbCI$_{\rm 2}$ system: an X-ray study }},
  Author         = {Acharya, B. S.},
  Journal        = {J. Mater. Sci. Lett.},
  Year           = {1985},
  Pages          = {593},
  Volume         = {4},
}

@Colleague{Colleague_1,
  Colleague         = {Frau Musterfrau},
  Degree            = {Dr},
  Type              = {Collaboration},
  Titlework         = {},
  Titlethesis       = {},
  Position          = {Researcher},
  Employer          = {},
  Program           = {},
  Director          = {},
  Codirector        = {},
  Tutor             = {},
  Myrole            = {},
  Street            = {},
  Venueorigin       = {},
  Venueoriginshort  = {},
  Venue             = {A research center},
  Venueshort        = {Name of center},
  Cityorigin        = {},
  Countryorigin     = {},  
  City              = {Town},
  Zipcode           = {},
  Country           = {Europe},
  Date              = {},
  Defencedate       = {},
  Telephone         = {0562259345347946},
  Email             = {email@email.eu },
  Urlcolleague      = {https://www.blabla.eu},
  Note              = {},
  Timestamp         = {}
}
\end{filecontents*}



% ______________________________________________ The declaration of the entries.
\begin{filecontents}{colleague.dbx}
% Declarations used by all new BibLaTeX entry types
% Dates additional
\DeclareDatamodelFields[type=field, datatype=datepart]{
  defencedateyear,
  defencedatemonth,
  defencedateday,
}
% Dates
\DeclareDatamodelFields[type=field, datatype=date, skipout]{
  defencedate,
}
% Urls
\DeclareDatamodelFields[type=field,datatype=verbatim]{
  urlcolleague,
}
% Literal (text) fields
\DeclareDatamodelFields[type=field,datatype=literal]{
  city,
  cityorigin,
  colleague,
  country,
  countryorigin,
  codirector,
  datestart,
  degree,
  director,
  employer,
  email,
  league,
  lecturer,
  level,
  myrole,
  partners,    
  position,
  program, 
  state,  
  street,  
  telephone,
  titlethesis,
  titlework,
  tutor,
  type,
  venueorigin,
  venueoriginshort,
  venueshort,
  zipcode,
}
% Declarations for BibLaTeX entry type: colleague
\DeclareDatamodelEntrytypes{colleague}
\DeclareDatamodelEntryfields[colleague]{
  colleague,
  degree,
  type,
  titlework, 
  titlethesis,
  position,
  employer,
  program,
  director,
  codirector,
  tutor,
  myrole,
  venueorigin,
  venueoriginshort,
  street,
  venue,
  venueshort,
  cityorigin,
  countryorigin,
  city,
  country,
  zipcode,
  telephone,
  email,
  date,
  defencedate,
  urlcolleague,
  note,
  timestamp,
}
\end{filecontents}

% _____________________________________________________ The standard LaTeX head

\documentclass[english]{book}
\usepackage{babel}
\usepackage{ifmtarg}
\usepackage{xstring}
\usepackage{ifthen}
\usepackage[datamodel=colleague,      % The data model
            maxnames=99,              % Maximum number of authors
            dateabbrev=false,         % Do not abbreviate the date
            natbib=true,              % Natbin compatibility
            sorting=none,             % No sorting
            backend=biber]
           {biblatex}        
\addbibresource{\jobname.bib}

%
%              Here it is. What shal I do here that the counter is not
%              modified?
% ____________________________________________________________ The cite command
%
\DeclareCiteCommand{\citeColleague}
    {\boolfalse{citetracker}%
     \boolfalse{pagetracker}%
     \usebibmacro{prenote}}
    {%
     {%
     \printfield{colleague}%
     \space(\printfield{venueshort}%
             \newunit%
             \printfield{city}%
             \newunit%
             \printfield{country})%
     }%

    }%
    {\multicitedelim}
    {\usebibmacro{postnote}}

% Many, many other cite commands would follow here, but for simplicity,
% I leave them all out.


% __________________________ This is just for that all appears on only one page 

\usepackage{etoolbox}
\makeatletter
\patchcmd{\chapter}{\if@openright\cleardoublepage\else\clearpage\fi}{}{}{}
\makeatother


% ______________________________________________________________ BEGIN DOCUMENT

\begin{document}

\chapter{Introduction}

This is some text that cites first this reference here: \cite{Bib1}. Then, the 
text mentions this person: \citeColleague{Colleague_1}. After, the text cites
\cite{Bib2} and \cite{Bib3}.

\nopagebreak

\printbibliography[nottype=colleague,
                   nottype=project,
                   nottype=event,
                   nottype=researchstay,
                   nottype=contribution,
                   nottype=lecture,
                   title={Bibliography}]

\end{document}

enter image description here

5

You are essentially creating a split bibliography here. Split bibliographies in numeric styles almost always benefit from – or even require – the global defernumbers option. With

\usepackage[datamodel=colleague,      % The data model
            maxnames=99,              % Maximum number of authors
            dateabbrev=false,         % Do not abbreviate the date
            natbib=true,              % Natbib compatibility
            sorting=none,             % No sorting
            backend=biber,
            defernumbers]
           {biblatex}  

the numbering is as desired.

If you are never going to use the label numbers for the type @colleague and all the other new types you defined, you can turn them off with

\ExecuteBibliographyOptions[colleague, project, event, researchstay, contribution, lecture]{skiplab}

Indeed skiplab alone would be enough here, but situations with split bibliography often require defernumbers, so I still recommend defernumbers even if you use skiplab.


It would be not trivial to completely ignore certain \cites for sorting purposes with sorting=none, because the order is based on the citation requests that are written to the .bcf. There is no simple option that could be set when defining \citeColleague that would have this effect, lower level hacks would be required (and that hack could not just block writing the cite request to the .bcf, that is required for the citation to be processed at all. The request could possibly be delayed...).


You may want to make your \citeColleague a bit more biblatex-y with

\DeclareCiteCommand{\citeColleague}
  {\boolfalse{citetracker}%
   \boolfalse{pagetracker}%
   \usebibmacro{prenote}}
  {\printfield{colleague}%
   \setunit{\space}%
   \printtext[parens]{%
     \printfield{venueshort}%
     \newunit
     \printfield{city}%
     \newunit
     \printfield{country}}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

Avoid hard-coded/naked punctuation and spacing like ( and ) or \addspace without a \setunit in bibmacros and cite commands where possible.

  • Excellent, thanks a lot, works out of the box! Greetings. PS: I used 'defernumbers' – Krumpel Nov 9 '18 at 11:59

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.