0

I was about to put together an MWE for testing pgfplotstable when pdflatex gave me the error:

! LaTeX Error: Environment table undefined.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              
                                                  
l.6 \begin{table}

I've already loaded all the packages I used in my main document, which displayed a table. I was not able to find the answer to this simple issue, which is probably due to some silly mistake I can not find.

The MWE:

\documentclass{minimal}
\usepackage{booktabs,pgfplotstable}
\begin{document}
\begin{table}
  \centering
  \begingroup\makeatletter\@makeother\_
    \pgfplotstabletypeset[
      % columns={index[0],index[1]} 
      col sep=comma,
      columns/Name/.style={string type},
      columns/misc/.style={string type},
      every head row/.style={
        before row={\toprule},
        after row={
          \midrule
        }
      },
      every last row/.style={after row=\bottomrule},
    ]{cermaic_chip_capacitors.csv}
  \endgroup
\end{table}
\end{document}
1
  • 1
    Isn't the error message clear? minimal class only defines the absolute minimum that does not generate an error on loading, so it doesn't define tables (or figures, or lists or set up fonts) – David Carlisle Feb 3 at 12:26
1

Isn't the error message clear?

minimal class only defines the absolute minimum that does not generate an error on loading, so it doesn't define tables or figures, or lists or set up fonts.

LaTeX does not define table or figure environments or commands like \section these are just defined (or not defined) by the document class in use.

1
  • No, not at all. It is very far from clear that the table environment is defined in article class and not in the packages. A LaTeX veteran might know all these subtleties, but LaTeX itself is so complex that very few see through every implementation of it. I am using LaTeX in the last three years, and even though I read many tutorials, docs, manuals, I still fall into that. I've search for the issue, but no answer was provided. That's why I've posted the question and answered it immediately, so that others falling into this trap will find the solution. – Horror Vacui Feb 3 at 17:47
0

I've used minimal documentclass. Now I recall that I've read a few times that minimal class should be shunned, though I can not provide the details of why this is the case.

Changing the documentclass to article has solved all the problems, and now the latex source works as intended.

Not the answer you're looking for? Browse other questions tagged or ask your own question.