# Hyperref package causing error: You can't use a prefix with \begingroup

1,258

As pointed out by egreg, \documentclass is missing a parameter. The line should be of the form:

\RequirePackage[l2tabu, orthodox]{nag}
\documentclass{article}
.....

Share:
1,258

Author by

### Asha Joshi

Updated on December 05, 2022

• Asha Joshi 22 days

I am getting the error

You can't use a prefix with \begingroup'. \begin{document}

when I include hyperref package.

Below are the package I am using:

\RequirePackage[l2tabu, orthodox]{nag}
\documentclass

\DeclareRobustCommand\mbseries{\fontseries{mb}\selectfont}
\DeclareTextFontCommand{\textmb}{\mbseries}

% chosse the German or English package
\usepackage{graphicx,pdflscape}
\usepackage{hyperref}
\usepackage{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[ngerman, english]{babel}
\usepackage{lmodern}
\usepackage{microtype}
\usepackage{amsfonts}
\usepackage{tikz-qtree}
\usepackage[backend=bibtex,style=numeric]{biblatex}
\usepackage{makecell}
\usepackage{bera}% optional: just to have a nice mono-spaced font
\usepackage{floatflt}
\usepackage{float}
\usepackage{listings}
\usepackage{xcolor}

\colorlet{punct}{red!60!black}
\definecolor{delim}{RGB}{20,105,176}
\colorlet{numb}{magenta!60!black}
\lstdefinelanguage{json}{
basicstyle=\tiny\ttfamily,
%numbers=left,
%numberstyle=\scriptsize,
keywordstyle=\bfseries,
morekeywords={begin, end, if, else, while, for, then, do},
stepnumber=1,
numbersep=8pt,
showstringspaces=false,
breaklines=true,
frame=trbl, % draw a frame at the top, right, left and bottom of the listing
frameround=tttt, % make the frame round at all four corners
%backgroundcolor=\color{background},
literate=
*{0}{{{\color{numb}0}}}{1}
{1}{{{\color{numb}1}}}{1}
{2}{{{\color{numb}2}}}{1}
{3}{{{\color{numb}3}}}{1}
{4}{{{\color{numb}4}}}{1}
{5}{{{\color{numb}5}}}{1}
{6}{{{\color{numb}6}}}{1}
{7}{{{\color{numb}7}}}{1}
{8}{{{\color{numb}8}}}{1}
{9}{{{\color{numb}9}}}{1}
{:}{{{\color{punct}{:}}}}{1}
{,}{{{\color{punct}{,}}}}{1}
{\{}{{{\color{delim}{\{}}}}{1}
{\}}{{{\color{delim}{\}}}}}{1}
{[}{{{\color{delim}{[}}}}{1}
{]}{{{\color{delim}{]}}}}{1}
}

\newcommand{\getmydate}{
\ifcase\month%
\or Januar\or Februar\or M\"arz%
\or April\or Mai\or Juni\or Juli%
\or August\or September\or Oktober%
\or November\or Dezember%
\fi\ \number\year%
}

\usepackage{todonotes}

\begin{document} % I get error in this line


It would be great help if anyone could suggest me why I have this error? I have searched in many forums but could not understand the problem.

• David Carlisle about 6 years
\documentclass \DeclareRobustCommand\mbseries{\fontseries{mb}\selectfont} produces an error ! Paragraph ended before \@[email protected] was complete. please fix your example!
If I add {article} after \documentclass, I get no error; on the other hand, hyperref should be loaded last.
@DavidCarlisle -- the error message in the question doesn't seem to be generated when the example is run unchanged; a different, but equally unhelpful message is what happened when i tried. but the purported removal of amsfonts` solving the problem is equally ridiculous. simply adding a real document class got rid of the errors, although i can't say for sure that the result is what was wanted.