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


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

\RequirePackage[l2tabu, orthodox]{nag}

Related videos on Youtube

Asha Joshi
Author by

Asha Joshi

Updated on December 05, 2022


  • Asha Joshi
    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}
    % chosse the German or English package
    \usepackage[ngerman, english]{babel}
    \usepackage{bera}% optional: just to have a nice mono-spaced font
        morekeywords={begin, end, if, else, while, for, then, do},
        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
        \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%
    \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
      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!
    • egreg
      egreg about 6 years
      If I add {article} after \documentclass, I get no error; on the other hand, hyperref should be loaded last.
  • David Carlisle
    David Carlisle about 6 years
    while this is true it is unlikely to be related to the error message in the question.
  • barbara beeton
    barbara beeton almost 6 years
    @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.
  • David Carlisle
    David Carlisle almost 6 years
    no, that did not solve any problem in the posted document.