0

I have defined an environment viz.Examples in the following way:

\newtheoremstyle{myexcstyle}{3ex}{3ex}{}{}{\scshape}{:}{.5em}{}
\theoremstyle{myexcstyle}
\newtheorem*{exmps}{Examples}
\newenvironment{Exmps}
{
    \begin{exmps}\
        \vspace{-1ex}
        \begin{enumerate}[label=\textbf{\arabic*}., itemsep=1.5ex]
        }
        {
        \end{enumerate}
    \end{exmps}
}

Now, at some point of my text, I started with a few examples after a defintion, then some theorems, and then I want to continue with the examples. In the second appearance of the Examples I want to make it look like "Examples (continued):". Precisely what am asking for is:

Definition:

Examples:

1.

2.

Theorem:

Examples (continued):

3.

4.

How do I achieve this?

Edit: An MWE:

\documentclass[openany]{book}
\usepackage{amsmath,amsfonts,amssymb,amsthm}
\usepackage{geometry}
\usepackage[inline]{enumitem}
\usepackage{mathtools}
\usepackage{thmtools}
\newtheoremstyle{myexcstyle}{3ex}{3ex}{}{}{\scshape}{:}{.5em}{}
\theoremstyle{myexcstyle}
\newtheorem*{exmps}{Examples}
\newenvironment{Exmps}
{
    \begin{exmps}\
        \vspace{-1ex}
        \begin{enumerate}[label=\textbf{\arabic*}., itemsep=1.5ex]
        }
        {
        \end{enumerate}
    \end{exmps}
}

\begin{document}
    \begin{Exmps}[continued]
        \item Example 3
    \end{Exmps}
\end{document}
4
  • 1
    Use the optional argument of the environment: \begin{exmps}[continued]....\end[exmps}.
    – Bernard
    Commented Feb 17, 2020 at 20:09
  • It worked with the exmps but not with Exmps. There I needed to write the entire definition of Exmps using exmps. Commented Feb 17, 2020 at 20:15
  • 1
    Please post a complete code that we can compile. You do not even say which package you load for theorems formatting.
    – Bernard
    Commented Feb 17, 2020 at 20:33
  • @Bernard Posted. Commented Feb 17, 2020 at 20:44

1 Answer 1

2

Here you are. I slightly modified your code: needless to load amsfonts when you load amssymb , and amsmath when you load mathtools. Other problem: \textbf shouldn't be used with label=, because any reference to an item of of the list will be bolded and this is usually unwanted. It is better to set it via the key font=\bfseries.

\documentclass[openany]{book}
\usepackage{amssymb,amsthm}
\usepackage{geometry}
\usepackage[inline]{enumitem}
\usepackage{mathtools}
\usepackage{thmtools}
\usepackage{xifthen}
\newtheoremstyle{myexcstyle}{3ex}{3ex}{}{}{\scshape}{:}{.5em}{}
\theoremstyle{myexcstyle}
\newtheorem*{exmps}{Examples}
\newenvironment{Exmps}[1][]
{%
        \ifthenelse{\isempty{#1}}
    {\begin{exmps}}{\begin{exmps}[#1]}
        \leavevmode\vspace{-1ex}
        \begin{enumerate}[label=\arabic*., font=\bfseries, itemsep=1.5ex]
        }
        {
        \end{enumerate}
    \end{exmps}
}

\begin{document}

    \begin{Exmps}[continued]
        \item
        Example 3
    \end{Exmps}

\end{document} 

enter image description here

4
  • Thanks a lot for your comments. Last year I just took to type a lecture note of my Professor to learn TeX without any prior knowledge of it. It is this site that has helped me throughout the entire journey. Coming to the question, your code is not working without the comment, i.e., although begin{Exmps}[continued]...\end{Exmps} is working, but \begin{Exmps}...\end{Exmps} is giving the error "Undefined control sequence. \item". How to handle this? Commented Feb 18, 2020 at 4:50
  • 1
    @SubhajitPaul/ I should have tested this case, sorry. I've added the package xifthen to check whether the optional arguments is given or not, with the\isempty command.
    – Bernard
    Commented Feb 18, 2020 at 7:48
  • Thanks. Worked like charm. I have another small query regarding this. Is there an easy way to resume the enumerate list in the [continue] section? Or does this query deserve a separate question? Commented Feb 18, 2020 at 8:58
  • Maybe you should add another (mandatory) argument to the environment, to define a series= key. This way you might have several groups of environments with independent numbering.
    – Bernard
    Commented Feb 18, 2020 at 9:07

You must log in to answer this question.

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