[Tex/LaTex] \input with undefined environments

includeinputstandalone

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

Best Answer

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.