I would like to use \newenvironment
in my style file. It compiles perfectly in the TeX file but does not work in the style file (aka package). I suspect it's similar to the inability of using \newcommand
in place of \renewcommand
in a style file.
Sorry this is my first time posting a question.
MWE
I would love to have the \newenvironment{problem}
along with \newcounter{problem}
in the style file named stylesheet.sty
.
\documentclass{article}
\usepackage{stylesheet}
\newcounter{problem}[section] % new counter for problems
\newenvironment{problem}{%
% new environment for problems
\refstepcounter{problem}\par\medskip
\textbf{(\arabic{section}\alph{problem})}%
}
\begin{document}
\section{Problem Title}
This is a dummy text for the first problem. % example text
\begin{problem}
This is a dummy text for the first part of problem 1 with a dummy equation.
\end{problem}
\end{document}
inability
of\newcommand
in place of\renewcommand
?.sty
are full of\newcommand
statements in many cases. And yes, a MWE would be useful. Is your environment existing at all, then you have to use\renewenvironment
, for example. (Or use theenviron
orxparse
packages and their alternatives to\renewenvironment
) – user31729 Dec 29 '17 at 23:41{}
after the{}
part of the environment. – user31729 Dec 29 '17 at 23:51.tex
file as well if there is\begin{document}
right after the missing{}
pair, i.e. without white space – user31729 Dec 29 '17 at 23:58