1

I am preparing a manuscript for a conference that offers a class file and a package of macros. In the style file, they have

\newtheorem{thm}{Theorem}[section]

and similar lines, and in the macro package, they have

\newcommand{\thmvspace}{.4pc plus .2pc minus .1pc}
\newenvironment{theorem}{\vspace{-\lastskip}\par\addvspace{\thmvspace}\begin{thm}}{\end{thm}\par\addvspace{\thmvspace}} 

Authors are supposed to use the environment theorem in their manuscript. I am guessing that the macro in the package adjusts spaces before and after theorems, but I don't know how it exactly works.

Now, because I have proofs in the appendix, I want to restate theorems there by using thmtools and thm-restate. I end up loading these after the class file does \newtheorem , which is itself a problem. Since the conference has authors prepare camera-ready PDF files and does not care about the LaTeX source, I need only produce something very close to what they intended. So I thought I could declare a theorem-type environment mythm of my own and define an environment like the one in the package provided by the conference. So my minimal (non-)working example is as follows:

\documentclass{article}

\usepackage{thmtools, thm-restate}

\declaretheorem{mythm}
\newcommand{\thmvspace}{.4pc plus .2pc minus .1pc}
\newenvironment{theorem-restatable}[2][]{\vspace{-\lastskip}\par\addvspace{\thmvspace}\begin{restatable}[#1]{mythm}{#2}}{\end{mythm}\par\addvspace{\thmvspace}}

\begin{document}
\begin{theorem-restatable}[Tarski]{tarski}
  Truth is undefinable.
\end{theorem-restatable}
\tarski*
\end{document}

But this produces the error:

File ended while scanning use of \thmt@collect@body.

This may be something related to fragile macros and lack of \protect, but I can't figure out what's wrong. How can I define an environment like the one defined in the macro package but with restatable?

1
  • 1
    I bet the conference is AiML isn't it? I hate that class file...
    – gigabytes
    Mar 24, 2018 at 6:25

1 Answer 1

2

There are two problems:

First in theorem-restatable, you write \begin{restatable}... but \end{mythm}, so these are mismatched.

The problem which actually causes the error is that the parsing of the environment body by restatable is incompatible with writing \begin{restatable} in the begin-code of an environment. Similarly to align, you have to use \restatable and \endrestatable instead of \begin{restatable} and \end{restatable}:

\documentclass{article}

\usepackage{thmtools, thm-restate}

\declaretheorem{mythm}
\newcommand{\thmvspace}{.4pc plus .2pc minus .1pc}
\newenvironment{theorem-restatable}[2][]{\vspace{-\lastskip}\par\addvspace{\thmvspace}\restatable[#1]{mythm}{#2}}{\endrestatable\par\addvspace{\thmvspace}}

\begin{document}
\begin{theorem-restatable}[Tarski]{tarski}
  Truth is undefinable.
\end{theorem-restatable}
\tarski*
\end{document}
1
  • I'm sorry for the first stupid error...
    – Pteromys
    Mar 24, 2018 at 17:19

You must log in to answer this question.

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