I am using the Stata user written command frmttable to create journal-like tables and to write them to LaTex. When I use the command \input{... .tex} the table is displayed like I want it, but LaTex stops compilation afterwards. Also, right before the table it mentions []article in the final pdf document. My code looks as following:



I get the error 'Can be used only in the preamble ... \documentclass'. Is there a package I still need to install?

  • Welcome to TeX.SX! What is inside Table.tex? From the error message I suspect there is \documentclass statement in Table.tex which is wrong in this case
    – user31729
    Apr 17, 2015 at 9:42
  • Welcome to TeX.SX! You don't have to sign with your name since it automatically appears in the lower right corner of your post.
    – jub0bs
    Apr 17, 2015 at 9:48
  • This is the document statement in the Table.tex file: \documentclass[]{article}\pagestyle{empty}\begin{document}
    – Elisa
    Apr 17, 2015 at 9:49
  • @Elisa: You can't have those statements in the Table.tex file
    – user31729
    Apr 17, 2015 at 9:52
  • @Christian: Thanks for your suggestion! When I erase the document statement, the '[]article' indeed disappears and deleting the \begin{document} ... \end{document} solves for the problem of stopping the compilation.
    – Elisa
    Apr 17, 2015 at 9:55

1 Answer 1


Since I can't comment yet (and although I'm very late to the party), let me add one thing as an answer: Stata's frmttable knows the option fragment, which will strip the LaTeX output off the \begin{document} and the \begin{table} parts, having the code start with \begin{tabular} (or, before the latter, \begin{center} if you don't add the option nocenter as well). This way you won't have to eliminate the respective lines manually.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .