3

I am working on my thesis, I am using all the packages in the MWE. I want to use hyperref so that I can have bookmarks. But unfortunately, I am always getting an Undefined control sequence error with \begin{document}. It works fine if I comment out hyperref package.

\documentclass{article}
\usepackage{threeparttable}
\usepackage{longtable}
\usepackage{amsmath}
\usepackage{acro}
\usepackage[final]{graphicx}
\usepackage{float,epsf,caption}
\usepackage{subcaption}
%\expandafter\def\csname ver@subfig.sty\endcsname{}
\usepackage{svg} 
\usepackage{csvsimple}
%\usepackage{hyperref}
\usepackage{psfrag}
\usepackage{matlab-prettifier}
\usepackage{svg} 
\usepackage{diagbox}
\usepackage{wrapfig}
\usepackage{longtable}
\usepackage{url}
\usepackage{rotating}
\usepackage{notoccite}
\usepackage{tabu}
\usepackage[acronym]{glossaries}
\usepackage{epstopdf}
\usepackage{amsmath}
\usepackage{algorithm}
\usepackage{float}
\usepackage[noend]{algpseudocode}

\title{BibTeX Website citatations with the \textsf{biblatex}~package}
\usepackage{tikz}
\usepackage[latin1]{inputenc}
\usepackage[section]{placeins}
\usepackage[colorlinks=true,linkcolor=blue,urlcolor=black,bookmarksopen=true]{hyperref}
\usepackage{bookmark}

\begin{document}
\tableofcontents
\section {hello}
The Maori Party Formed
The Maori Party was launched on the 7th of July 2004. It was formed around a former Labour Party Cabinet Minister, Tariana Turia, and as its name suggests, it is based on the indigenous Maori population. The foreshore and seabed controversy was one of the main reasons for setting up the party.
The Maori Party contested the 2005 general elections, and won four of the seven Maori seats and 2.12% of the party vote.

2007
Anti-smacking Bill Passed as Law
The Crimes (Substituted Section 59) Amendment Act 2007, commonly known as the anti-smacking Bill, was a highly controversial Bill introduced by Green Party MP Sue Bradford, which amended Section 59 of the Crimes Act. The Bill removed legal defence of 'reasonable force' for parents prosecuted of assaulting their children.
There was large-scale public opposition to the Bill. In opinion polls, there was overwhelming public opposition to the Bill. Despite this, the Bill was passed on the 16th of May 2007, with a large majority of 113 votes against 8.

 \section {migrant}
 This method employs user ratings and recommendations to select content. The system finds someone with interests similar to the end user and bases its recommendations on their activity. This method of selection is widely used on social sites such as Facebook and Flipboard.
Parameters for determining the social ranking are generally based on actions such as shares, vote, Likes, etc., keeping in mind the time that these activities are carried out once the content is published.The more there are such activities in a shorter time, the higher rating this content gets.
"Social curation"[1] services like Pinterest allow users to share and discuss their curated collections of found content.
\begin{figure}
    \centering
    \fbox{Report 1}
    \caption{Figure test}
    \label{fig:report1}
\end{figure}
As you can see in Fig.~\ref{fig:report1}...

\end{document}
5
  • 1
    You have several redundant package loading commands here (e.g. svg, longtable). You should clean that up first. Afterwards, comment out the packages one by one (put a % before usepackage{...} and see at what point the error disappears. Then re-enable the offending package, and try if you can make the error disappear by removing another of the remaining packages. If you have identified the two conflicting packages, construct an appropriate minimal example and report back. – Michael Palmer Dec 2 '16 at 20:11
  • 2
    The problem, AFAICT, is not with the hyperref package but with the fact that you're loading both the svg package (which automatically loads the subfig package) and the subcaption package. Use one package or the other, but not both. By the way, the preamble of your document is quite a mess. Several packages are loaded repeatedly, one of them being svg. Do try to simplify the code thicket... – Mico Dec 2 '16 at 20:11
  • @MichaelPalmer - Indeed, there's a conflict between svg and subcaption.... – Mico Dec 2 '16 at 20:12
  • 2
    in addition you almost certainly don't want to load epsf and if you are using pdflatex don't load psfrag or if you are not using pdflatex don't load epstopdf, no need to load longtable, float or amsmath twice – David Carlisle Dec 2 '16 at 20:29
  • If the problem is occurring at begin document, try deleting the aux file (which is read at that point). – John Kormylo Dec 3 '16 at 16:20
2

The immediate problem is not with the hyperref package but with the fact that you're loading both the svg package -- which automatically loads the subfig package -- and the subcaption package. The subfig and subcaption packages cannot be used together in one and the same document. Use one package or the other, but not both. Assuming there's a specific reason for loading the svg package, then, you shouldn't be loading subcaption.

By the way, the preamble of your document is quite a mess. Several packages -- e.g., svg, longtable, amsmath, and float -- are loaded twice. Nothing good can come of this. Furthermore, as David Carlisle has pointed out in a separate comment, you almost certainly shouldn't load the epsf package, especially as you're loading graphicx anyway. The psfrag and epstopdf packages probably shouldn't be loaded either. Do take some time to thin out this thicket of a preamble.

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.