Getting error "missing } inserted. end{thebibliography}" in LaTex

Viewed 78

I have no experience in using Latex. Using it to write my project. I am getting the error missing } inserted. end{thebibliography}. Below are the lines. It will be really helpful if anybody can tell what will be the correct format. Thanks in advance!

\begin{thebibliography}{8}
\newcommand{\enquote}[1]{``#1''}
\providecommand{\natexlab}[1]{#1}
\providecommand{\url}[1]{\texttt{#1}}
\providecommand{\urlprefix}{URL}

\bibitem[{.20(2016)}]{.2016b}
\enquote{{http://cs2016.statssa.gov.za/wp-content/uploads/2016/07/NT-30-06-2016-RELEASE-for-CS-2016-\_Statistical-releas\_1-July-2016.pdf}}
\newblock 2016.
\newline\urlprefix\url{\url{http://cs2016.statssa.gov.za}}

\bibitem[{.20(2020{\natexlab{a}})}]{.2020r}
\enquote{{https://www.statssa.gov.za/publications/P0318/P03182019.pdf}.}
\newblock 2020{\natexlab{a}}.
\newline\urlprefix\url{\url{https://www.statssa.gov.za/publications/P0318/P03182019.pdf}}

\bibitem[{.20(2020{\natexlab{b}})}]{.2020}
\enquote{{The Impact of COVID-19 on Food Security and Nutrition}} : 2--3.
\newline\urlprefix\url{\url{https://www.tralac.org/documents/resources/covid-19/3813-the-impact-of-covid-19-on-food-security-and-nutrition-un-policy-brief-june-2020/file.html}}

\bibitem[{Uni(2020)}]{UnitedNationsSustainableDevelopment.23072020}
\enquote{{Goal 2: Zero Hunger - United Nations Sustainable Development}.}
\newblock 23/07/2020.
\newline\urlprefix\url{\url{https://www.un.org/sustainabledevelopment/hunger/}}

\bibitem[{.30(2022)}]{.30052022b}
\enquote{{Impact of COVID-19 on people's livelihoods, their health and our food systems}}
\newblock 30/05/2022.
\newline\urlprefix\url{\url{https://www.who.int/news/item/13-10-2020-impact-of-covid-19-on-people's-livelihoods-their-health-and-our-food-systems}}

\bibitem[{.31(2022)}]{.31052022}
\enquote{{MoyaApp Questions}.}
\newblock 31/05/2022.
\newline\urlprefix\url{\url{https://moya.app/faqs/}}

\bibitem[{Hart et~al.(2022)Hart, Davids, Rule, Tirivanhu, and
  Mtyingizane}]{Hart.2022}
Hart, Tim~Gb, Davids, Yul~Derek, Rule, Stephen, Tirivanhu, Precious, and
  Mtyingizane, Samela.
\newblock \enquote{{The COVID-19 pandemic reveals an unprecedented rise in
  hunger: The South African Government was ill-prepared to meet the
  challenge}.}
\newblock \emph{{Scientific African}} 16: e01169.

\bibitem[{{van der Berg} et~al.(){van der Berg}, Patel, and
  Bridgman}]{vanderBerg.}
{van der Berg}, Servaas, Patel, Leila, and Bridgman, Grace.
\newblock
  \enquote{{Food-insecurity-in-South-Africa-Evidence-from-NIDS-CRAM-Wave-5}} :
  10--11.
\newline\urlprefix\url{\url{https://cramsurvey.org/wp-content/uploads/2021/07/13.-Van-der-Berg-S.-Patel-L-and-Bridgeman-G.-2021-Food-insecurity-in-South-Africa%E2%80%93-Evidence-from-NIDS-CRAM-Wave-5.pdf}}

\end{thebibliography}
1 Answers

Instead of \url{\url{...}} it should just be \url{...}.

That being said, you shouldn't use your redefinition for the \url macro. Better use the one provided by the hyperref or url package. URLs can contain tons of special characters which will likely break your redefinition at one point or another.

\documentclass[12pt]{article}

\usepackage{hyperref}

\begin{document}

\begin{thebibliography}{8}
\newcommand{\enquote}[1]{``#1''}
\providecommand{\natexlab}[1]{#1}
%\providecommand{\url}[1]{\texttt{#1}}
\providecommand{\urlprefix}{URL}

\bibitem[{.20(2016)}]{.2016b}
\enquote{{http://cs2016.statssa.gov.za/wp-content/uploads/2016/07/NT-30-06-2016-RELEASE-for-CS-2016-\_Statistical-releas\_1-July-2016.pdf}}
\newblock 2016.
\newline\urlprefix \url{http://cs2016.statssa.gov.za}
\end{thebibliography}

\end{document}
Related