}[]\end{}`
* Create a new _algorithm-like_ box with the given contents.
∗ `` is the alternative caption for the `\cthlistofs` (see below).
* `` is the sffix for environment name, e.g., `algorithm`.
* `
` is the caption/title of the box. If the caption is left empty, this box will not be listed with the `\cthlistofs` (see below).
* `` options to be passed to the `tcolorbox` environment, which will override the defaults given in `\cthnewalgorithm` (this argument is optional).
* `` the contents to by typeset inside the colored environment.
* `\listofs`
* `` is the environment name suffix, e.g., `\cthlistofalgorithms`. Please
notice that there is a ‘s’ (plural) after ``.
## Example
Let’s start by creating two new environments, one for _algorithms_ and another for _examples_, both defaulting to a gray frame, the former with a yellowish background and the latter with a lighter gray background.
```latex
\cthnewtheorem{algorithm}{Algorithm}[coltitle=black, colback=yellow!10,
colframe=black!15]
\cthnewtheorem{example}{Example}[coltitle=black, colback=black!5,
colframe=black!30]
\cthnewtheorem{thought}{Though}[enhanced, coltitle=green!60!black,
colbacktitle=green!10, colback=green!10,
frame hidden, boxrule=0pt,
attach title to upper={\\[0.5ex]},
borderline west={1mm}{-2mm}{green!60!black}]
```
And this is a shiny thought!
The box with Algorithm 1, which uses the default visual that was given when creating the environment with `\cthnewtheorem` and gracefully overflows onto the next page, was created with:
```latex
\begin{cthalgorithm}{Advance a counter to the next value in a domain
$\omega \in \mathbb{N}$.}
Algorithm body here!
\end{cthalgorithm}
```
_(page break here)_
The box Example 1, which uses the default visual for the environment (as given to `\cthnewtheorem...`), was created with:
```latex
\begin{cthexample}{This is an example!}
Example body here!
\end{cthexample}
```
Now, let’s create a new box for Algorithm 1, but with a different customized visual, which will affect only this entry! Notice that the customization argument is passed straight to the `tcolorbox` environment, so anything valid for `tcolorbox` is also valid here. Algorithm 2 was created with the following code:
```latex
\begin{cthalgorithm}
{Advance a counter to the next value in a domain $\omega \in
\mathbb{N}$, but now with a customized visual. Also, notice
that this algorithm breaks the page boundaries.}
[coltitle=white, colback=green!10, colframe=green!70!black,
colbacktitle=\sffamily\bfseries\large, fonttitle=red!50!white]
Algorithm body here!
\end{cthalgorithm}
```
_(page break here)_
And now and example with no caption and a different visual... this example will not go into the` \listofexamples` below!
```latex
\begin{cthexample}{}[coltitle=black, colback=magenta!10, colframe=magenta!20]
Example body here!
\end{cthexample}
```
And yet another unnumbered example, this one using the alternative (`star`) syntax. This example will not go into the `\listofexamples` below as well!
```latex
\begin{cthexample*}{This is an unnumbered example with a title}[coltitle=black, colback=yellow!10, colframe=yellow!20]
Example body here!
\end{cthexample*}
```
Now let’s print the lists of algorithms and examples. Remember to add the prefix `cthth` to the `listof`, i.e., `\cthlistofalgorithms` and `\cthlistofexamples`!
## List of Algorithms
## List of Examples