diff options
author | Norbert Preining <norbert@preining.info> | 2024-04-06 03:01:38 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2024-04-06 03:01:38 +0000 |
commit | f575848b7516a7012346378e3d5fbf357ed14f0b (patch) | |
tree | 947cc59f3d7fc87795f0e60cbfeb7e99a6202839 /macros/latex/contrib/coloredtheorem | |
parent | 593142f36834bedc8b6afe512e52bca2ee042dad (diff) |
CTAN sync 202404060301
Diffstat (limited to 'macros/latex/contrib/coloredtheorem')
-rw-r--r-- | macros/latex/contrib/coloredtheorem/README.md | 112 | ||||
-rw-r--r-- | macros/latex/contrib/coloredtheorem/coloredtheorem-doc.pdf | bin | 201428 -> 214341 bytes | |||
-rw-r--r-- | macros/latex/contrib/coloredtheorem/coloredtheorem-doc.tex | 170 | ||||
-rw-r--r-- | macros/latex/contrib/coloredtheorem/coloredtheorem.sty | 17 |
4 files changed, 196 insertions, 103 deletions
diff --git a/macros/latex/contrib/coloredtheorem/README.md b/macros/latex/contrib/coloredtheorem/README.md index 805393b738..77ec725fd1 100644 --- a/macros/latex/contrib/coloredtheorem/README.md +++ b/macros/latex/contrib/coloredtheorem/README.md @@ -1,6 +1,6 @@ # coloredtheorem -A colourful boxed theorem environment, combining `tcolorbox` and breakable boxes. It supports full `tcolorbox` customization, automatic numbering, `\label{...}` and `\ref{…}`, and `\listof…` +A colorful boxed theorem environment, combining `tcolorbox` and breakable boxes. It supports full `tcolorbox` customization, automatic numbering, `\label{...}` and `\ref{…}`, and `\listof…` <!-- -------- @@ -28,69 +28,113 @@ A colourful boxed theorem environment, combining `tcolorbox` and breakable boxes -------- --> +## About + +* **Package:** coloredtheorem — A colorful boxed theorem environment +* **Copyright:** 2024 © João M. Lourenço <joao.lourenco@fct.unl.pt> +* **CTAN:** https://ctan.org/pkg/coloredtheorem +* **Repository:** https://github.com/joaomlourenco/coloredtheorem +* **License:** The LaTeX Project Public License 1.3c + ## Introduction -The `coloredtheorem` package is a simple environment, which takes no options, and that allows to write stuff inside boxes from `tcolorbox`. So, this packages includes `tcolorbox` if necessary. You may include `tcolorbox` with your own favourite options prior to including this package. +The `coloredtheorem` package is a simple environment that allows to write stuff inside +boxes from `tcolorbox`. If necessary the boxes gracefully overflow to the next page. +This package takes no options and includes `tcolorbox` if necessary. You may include +`tcolorbox` with your own favourite options prior to including this package. -Akin to `\newtheorem` from the `amsmath` package, the user should start by defining a new theorem/box group and customize its aspect. Each new environment will have its own counter/numnering. Notice that `\label{...}` and `\ref{...}` work as expected. The is also a command to generate the corresponding `\listof...` +Akin to `\newtheorem` from the `amsmath` package, the user should start by defining a +new _theorem/box_ group and customize its aspect. Each new environment will have its +own counter/numbering. Notice that `\label{...}` and `\ref{...}` work as expected. +There is also a command to generate the corresponding _\listof..._ ## Usage +* `\usepackage{coloredtheorem}` + * Load Load the `coloredtheorem` package. This package will load `tcolorbox` if necessary. * `\cthnewtheorem{<envname>}{<Name>}[<tcolorbox options>]` - * Load the tcbtheorem package. This package will load tcolorbox if not already loaded. -* `\cthnewtheorem{<envname>}{<Name>}[<tcolorbox options>]` - * `<envname>` is the environment name, e.g., theorem. - * `<Name>` is the name for new environment being defined, e.g., Theorem. - * `<tcolorbox options>` options to be passed to the `tcolorbox` environment to customize the boxes for the given environment (this argument is optional). + * Create a new boxed algorithm-like environment. + * `<envname>` is the suffix for the new environment being defined, e.g., `algoritm`. The effective environment name will be `cth<envname>`, e.g., `cthalgorithm`. + * `<Name>` is the (printable) name or the new environment being defined, e.g., _Algorithm_. + * `<tcolorbox options>` default options for the environment being defined (this argument is optional). These options are passed straight to the `tcolorbox` environment, so anything valid for `tcolorbox` is also valid here. * `\begin{<envname>}{<Caption>}[<tcolorbox options>]<Contents>\end{<envname>}` - * `<envname>` is the environment name, e.g., theorem. - * `<Caption>` is the caption/title of the box. - * `<tcolorbox options>` options to be passed to the `tcolorbox` environment, which will override the defaults given in `\cthnewtheorem`. - * `<Contents>` the contents to by typeset inside the coulored environment. + * Create a new _algorithm-like_ box with the given contents. + ∗ `<AltCaption>` is the alternative caption for the `\cthlistof<envname>s` (see below). + * `<envname>` is the sffix for environment name, e.g., `algorithm`. + * `<Caption>` is the caption/title of the box. If the caption is left empty, this box will not be listed with the `\cthlistof<envname>s` (see below). + * `<tcolorbox options>` options to be passed to the `tcolorbox` environment, which will override the defaults given in `\cthnewalgorithm` (this argument is optional). + * `<Contents>` the contents to by typeset inside the colored environment. * `\listof<envname>s` - * Where `<envname>` is the environment name, e.g., `\listoftheorems`. Please notice that there is a ‘s’ (plural) after `<envname>`. + * `<envname>` is the environment name suffix, e.g., `\cthlistofalgorithms`. Please +notice that there is a ‘s’ (plural) after `<envname>`. ## 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. +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] +``` + +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} +``` + +<img width="650" alt="image" src="https://github.com/joaomlourenco/coloredtheorem/assets/2064643/fa9cacce-89cc-4973-ac16-41a6e21dfded"> - \cthnewtheorem{algorithm}{Algorithm}[coltitle=black, colback=yellow!10, - colframe=black!15] - \cthnewtheorem{example}{Example}[coltitle=black, colback=black!5, - colframe=black!30] +_(page break here)_ -An algorithm box will be created with: +<img width="650" alt="image" src="https://github.com/joaomlourenco/coloredtheorem/assets/2064643/bc976d1a-2d7d-4f62-b651-4b23124d8d76"> - \begin{cthalgorithm}{Advance a counter to the next value in a domain - $\omega \in \mathbb{N}$.} - Algorithm body here! - \end{cthalgorithm} +The box Example 1, which uses the default visual for the environment (as given to `\cthnewtheorem...`), was created with: -<img width="491" alt="image" src="https://github.com/joaomlourenco/tcbtheorem/assets/2064643/54147631-3f5d-4ae0-a8b7-8b18b48d8db2"> +```latex +\begin{cthexample}{This is an example!} + Example body here! +\end{cthexample} +``` -Now, let's rewrite Algorithm 1, but now with a different customized visual, just for this entry! The customization (3rd) argument is passed straight to the `tcolorbox` environment, so anything valid for `tcolorbox` is also valid here. +<img width="650" alt="image" src="https://github.com/joaomlourenco/coloredtheorem/assets/2064643/69bd5bbd-8da8-418f-805d-0837c62cfb2c"> -<img width="491" alt="image" src="https://github.com/joaomlourenco/tcbtheorem/assets/2064643/be180e78-bc59-48ff-9efa-a26af5dae0bd"> +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: -(page break here!) +```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} +``` -<img width="489" alt="image" src="https://github.com/joaomlourenco/tcbtheorem/assets/2064643/04c6fcaa-1a27-4550-8b17-2ae4d90809b0"> +<img width="650" alt="image" src="https://github.com/joaomlourenco/coloredtheorem/assets/2064643/977c371c-1ecb-43ca-9351-c4befc23f7e9"> -Now, let’s add an example here, this time using the default visual that was given when creating the environment with `\cthnewtheorem`… +_(page break here)_ -<img width="490" alt="image" src="https://github.com/joaomlourenco/tcbtheorem/assets/2064643/835c1537-5b18-48b6-8ac1-ba6a6cff7b1b"> +<img width="650" alt="image" src="https://github.com/joaomlourenco/coloredtheorem/assets/2064643/c51ac463-c335-4132-9445-cb726ee616a1"> And now and example with no caption and a different visual... this example will not go into the` \listofexamples` below! -<img width="492" alt="image" src="https://github.com/joaomlourenco/tcbtheorem/assets/2064643/329e61a9-a12b-4cfe-9edf-1977f8158ee9"> +<img width="766" alt="image" src="https://github.com/joaomlourenco/coloredtheorem/assets/2064643/ab888abf-56ba-459d-aa94-2db9816d0a09"> -Now let’s print the lists of algorithms and examples. Remember to add the prefix cthth to the listof, i.e., `\cthlistofalgorithms` and `\cthlistofexamples`! +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 -<img width="492" alt="image" src="https://github.com/joaomlourenco/tcbtheorem/assets/2064643/f935bfcb-3387-426e-8511-c1f0efdcdd85"> +<img width="766" alt="image" src="https://github.com/joaomlourenco/coloredtheorem/assets/2064643/d2c4077e-ec5f-4b3d-8b24-a5713a8f3c29"> ## List of Examples -<img width="487" alt="image" src="https://github.com/joaomlourenco/tcbtheorem/assets/2064643/033f83d4-24c3-4e9d-8947-135f5765e3f3"> +<img width="767" alt="image" src="https://github.com/joaomlourenco/coloredtheorem/assets/2064643/483b6caf-f4f8-4e1c-83ff-f54101dad5f5"> diff --git a/macros/latex/contrib/coloredtheorem/coloredtheorem-doc.pdf b/macros/latex/contrib/coloredtheorem/coloredtheorem-doc.pdf Binary files differindex 046c79dcc6..abccef5167 100644 --- a/macros/latex/contrib/coloredtheorem/coloredtheorem-doc.pdf +++ b/macros/latex/contrib/coloredtheorem/coloredtheorem-doc.pdf diff --git a/macros/latex/contrib/coloredtheorem/coloredtheorem-doc.tex b/macros/latex/contrib/coloredtheorem/coloredtheorem-doc.tex index 55ae3d3ae5..875851d600 100644 --- a/macros/latex/contrib/coloredtheorem/coloredtheorem-doc.tex +++ b/macros/latex/contrib/coloredtheorem/coloredtheorem-doc.tex @@ -1,22 +1,14 @@ \documentclass{article} -\usepackage[margin=1.6in]{geometry} -\usepackage{fancyvrb} - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%% AMSMATH stuff -% \usepackage{amsthm} -% \usepackage{thmtools} -% \usepackage{amsfonts} - - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% TCBTHEOREM stuff \usepackage{coloredtheorem} - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% EXAMPLE document +\usepackage[margin=1.6in]{geometry} +\usepackage{fancyvrb} +\usepackage{minted} \usepackage{amsfonts} \usepackage{kantlipsum} \usepackage{tabularx} @@ -48,7 +40,7 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% MAIN DOCUMENT \begin{document} - \title{The \tcthrm package} + \title{The \tcthrm package {\footnotesize(v1.0.2)}} \author{João M. Lourenço\\\texttt{\small joao.lourenco@fct.unl.pt}} \date{March 31, 2024} @@ -58,61 +50,98 @@ \section{Introduction} \label{sec:introduction} -The \tcthrm package is a simple environment, which takes no options, and that allows to write stuff inside boxes from \texttt{tcolorbox}. So, this packages includes \texttt{tcolorbox} if necessary. You may include \texttt{tcolorbox} with your own favourite options prior to including this package. +The \tcthrm package is a simple environment that allows to write stuff inside boxes from \texttt{tcolorbox}. If necessary the boxes gracefully overflow to the next page. This package takes no options and includes \texttt{tcolorbox} if necessary. You may include \texttt{tcolorbox} with your own favourite options prior to including this package. -Akin to \verb!\newtheorem! from the \verb!amsmath! package, the user should start by defining a new \emph{theorem/box} group and customize its aspect. Each new environment will have its own counter/numbering. Notice that \verb!\label{…}! and \verb!\ref{…}! work as expected. The is also a command to generate the corresponding \emph{list of …} +Akin to \mintinline{TeX}+\newtheorem+ from the \texttt{amsmath} package, the user should start by defining a new \emph{theorem/box} group and customize its aspect. Each new environment will have its own counter/numbering. Notice that \mintinline{TeX}+\label{…}+ and \mintinline{TeX}+\ref{…}+ work as expected. There is also a command to generate the corresponding \emph{list of …} \section{Usage} \label{sec:usage} -\begin{description} - \item[]{\bfseries\verb+\usepackage{coloredtheorem}+} - \begin{description} - \item[]Load the \texttt{coloredtheorem} package. This package will load \texttt{tcolorbox} if necessary. - \end{description} - \item[]{\bfseries\Verb[commandchars=!()]+\!tcbth()newtheorem{<envname>}{<Name>}[<tcolorbox options>]+} - \begin{description} - \item[]\verb+<envname>+ is the environment name, e.g., \verb!theorem!. - \item[]\verb+<Name>+ is the name for new environment being defined, e.g., \emph{Theorem}. - \item[]\verb+<tcolorbox options>+ options to be passed to the \verb+tcolorbox+ environment to customize the boxes for the given environment (this argument is optional). - \end{description} - \item[]{\bfseries\Verb[commandchars=!()]+\begin{!tcbth()<envname>}{<Caption>}[<tcolorbox options>]<Contents>\end{!tcbth()<envname>}+} - \begin{description} - \item[]\verb+<envname>+ is the environment name, e.g., \verb+theorem+. - \item[]\verb+<Caption>+ is the caption/title of the box. - \item[]\verb+<tcolorbox options>+ options to be passed to the \verb+tcolobox+ environment, which will override the defaults given in \verb+\cthnewtheorem+. - \item[]\verb+<Contents>+ the contents to by typeset inside the coulored environment. - \end{description} - \item[]{\bfseries\Verb[commandchars=!()]+\!tcbth()listof<envname>s+} - \begin{description} - \item[]\verb+<envname>+ is the environment name, e.g., e.g., \Verb[commandchars=!()]+\!tcbth()listoftheorems+. Please notice that there is a `s' (plural) after \verb+<envname>+. - \end{description} -\end{description} +\definecolor{mycgreen}{RGB}{57,126,27} +\newcommand\ca[1]{\textcolor{blue}{#1}} +\newcommand\co[1]{\textcolor{blue!50}{#1}} +\newcommand\cc[1]{\textcolor{red!50!black}{#1}} +\newcommand\ck[1]{\textcolor{mycgreen}{#1}} + +\begin{itemize} + \item \mintinline{TeX}+\usepackage{coloredtheorem}+ + \begin{itemize} + \item Load the \texttt{coloredtheorem} package. + This package will load \texttt{tcolorbox} if necessary. + \end{itemize} + + \item \mintinline[escapeinside=||]{TeX}+\cthnewtheorem{|\ca{<envname>}|}{|\ca{<Name>}|}[|\co{<tcolorbox options>}|]+ + \begin{itemize} + \item Create a new boxed \emph{algorithm-like} environment. + \begin{itemize} + \item \mintinline[escapeinside=||]{TeX}+|\ca{<envname>}|+ is the suffix for the + new environment being defined, e.g., \ca{\texttt{algoritm}}. The effective environment name will be \mintinline[escapeinside=||]{TeX}+|\ca{cth<envname>}|+, e.g., \ca{\texttt{cthalgorithm}}. + \item \mintinline[escapeinside=||]{TeX}+|\ca{<Name>}|+ is the (printable) name + or the new environment being defined, e.g., \emph{Algorithm}. + \item \mintinline[escapeinside=||]{TeX}+|\co{<tcolorbox options>}|+ default + options for the environment being defined (this argument is optional). + These options are passed straight to the \texttt{tcolorbox} environment, + so anything valid for \texttt{tcolorbox} is also valid here. + \end{itemize} + \end{itemize} + + \item \begin{minted}[escapeinside=||]{TeX} +\begin{|\ca{ctb<envname>}|}[|\co{<AltCaption>}|]{|\ca{<Caption>}|}[|\co{<tcolorbox options>}|] + |\cc{<Contents>}| +\end{|\ca{ctb<envname>}|} +\end{minted} + \begin{itemize} + \item Create a new \emph{algorithm-like} box with the given contents. + \begin{itemize} + \item \mintinline[escapeinside=||]{TeX}+|\co{<AltCaption>}|+ is the alternative + caption for the + \mintinline[escapeinside=||]{TeX}+\cthlistof|\ck{<envname>s}|+ + (see below). + \item \mintinline[escapeinside=||]{TeX}+|\ca{<envname>}|+ is the suffix for environment name, + e.g., \verb+algorithm+. + \item \mintinline[escapeinside=||]{TeX}+|\ca{<Caption>}|+ is the caption/title of + the box. If the caption is left empty, this box will not be listed with the + \mintinline[escapeinside=||]{TeX}+\cthlistof|\ck{<envname>s}|+ + (see below). + \item \mintinline[escapeinside=||]{TeX}+|\co{<tcolorbox options>}|+ options to be + passed to the \verb+tcolorbox+ environment, which will override the defaults + given in \mintinline{TeX}+\cthnewalgorithm+ (this argument is optional). + \item \mintinline[escapeinside=||]{TeX}+|\cc{<Contents>}|+ the contents to by typeset inside the colored environment. + \end{itemize} + \end{itemize} + + \item \mintinline[escapeinside=||]{TeX}+\cthlistof|\ck{<envname>s}|+ + \begin{itemize} + \item \mintinline[escapeinside=||]{TeX}+|\ca{<envname>}|+ is the environment name + suffix, e.g., \mintinline[escapeinside=||]{TeX}+\cthlistofalgorithms+. + Please notice that there is a `s' (plural) after + \mintinline[escapeinside=||]{TeX}+|\ca{<envname>}|+. + \end{itemize} +\end{itemize} \section{Example} \label{sec:examples} Let's start by creating two new environments, one for \emph{algorithms} and another for \emph{examples}, both defaulting to a gray frame, the former with a yellowish background and the latter with a lighter gray background. -\begin{verbatim} -\cthnewtheorem{algorithm}{Algorithm}[coltitle=black, colback=yellow!10, - colframe=black!15] -\cthnewtheorem{example}{Example}[coltitle=black, colback=black!5, - colframe=black!30] -\end{verbatim} +\begin{minted}[bgcolor=red!5,fontsize=\small,escapeinside=||]{TeX} +\cthnewtheorem{|\ca{algorithm}|}{|\ca{Algorithm}|}[|\co{coltitle=}|black, |\co{colback=}|yellow!10, + |\co{colframe=}|black!15] +\cthnewtheorem{|\ca{example}|}{|\ca{Example}|}[|\co{coltitle=}|black, |\co{colback}|=black!5, + |\co{colframe=}|black!30] +\end{minted} \cthnewtheorem{algorithm}{Algorithm}[coltitle=black, colback=yellow!10, colframe=black!15] \cthnewtheorem{example}{Example}[coltitle=black, colback=black!5, colframe=black!30] -An algorithm box will be created with: -\begin{verbatim} -\begin{cthalgorithm}{Advance a counter to the next value in a domain - $\omega \in \mathbb{N}$.} - -Algorithm body here! -\end{cthalgorithm} -\end{verbatim} +The box with \autoref{alg:advance1}, which uses the default visual that was given when creating the environment with \mintinline{TeX}+\cthnewtheorem+ and gracefully overflows onto the next page, was created with: +\begin{minted}[bgcolor=red!5,fontsize=\small,escapeinside=||]{TeX} +\begin{|\ca{cthalgorithm}|}{|\co{Advance a counter to the next value in a domain}| + $\omega \in \mathbb{N}$.} + |\cc{Algorithm body here!}| +\end{|\ca{cthalgorithm}|} +\end{minted} \newcommand{\bracesemptyset}{\ensuremath{\lbrace\,\rbrace}} @@ -145,9 +174,34 @@ Algorithm body here! \end{algorithmic} \end{cthalgorithm} -Now, let's rewrite \autoref{alg:advance1}, but now with a different customized visual, just for this entry! The customization (3rd) argument is passed straight to the \texttt{tcolorbox} environment, so anything valid for \texttt{tcolorbox} is also valid here. +The box \autoref{expl:explstd}, which uses the default visual for the environment (as given to \mintinline{TeX}+\cthnewtheorem...+), was created with: -\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, fonttitle=\sffamily\bfseries\large, colbacktitle=red!50!white] +\begin{minted}[bgcolor=red!5,fontsize=\small,escapeinside=||]{TeX} +\begin{|\ca{cthexample}|}{|\co{This is an example!}|} + |\cc{Example body here!}| +\end{|\ca{cthexample}|} +\end{minted} + + +\begin{cthexample}{This is an example!} + \label{expl:explstd} + \emph{As is shown in the writings of Aristotle, the things in themselves (and it remains a mystery why this is the case) are a representation of time. Our concepts have lying before them the paralogisms of natural reason, but our a posteriori concepts have lying before them the practical emploument of our experience.} +\end{cthexample} + +Now, let's create a new box for \autoref{alg:advance1}, but with a different customized visual, which will affect only this entry! Notice that the customization argument is passed straight to the \texttt{tcolorbox} environment, so anything valid for \texttt{tcolorbox} is also valid here. \autoref{alg:advance2} was created with the following code: + +\begin{minted}[bgcolor=red!5,fontsize=\small,escapeinside=||]{TeX} +\begin{|\ca{cthalgorithm}|} + {|\ca{Advance a counter to the next value in a domain}| $\omega \in + \mathbb{N}$|\ca{, but now with a customized visual. Also, notice}| + |\ca{that this algorithm breaks the page boundaries.}|} + [|\co{coltitle}=|white, |\co{colback}=|green!10, |\co{colframe}=|green!70!black, + |\co{colbacktitle}=|\sffamily\bfseries\large, |\co{fonttitle}|=red!50!white] + |\cc{Algorithm body here!}| +\end{|\ca{cthalgorithm}|} +\end{minted} + +\begin{cthalgorithm}{Advance a counter to the next value in a domain $\omega \in \mathbb{N}$, but now with a customized visual. Notice that this algorithm also breaks the page boundaries.}[coltitle=white, colback=red!10, colframe=red!50!black, fonttitle=\sffamily\bfseries\large, colbacktitle=red!70!black] \label{alg:advance2} \begin{algorithmic}[1] \Statex \Input $\alpha$: The current value; and $\omega$: the domain. @@ -176,19 +230,13 @@ Now, let's rewrite \autoref{alg:advance1}, but now with a different customized v \end{algorithmic} \end{cthalgorithm} -Now, let's add an example here, this time using the default visual that was given when creating the environment with \verb+\cthnewtheorem+… - -\begin{cthexample}{This is an example!} - \emph{\kant[3]} -\end{cthexample} - -And now an example with no caption and a different visual… this example will not go into the \verb+\listofexamples+ below! +And now an example with no caption and a different visual… this example will not go into the \mintinline{TeX}+\listofexamples+ below! \begin{cthexample}{}[coltitle=yellow, colback=blue!30, colframe=blue!70] \emph{\kant[4]} \end{cthexample} -Now let's print the lists of algorithms and examples. Remember to add the prefix \texttt{cthth} to the \texttt{listof}, i.e., \verb+\cthlistofalgorithms+ and \verb+\cthlistofexamples+! +Now let's print the lists of algorithms and examples. Remember to add the prefix \ck{\texttt{cth}} to the \ck{\texttt{listof}}, i.e., \mintinline{TeX}+\cthlistofalgorithms+ and \mintinline{TeX}+\cthlistofexamples+! \cthlistofalgorithms diff --git a/macros/latex/contrib/coloredtheorem/coloredtheorem.sty b/macros/latex/contrib/coloredtheorem/coloredtheorem.sty index dd553ba75d..4e128bf80b 100644 --- a/macros/latex/contrib/coloredtheorem/coloredtheorem.sty +++ b/macros/latex/contrib/coloredtheorem/coloredtheorem.sty @@ -1,4 +1,4 @@ -%% This is file `tcbtheorem.sty', +%% This is file `coloredtheorem.sty', %% %% Copyright (C) 2024 by João Lourenço <joao.lourenco@fct.unl.pt> %% @@ -14,7 +14,7 @@ %% \NeedsTeXFormat{LaTeX2e}[2020/06/01] \ProvidesPackage{coloredtheorem} - [2024/03/31 v1.0 - a theorem-like environment inside a tcolobox] + [2024/04/03 v1.0.2 - A colorful boxed theorem environment] \RequirePackage{tcolorbox} \tcbuselibrary{breakable} @@ -36,15 +36,16 @@ \expandafter\NewDocumentEnvironment\expandafter{\tcbth#1} {O{} m O{}}% {% \begin{tcb<SOMETHING>} \begin{center}% - \ifx\relax##1\relax - \ifx\relax##2\relax\else - \expandafter\refstepcounter\expandafter{\tcbth#1}% + \ifx\relax##2\relax + \else + \expandafter\refstepcounter\expandafter{\tcbth#1}% + \ifx\relax##1\relax \expandafter\addcontentsline\expandafter{lo#1}{subsection} {\protect\numberline{\csname the\tcbth#1\endcsname}##2}% - \fi - \else - \expandafter\addcontentsline\expandafter{lo#1}{subsection} + \else + \expandafter\addcontentsline\expandafter{lo#1}{subsection} {\protect\numberline{\csname the\tcbth#1\endcsname}##1}% + \fi \fi \begin{tcolorbox}[breakable, title={\textbf{\csname\tcbth#1name\endcsname |