\input with undefined environments

I am trying to assemble my thesis with the standalone package. I am attempting to input my old LaTeX document, lna_achemso.tex, into thesis.tex.

The standalone package works well when both documents have the same class.

However, my thesis, which is

\documentclass[12pt]{report}


while the lna_achemso.tex is

\documentclass[
%journal=ancac3, % for ACS Nano
%journal=acbcct, % for ACS Chem. Biol.
journal=jpcbfk, % for undefined journal
manuscript=article]{achemso}


which gives the error

! LaTeX Error: Environment acknowledgement undefined.


I copied the files achemso.sty, achemso.cls, which contain the definitions for acknowledgement variable and wrote

\usepackage{achemso}


in the thesis' preamble but this does nothing.

How can I get the environment loaded?

This sounds so trivial but the solution eludes me.

-Dave

• Standalone creates a single page document. The pdfpages package would be a better approach. – John Kormylo Nov 14 '14 at 21:59
• I think you want the standalone class. There are numerous examples on this site. – Peter Grill Nov 15 '14 at 0:58

EDIT: The only way to load the environment is to replace report with achemso.

Command \usepackage includes only the package achemso.sty, not the class achemso.cls.

Unfortunatly there are some commands and environments defined in achemso.cls but not in achemso.sty nor in report.cls. Those commands and environments won't work in a document that does not include class achemso.cls like yours:

\documentclass{report}
\usepackage{achemso}


In order to work in class report you should "translate" your document: you should replace commands and environments defined only in achemso.cls with their counterparts defined in report.cls, or directly LaTeX commands. Most of them can be replaced, for example achemso environment acknowledgement can be replaced by a \thanks{my acknowledgement} nested in a \title{}, or you can set up your own acknowledgement environment. Here is a MWE with an environment definition:

\documentclass{report}

\title{Paper\thanks{Hello world}}
\author{Me}

\newenvironment{acknowledgement}%       New acknowledgement environment
{\large\bfseries Acknowledgement%
\par\medskip\normalfont\normalsize}%
{}%

\begin{document}

\maketitle

\begin{acknowledgement}
Hello world
\end{acknowledgement}

\noindent\begin{acknowledgement}
\noindent Hello world
\end{acknowledgement}

\end{document}


In order to "translate" the document you have basically to repeat this procedure for every command and environment uknown to report.cls. Now pdflatex becomes istantly your best friend: it is sufficient to remove all the errors produced in compiling process. That's debugging.

John Kormylo and Peter Grill,

I checked out TOC entries and labels for included PDF pages Unfortunately I cannot use pdfpages because it cannot create a list of tables and figures, which for a thesis of my length is not practical to do manually.

thank you RicoRally!

I solved this particular problem by replacing

\begin{acknowledgement}
thanks everyone...
\end{acknowledgement}


in the original file with a simple

\section*{Acknowledgement}


which produces nearly identical output and maintains compatibility, so this particular problem was solved with ease.

However, some things are more difficult to avoid.

I have packages that conflict with each other:

When I do not have amsmath, I get this error:

! LaTeX Error: Environment align undefined.


which is easily solved with \includepackage{amsmath}

However, this causes an additional error:

! LaTeX Error: Command \dfrac already defined.
Or name \end... illegal, see p.192 of the manual.


which is boggling because that phrase doesn't appear in any of the files in my directory.

Also, I can't find the manual they're talking about, all the manuals I've seen so far are < 192 pages, and all the web pages that Google find with this error message are not in English....

I have no idea how to fix this. :,(

EDIT: This was fixed by removing \align{}, which was not necessary for the equation to display.

Lesson learned: keep packages to a BARE MINIMUM. There are often conflicts which make debugging problem like this very difficult.

• I think you should use \subsection*{Acknowledgement}, which is what achemso uses. But, is very difficult to help you as you don't provide a test case. It really would be helpful if you composed a fully compilable MWE including \documentclass and the appropriate packages that sets up the problem. This does not mean that you should post the entire lna_achemso.tex, but a reasonable facsimile that contains just enough to reproduce the problem. – Peter Grill Nov 17 '14 at 17:05