# [Tex/LaTex] Error: Undefined control sequence using \cite, \textcite, \parencite

biblatexciting

I tried the answer in How to cite a page number in-text in my work, but there is an error:

Undefined control sequence


The details:

The compiler is having trouble understanding a command you have used. Check that the command is spelled correctly. If the command is part of a package, make sure you have included the package in your preamble using \usepackage{...}.


My MWE:

02background.tex file:

this is cite \cite[150]{gaver1986auditory}\\
This book is done by \textcite[150]{gaver1986auditory}\\
ABC book is done \parencite[150]{gaver1986auditory}\\


main.tex file

\documentclass[12pt,oneside]{book}  % Remove draft option to show figures (for final draft), otherwise keep for faster production

\usepackage{uorthesis}  % Loads the LaTeX style package

\usepackage[backend=biber,
% style=authoryear,
style=authoryear-comp,
% citestyle=authoryear,
dashed=false,
maxcitenames=2,
maxbibnames=99,
giveninits,
uniquename=init]{biblatex}

% for the purpose to change "paper title" to 'paper title' in reference
\usepackage[style=british]{csquotes}
% \usepackage[style=english]{csquotes}
% for the purpose to change "paper title" to 'paper title' in reference

\DeclareCiteCommand{\parencite}[\mkbibparens]
\usebibmacro{cite:init}%
\usebibmacro{prenote}}
{\usebibmacro{citeindex}%
\printtext[bibhyperref]{\usebibmacro{cite}}}
{\multicitedelim}
{\usebibmacro{postnote}}

\DeclareCiteCommand{\cbx@textcite}
\usebibmacro{cite:init}}
{\usebibmacro{citeindex}%
\usebibmacro{textcite}}
{}
{\usebibmacro{textcite:postnote}}
% for Quoting AuthorA (1999: 22), Part 2

% for Quoting AuthorA (1999: 22), Part 1

\DeclareFieldFormat{postnote}{\mknormrange{#1}}
\DeclareFieldFormat{multipostnote}{\mknormrange{#1}}
% for Quoting AuthorA (1999: 22), Part 1

\usepackage[hypcap=false]{caption}

\begin{document}

\include{chapters/02-background}

\markboth{\MakeUppercase{Bibliography}}{}

\printbibliography

\end{document}


uorthesis.sty file:

% This defines everything necessary for a thesis
% Master's/PhD at UoR (or anywhere else).
%
% Do what you will with this package
%
\NeedsTeXFormat{LaTeX2e}[1994/06/01]
\ProvidesPackage{uorthesis}
[2018/01/18 v0.01 LaTeX package for UOR thesis]

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{microtype}
\usepackage[english]{babel}
\usepackage{graphicx}
\usepackage{enumitem}
\setlist{nosep} % Removes too much vertical spacing in lists
\usepackage{booktabs}           % makes tables look good
\usepackage{fancyhdr}           % For page number in the upper right (required) and other running headers(optional)
\usepackage{setspace}           % For double-spacing (required)
\usepackage{titlesec}           % For keeping chapter/chapter titles single-spaced
\usepackage{etoolbox}           % For the flag determining if front matter goes into the TOC
\usepackage{float}              % Helps float images to the top
\RequirePackage{xcolor}
% Define custom colors
\definecolor{darkblue}{rgb}{0, 0, 0.5}
% \usepackage{csquotes}           % Makes quotes look good %cancel off for the single quote in referencing the journal title
\usepackage[font=small,labelfont={bf,sf}, textfont={sf}, justification=centering]{caption}

% Header formatting for regular pages
\fancyhf{}

% Header formatting for chapter title pages
\fancypagestyle{plain}{%
\fancyhf{}
}

% Formatting of chapter and chapter titles: keep them single-spaced in the midst of double-spaced text

\endinput
%%
%% End of file uorthesis.sty'.


reference.bib file:

@article{gaver1986auditory,
title={Auditory icons: Using sound in computer interfaces},
author={Gaver, William W},
journal={Human-computer interaction},
volume={2},
number={2},
pages={167--177},
year={1986},
publisher={Taylor \& Francis}
}


If you look at the error message carefully you can see that the exact command LaTeX complains about is \mknormrange. (Usually the offending command is the last in the first line of the error message.)

This means you are using an older version of biblatex that doesn't support that command. Replace

\DeclareFieldFormat{postnote}{\mknormrange{#1}}
\DeclareFieldFormat{multipostnote}{\mknormrange{#1}}


with

\DeclareFieldFormat{postnote}{#1}
\DeclareFieldFormat{multipostnote}{#1}


Note that Overleaf have just updated their systems to TeX live 2018, where \mknormrange is supported. So if you start a new project now or clone your project into a new one, the code with \mknormrange` should work without error.