# Strange error: Missing \begin{document}

Why does this:

\documentclass[a4paper]{report}
\usepackage{mathptmx}
\DeclareMathSymbol{\coprod@}{\mathop}{largesymbols}{"60}
\gdef\coprod{\DOTSB\coprod@\slimits@}
\let\DOTSB\relax
\let\slimits@\relax

\begin{document}
$\coprod$
\end{document}


generate:

This is pdfTeX, Version 3.1415926-2.5-1.40.14 (TeX Live 2013)
restricted \write18 enabled.
entering extended mode
(./coprod@mu.tex
LaTeX2e <2011/06/27>
Babel <3.9f> and hyphenation patterns for 78 languages loaded.
(/usr/local/texlive/2013/texmf-dist/tex/latex/base/report.cls
Document Class: report 2007/10/19 v1.4h Standard LaTeX document class
(/usr/local/texlive/2013/texmf-dist/tex/latex/base/size10.clo))
(/usr/local/texlive/2013/texmf-dist/tex/latex/psnfss/mathptmx.sty)

./coprod@mu.tex:3: LaTeX Error: Missing \begin{document}.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
...

l.3 ...ymbol{\coprod@}{\mathop}{largesymbols}{"60}


and what should I do to fix it?

Update: As the answers suggested, I'm missing \makeatletter and \makeatother. Adding them compiles to: I would like: How do I get that?

• Your edit is really an entirely different question! – Joseph Wright Oct 9 '14 at 7:26
• What should be the purpose of \let\DOTSB\relax and of \let\slimits@\relax? You're simply trying to break amsmath. Regarding the missing symbol: the fonts available with mathptmx don't have a coproduct symbol. It's available if you say \usepackage{newtxtext,newtxmath} instead of \usepackage{mathptmx}. – egreg Oct 9 '14 at 8:01
• I've already started reading the documentation and will probably make a package replacement. Does that package have \imath and \jmath as well, by chance? – MickG Oct 9 '14 at 10:43

Without a brace of \makeatletter/\makeatother, @ cannot be part of command names.
\makeatletter

I think you are missing \makeatletter before line 3 and \makeatother before \begin{document}. LaTeX tries to expand @-commands and so raise that error.