3

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{...}.

enter image description here

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

\addbibresource{references.bib}

\DeclareCiteCommand{\parencite}[\mkbibparens]
  {\renewcommand*{\postnotedelim}{\addcolon\space}%
   \usebibmacro{cite:init}%
   \usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
   \printtext[bibhyperref]{\usebibmacro{cite}}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

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



% for Quoting AuthorA (1999: 22), Part 1
\DeclareDelimFormat[textcite]{postnotedelim}{\addsemicolon\space}
\DeclareDelimFormat[parencite]{postnotedelim}{\addcolon\space}

\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}

\addcontentsline{toc}{chapter}{Bibliography}
\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[colorlinks=true, allcolors=darkblue]{hyperref}           % Adds hyperlinks in the pdf
% \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{}
\fancyhead[L]{\it\small\leftmark}
\fancyhead[R]{\small\thepage}

% Header formatting for chapter title pages
\fancypagestyle{plain}{%
  \fancyhf{}
  \fancyhead[R]{\small\thepage}
  \renewcommand{\headrulewidth}{0pt}
}

% 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}
}
3
  • 1
    Completely off-topic, but if the W in author={Gaver, William W}, is supposed to be an initial and not the full name, you should write author={Gaver, William W.}, instead.
    – moewe
    Sep 29, 2019 at 7:28
  • @moewe, thanks. you are brillant!. I actually get the Bibtex from google scholar. scholar.google.com/… and scholar.googleusercontent.com/…
    – aan
    Sep 29, 2019 at 7:34
  • 2
    I suggest to always double check the information you get from Google Scholar or any other source. I usually write my .bib entry by hand and don't use Google Scholar, so I can't say anything about the quality of the data provided there, but there is an extensive list of common problems of software-generated .bib files at tex.stackexchange.com/q/386053/35864
    – moewe
    Sep 29, 2019 at 7:40

1 Answer 1

3

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.

6
  • 1
    thanks. it works. Between, how to check \mknormrange version?
    – aan
    Sep 29, 2019 at 7:33
  • You can have a look at the .log files (press on the the "Logs and output files" button next to the "Recompile" button and click on "View raw logs"). They will report the version of all packages that you use. The current biblatex version is v3.13, the newest Overleaf can offer you is v3.12. But depending on when you started writing your project, you may get a much older version. \mknormrange was introduced in biblatex v3.11.
    – moewe
    Sep 29, 2019 at 7:38
  • if in my overleaf main page, I copy my previous project (created in year 2018). Will it be get the newest version?
    – aan
    Sep 29, 2019 at 7:42
  • 1
    @aan I don't know, the blog post I linked (overleaf.com/blog/tex-live-upgrade-september-2019) has a section called How can I switch to TeX Live 2018 for existing projects? and mentions cloning projects to get TeX live 2018, but I'm not sure how exactly that works. If you can't get things to work, you can contact Overleaf's support, from what I've read they are very eager to help (not sure how quickly the respond on a Sunday) and can usually resolve issues like this quickly.
    – moewe
    Sep 29, 2019 at 7:45
  • 1
    @aan See tex.stackexchange.com/q/469777/35864 for more instructions on finding out your package versions.
    – moewe
    Sep 29, 2019 at 7:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .