1

I really need help if possible. I am struggling with an error I do not how to fix. After tracking it, it points to the langsci-unified style I am using since with other bibliography styles (for instance, apa), the document prints fine. The error is always related to something like IsDOIGray like this one : ! Undefined control sequence. \blx@theformat #1->{\color {lsDOIGray}DOI\addcolon \space \ifhyperref {\href... l.17 or ! Package xcolor Error: Undefined color `lsDOIGray'.

Please help me to fix it if possible. I am compiling with Xelatex.

\documentclass{article}
\usepackage{fontspec}
\setmainfont{Times New Roman}
\usepackage[style=langsci-unified, natbib]{biblatex}
\makeatletter

\addbibresource{bibliography.bib}

\begin{document}

\citet{Thompson1996}

\printbibliography


\end{document}

2 Answers 2

1

Apparently langsci-unified, which is distributed on CTAN as part of the langsci bundle, is assumed to be used together with the langscibook document class.

If you use the style with a different class, you need to make sure you load xcolor and supply a suitable colour definition for lsDOIGray. The definition in the following is taken from langscibook.cls

\documentclass{article}

\usepackage[style=langsci-unified, natbib]{biblatex}

\usepackage{xcolor}
\definecolor{lsDOIGray}{cmyk}{0,0,0,0.45}

\addbibresource{biblatex-examples.bib}

\begin{document}
\citet{sigfridsson}

\printbibliography
\end{document}

Sigfridsson, Emma & Ulf Ryde. 1998. Comparison of methods for deriving atomic charges from the electrostatic potential and moments. Journal of Computational Chemistry 19(4). 377–395. DOI: 10.1002/(SICI)1096-987X(199803)19:4<377::AID-JCC1>3.0.CO;2-P.

It is pretty unusual for a bibliography style to tacitly assume you are using a specific class, so you may want to contact the style developer about this at https://github.com/langsci/langscibook/issues.

1
  • Thanks a lot. It works now. I think that is what I should do. May 20 at 18:54
0

I may have a workaround. The Trick may be, to not use the langsci-class, but your usual document class (e.g. scrartcl) and to paste a whole lot of code into the preamble, in order to define the langsci-style right in the document. For instance, I could not even implement style=langsci-unified, it was treated as if there was no such style.

Stefan Müller proposes to simply paste the following code into the preamble and it works fine for me (source: https://hpsg.hu-berlin.de/~stefan/Lehre/unified-biblatex.sty):

\usepackage[
    natbib=true,
    style=langsci-unified,
    citestyle=langsci-unified,
    datamodel=langsci,   % add authauthor and autheditor as possible fields to
                                % bibtex entries
    useprefix = true, %sort von, van, de where they should appear
    %refsection=chapter,
    maxbibnames=99,
    mincrossrefs=99,
    maxcitenames=2,
        uniquename=false,
    isbn=false,
    doi=true,
    url=true,
    eprint=false,
        useprefix=true,
    backend=biber,
    indexing=cite,
        autolang=hyphen,
%        sorting=ydnt,
]{biblatex}

\usepackage{xcolor}
\definecolor{lsDOIGray}{cmyk}{0,0,0,0.45}


% if no langid is set, it is English:
% https://tex.stackexchange.com/a/279302
\DeclareSourcemap{
  \maps[datatype=bibtex]{
    \map{
      \step[fieldset=langid, fieldvalue={english}]
    }
  }
}

% If the user provided a shortauthor in the bibtex entry, we use the authentic author (as with the
% authorindex package) if it is defined, otherwise we use the author.
% This gets F/T as shorthand right and puts the guys in the index.

\renewbibmacro*{citeindex}{%
  \ifciteindex
    {\iffieldequalstr{labelnamesource}{shortauthor} % If biblatex uses shortauthor as the label of a bibitem
      {\ifnameundef{authauthor}                     % we check whether there is something in authauthor
        {\indexnames{author}}                       % if not, we use author
        {\indexnames{authauthor}}}                  % if yes, we use authauthor
      {\iffieldequalstr{labelnamesource}{author}    % if biblatex uses author we similarly test for
                                                    % authauthor and use this field
        {\ifnameundef{authauthor}% if defined use authauthor
          {\indexnames{author}}
          {\indexnames{authauthor}}} % if defined use this field
        {\iffieldequalstr{labelnamesource}{shorteditor} % same for editor
          {\ifnameundef{autheditor}
            {\indexnames{editor}}
            {\indexnames{autheditor}}}
          {\indexnames{labelname}}}}}               % as a fallback we index on whatever biblatex used.
    {}}


%\bibliography{bib-abbr,biblio}

%\usepackage{fixcitep}


% cite somebodys work
\let\citew=\citet


%\usepackage{biblatex-series-number-checks}

ATTENTION: If you use \addbibresource, you have to put it right after the line ]{biblatex} and before \usepackage{xcolor}.

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.