1

I'm trying to make a general environment for delineating sections of math with indented bodies, (proofs, definitions, etc).

I found that using the 'adjustwidth' environment in the 'changepage' package was what I needed for the indentation.

To make the general environment I followed along to the answer from this link:

Is there a \renewtheorem equivalent of \renewcommand, using amsthm and not ntheorem?

The syntax I desire is the following:

\begin{env-name}{Header}{Counter}[Punctuation][Note][indentation-size] for numbered environments

\begin{env-name}{Header}[Punctuation][Note][indentation-size] for unnumbered environments

and would produce the following: (unnumbered)

{Header}[Punctuation] [Note] \n

[indent with indentation-size] body text...

I'm pretty new to latex2e (or whatever) language, but I checked the environment definition and couldn't see what could be wrong.

Below is my package file containing what I believe is minimum requirement to reproduce the error.

\RequirePackage{changepage}
\RequirePackage{amsthm}
\RequirePackage{amsmath}
\RequirePackage{amsfonts}
\RequirePackage{xargs}

%--------------------------------------------------------------------------
%                        Package Options/Commands
%--------------------------------------------------------------------------

% Blank commands used for a abstract math environment

\newcommand{\mathsecheader}{}
\newcommand{\mathsecpunc}{}

% reset blank commands

\newcommand{\reset}{%
\renewcommand{\mathsecheader}{}%
\renewcommand{\mathsecpunc}{}%
}

%--------------------------------------------------------------------------
%                                Main body
%--------------------------------------------------------------------------

\newtheoremstyle{augmented_remark}
{0.5\topsep}
{0.5\topsep}
{\normalfont}
{}
{\itshape}
{}
{}
{\thmname{#1}\thmnumber{ #2}\mathsecpunc\thmnote{ #3}\newline}

\theoremstyle{augmented_remark}
\newtheorem*{tremark_unnumbered}{\mathsecheader}

\newenvironmentx*{remark_unnumbered}[4][2={:},3={ },4={0pt},usedefault]%
{\ignorespaces%
\renewcommand{\mathsecheader}{#1}%
\renewcommand{\mathsecpunc}{#2}%
\begin{tremark_unnumbered}[#3]%
\begin{adjustwidth}{#4}{#4}%
}
{\end{adjustwidth}\end{tremark_unnumbered}\reset\ignorespacesafterend}

Below is the actual .tex file I'm using to compile the document.

% Testing document for proof formatting
\documentclass{article}

\usepackage{dummy_test}

\begin{document}

\begin{remark_unnumbered}{Claim}[.][Hello][2ex]
hello
\end{remark_unnumbered}

\end{document}

I'm not sure if this would be useful but I am using TeXMaker with MikTex to compile. Below are the two error printouts that I am receiving:

! Missing number, treated as zero.
<to be read again>
\relax
l.8 ...in{remark_unnumbered}{Claim}[.][Hello][2ex]
A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)

! Illegal unit of measure (pt inserted).
<to be read again>
\relax
l.8 ...in{remark_unnumbered}{Claim}[.][Hello][2ex]
Dimensions can be in units of em, ex, in, pt, pc,
cm, mm, dd, cc, nd, nc, bp, or sp; but yours is a new one!
I'll assume that you meant to say pt, for printer's points.
To recover gracefully from this error, it's best to
delete the erroneous units; e.g., type `2' to delete
two letters. (See Chapter 27 of The TeXbook.)

POST SOLUTION REMARK:

The marked solution fixed the errors and I found that in order to have the body text to be on the next line \hfill was added after \begin{tremark_unnumbered}[#3]. Thank you for your help.

VilePoison
  • 13
  • 3

1 Answers1

1

The last-but-one argument to \newtheoremstyle must be a length.

\newtheoremstyle{augmented_remark}
  {0.5\topsep}
  {0.5\topsep}
  {\normalfont}
  {}
  {\itshape}
  {}
  {0pt} %   <---------
  {\thmname{#1}\thmnumber{ #2}\mathsecpunc\thmnote{ #3}\newline}

However, I have several doubts about having three “optional” arguments that are actually mandatory. At least you should switch the first and second optional arguments.

By the way, \newline does nothing at all. And you can remove \ignorespaces and \ignorespacesafterend.

egreg
  • 1,121,712