# Getting errors when using the grammar environment before \chapter{} and \begin{description}

I hope you can help me.

I am using an empty grammar environment, included in the syntax package, within a file called appendix_c.tex, whose contents are as follows:

\chapter{Modified version of the grammar of VHDL}\label{short-vhdl-grammar}

\begin{grammar}
\end{grammar}


Then, in a file called acronyms.tex I inserted the following code:

\chapter{List of acronyms}

\begin{description}
\item[ASIC] Application-Specific Integrated Circuit

\item[CORBA] Common Object Request Broker Architecture

\item[DCS] Digital Communications System
\item[DSML] Domain-Specific Modeling Language
...
\end{description}


I was using acronym instead of description, but got the same problem. I get the following error every time I process the main file thesis.tex:

! LaTeX Error: Something's wrong--perhaps a missing \item.

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

l.11 \begin{description}


And the contents of thesis.tex are roughly like this:

\documentclass[letterpaper, 12pt]{report}

\usepackage{acronym}
\usepackage{amssymb}
\usepackage{captcont}
\usepackage{graphicx}
\usepackage[hang]{subfigure}
\usepackage{rotating}
\usepackage[T1]{fontenc}
\usepackage[nounderscore]{syntax}

\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{3}

% Top margin
\setlength{\voffset}{0pt}
\setlength{\topmargin}{0pt}
% Left side margin
\setlength{\hoffset}{0pt}
\setlength{\oddsidemargin}{0.25in}
% Text dimensions
\setlength{\textheight}{596pt}
\setlength{\textwidth}{6in}
% Page number space
\setlength{\footskip}{27.10125pt}
% Margin notes
\setlength{\marginparsep}{0pt}
\setlength{\marginparwidth}{0pt}

...

\begin{document}

\maketitle

\pagenumbering{roman}

\begin{abstract}
\end{abstract}

\renewcommand{\abstractname}{Resumen}

\begin{abstract}
\end{abstract}

\renewcommand{\abstractname}{Acknowledgments}

\begin{abstract}
\end{abstract}

\tableofcontents
\listoffigures
\listoftables

\newpage
\pagenumbering{arabic}

\include{./chapter_1/chapter_1}
\include{./chapter_2/chapter_2}
\include{./chapter_3/chapter_3}
\include{./chapter_4/chapter_4}
\include{./chapter_5/chapter_5}
\include{./chapter_6/chapter_6}
\include{./chapter_7/chapter_7}

\appendix

\include{./appendix_a/appendix_a}
\include{./appendix_b/appendix_b}
\include{./appendix_c/appendix_c}
\include{./acronyms/acronyms}

\bibliographystyle{abbrv}
\bibliography{bibliography}{}

\end{document}


The problem seems to be located in the transition from appendix_c.tex and acronyms.tex. Does anybody know what is going on? I cannot even start to type any grammar because of this problem. And I tried getting rid of the acronym environment but the issue is still present.

-
Did you try using it in the main document without any include with some dummy text? You can start reducing your example by stripping out the details and isolating the real cause. The problem looks like a syntax error somewhere. –  percusse Apr 5 '12 at 2:34
Welcome to TeX.SE. While code snippets are useful in explanations, it is always best to compose a fully compilable MWE that illustrates the problem including the \documentclass and the appropriate packages. Personally, I have often solved my own problems in the process of reducing the amount of code actually required to reproduce the problem. –  Peter Grill Apr 5 '12 at 2:41
I did attempt to reduce your code to a MWE but was not able to get it to a point where I could reproduce the problem. –  Peter Grill Apr 5 '12 at 2:42
I forgot to mention that when I remove the use of the grammar environment from appendix_c.tex everything works fine. –  balderas Apr 5 '12 at 2:44
Why have an empty grammar environment in the first place? –  Werner Apr 5 '12 at 3:35

Do not leave the grammar environment empty; it is built using a list, so leaving it without contents (in the presence of another list-like environment!) will trigger the error. This minimal example reproduces the error

\documentclass{article}
\usepackage{syntax}

\begin{document}

\begin{grammar}
\end{grammar}

\begin{description}
\item[a]
\end{description}

\end{document}


You can comment out the lines beginning and ending the environment:

%\begin{grammar}
%\end{grammar}


or, if for some reason you need the environment there without the actual contents, simply populate it with something it expects:

\documentclass{article}
\usepackage{syntax}

\begin{document}

\begin{grammar}
<statement> ::= <ident> ‘=’ <expr>
\end{grammar}

\begin{description}
\item[a]
\end{description}

\end{document}


you can also use something simpler such as

\begin{grammar}
\item a
\end{grammar}

-