texlive[73320] Master/texmf-dist: coloredtheorem (5jan25)

commits+karl at tug.org commits+karl at tug.org
Sun Jan 5 21:56:31 CET 2025


Revision: 73320
          https://tug.org/svn/texlive?view=revision&revision=73320
Author:   karl
Date:     2025-01-05 21:56:31 +0100 (Sun, 05 Jan 2025)
Log Message:
-----------
coloredtheorem (5jan25)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/coloredtheorem/README.md
    trunk/Master/texmf-dist/doc/latex/coloredtheorem/coloredtheorem-doc.pdf
    trunk/Master/texmf-dist/doc/latex/coloredtheorem/coloredtheorem-doc.tex
    trunk/Master/texmf-dist/tex/latex/coloredtheorem/coloredtheorem.sty

Modified: trunk/Master/texmf-dist/doc/latex/coloredtheorem/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/coloredtheorem/README.md	2025-01-05 20:56:23 UTC (rev 73319)
+++ trunk/Master/texmf-dist/doc/latex/coloredtheorem/README.md	2025-01-05 20:56:31 UTC (rev 73320)
@@ -77,8 +77,17 @@
                                      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!
+
+<img width="650" alt="image of a thought" src="https://github.com/user-attachments/assets/d55c5281-b95a-4dc1-bf33-7b0ffc0c4b3e" />
+
 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
@@ -89,11 +98,11 @@
 \end{cthalgorithm}
 ```
 
-<img width="650" alt="image" src="https://github.com/joaomlourenco/coloredtheorem/assets/2064643/fa9cacce-89cc-4973-ac16-41a6e21dfded">
+<img width="650" alt="image of an algorithm - pt1" src="https://github.com/joaomlourenco/coloredtheorem/assets/2064643/fa9cacce-89cc-4973-ac16-41a6e21dfded">
 
 _(page break here)_
 
-<img width="650" alt="image" src="https://github.com/joaomlourenco/coloredtheorem/assets/2064643/bc976d1a-2d7d-4f62-b651-4b23124d8d76">
+<img width="650" alt="image of an algorithm - pt2" src="https://github.com/joaomlourenco/coloredtheorem/assets/2064643/bc976d1a-2d7d-4f62-b651-4b23124d8d76">
 
 
 The box Example 1, which uses the default visual for the environment (as given to `\cthnewtheorem...`), was created with:
@@ -104,7 +113,7 @@
 \end{cthexample}
 ```
 
-<img width="650" alt="image" src="https://github.com/joaomlourenco/coloredtheorem/assets/2064643/69bd5bbd-8da8-418f-805d-0837c62cfb2c">
+<img width="650" alt="image of an example" src="https://github.com/joaomlourenco/coloredtheorem/assets/2064643/69bd5bbd-8da8-418f-805d-0837c62cfb2c">
 
 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:
 
@@ -119,16 +128,32 @@
 \end{cthalgorithm}
 ```
 
-<img width="650" alt="image" src="https://github.com/joaomlourenco/coloredtheorem/assets/2064643/977c371c-1ecb-43ca-9351-c4befc23f7e9">
+<img width="650" alt="image of another algorithm - pt1" src="https://github.com/joaomlourenco/coloredtheorem/assets/2064643/977c371c-1ecb-43ca-9351-c4befc23f7e9">
 
 _(page break here)_
 
-<img width="650" alt="image" src="https://github.com/joaomlourenco/coloredtheorem/assets/2064643/c51ac463-c335-4132-9445-cb726ee616a1">
+<img width="650" alt="image of another algorithm - pt2" 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="766" alt="image" src="https://github.com/joaomlourenco/coloredtheorem/assets/2064643/ab888abf-56ba-459d-aa94-2db9816d0a09">
+```latex
+\begin{cthexample}{}[coltitle=black, colback=magenta!10, colframe=magenta!20]
+  Example body here!
+\end{cthexample}
+```
 
+<img width="650" alt="image on an algorithm with no caption" src="https://github.com/user-attachments/assets/1e798c4f-e029-4901-9d63-9ca8839e2208" />
+
+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*}
+```
+
+<img width="650" alt="image on an algorithm with no caption using the star syntax" src="https://github.com/user-attachments/assets/155e8081-a960-4dce-84a5-1341abd2708c" />
+
 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

Modified: trunk/Master/texmf-dist/doc/latex/coloredtheorem/coloredtheorem-doc.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/coloredtheorem/coloredtheorem-doc.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/coloredtheorem/coloredtheorem-doc.tex	2025-01-05 20:56:23 UTC (rev 73319)
+++ trunk/Master/texmf-dist/doc/latex/coloredtheorem/coloredtheorem-doc.tex	2025-01-05 20:56:31 UTC (rev 73320)
@@ -13,7 +13,7 @@
 \usepackage{kantlipsum}
 \usepackage{tabularx}
 \usepackage{xspace}
-\newcommand\tcthrm{\texttt{coloredtheorem}\xspace}
+\newcommand\tcthrm{\textsf{\cthfilename}\xspace}
 
 %% ALGPSEUDOCODEX stuff
 \usepackage{algorithm}
@@ -40,10 +40,10 @@
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %% MAIN DOCUMENT
 \begin{document}
-  \title{The \tcthrm package {\footnotesize(v1.0.4)}}
-  \author{João M. Lourenço\\\texttt{\small joao.lourenco at fct.unl.pt}}
-  \date{September 15, 2024}
-  
+  \title{The \tcthrm package}
+  \author{João M. Lourenço\\\url{https://github.com/joaomlourenco/coloredtheorem}}
+  \date{\cthfiledate\ (v\cthfileversion)}
+
   \maketitle
   
 
@@ -110,6 +110,27 @@
     \end{itemize}
   \end{itemize}
 
+ \item \begin{minted}[escapeinside=||]{TeX}
+\begin{|\ca{ctb<envname>*}|}{|\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}+|\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.  This box will be unnumbered and 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
@@ -133,7 +154,15 @@
 
 \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!
+\begin{cththought}{This is a tought}
+\kant[2]
+\end{cththought}
 
 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}
@@ -232,10 +261,31 @@
 
 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]
+\begin{minted}[bgcolor=red!5,fontsize=\small,escapeinside=||]{TeX}
+\begin{|\ca{cthexample}|}{}
+          [|\co{coltitle}=|black, |\co{colback}=|magenta!10, |\co{colframe}=|magenta!20]
+  |\cc{Example body here!}|
+\end{|\ca{cthexample}|}
+\end{minted}
+
+\begin{cthexample}{}[coltitle=black, colback=magenta!10, colframe=magenta!20]
   \emph{\kant[4]}
 \end{cthexample}
 
+And yet another unnumbered example, this one using the alternative (star) syntax. This example will not go into the \mintinline{TeX}+\listofexamples+ below as well!
+
+\begin{minted}[bgcolor=red!5,fontsize=\small,escapeinside=||]{TeX}
+\begin{|\ca{cthexample*}|}
+          {|\ca{This is an unnumbered example with a title}|}
+          [|\co{coltitle}=|black, |\co{colback}=|yellow!10, |\co{colframe}=|yellow!20]
+  |\cc{Example body here!}|
+\end{|\ca{cthexample*}|}
+\end{minted}
+
+\begin{cthexample*}{This is an unnumbered example with a title}[coltitle=black, colback=yellow!10, colframe=yellow!20]
+  \emph{\kant[4]}
+\end{cthexample*}
+
 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

Modified: trunk/Master/texmf-dist/tex/latex/coloredtheorem/coloredtheorem.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/coloredtheorem/coloredtheorem.sty	2025-01-05 20:56:23 UTC (rev 73319)
+++ trunk/Master/texmf-dist/tex/latex/coloredtheorem/coloredtheorem.sty	2025-01-05 20:56:31 UTC (rev 73320)
@@ -12,29 +12,39 @@
 %% and version 1.3c or later is part of all distributions of LaTeX
 %% version 2006/05/20 or later.
 %%
-\NeedsTeXFormat{LaTeX2e}[2020/06/01]
-\ProvidesPackage{coloredtheorem}
-  [2024/09/15 v1.0.4 - A colorful boxed theorem environment]
+\def\cthfileversion{1.1.0}
+\def\cthfiledate   {2025/01/03}
+\edef\cthfilename  {\@currname}
 
-\RequirePackage{tcolorbox}
+\ProvidesPackage{coloredtheorem}[%
+  \cthfiledate\  v\cthfileversion (João M. Lourenço) - A colorful boxed theorem environment.]
+
+\RequirePackage[most]{tcolorbox}
 \tcbuselibrary{breakable}
 
 \gdef\tcbth{cth}
 
-\expandafter\NewDocumentCommand\csname\tcbth newtheorem\endcsname { m m O{} }{%
+\NewDocumentCommand{\TcbthNewDocumentCommand}{m}{%
+    \expandafter\NewDocumentCommand\csname\tcbth#1\endcsname}
+\NewDocumentCommand{\TcbthNewDocumentEnvironment}{m}{%
+    \expandafter\NewDocumentEnvironment\expandafter{\tcbth#1}}
+\NewDocumentCommand{\TcbthGdef}{O{\tcbth}mm}{%
+    \expandafter\gdef\csname#1#2\endcsname{#3}}
+
+\TcbthNewDocumentCommand{newtheorem} { m m O{} }{%
   \expandafter\newcounter\expandafter{\tcbth#1}%
-  \expandafter\gdef\csname\tcbth#1name\endcsname{#2}%
-  \expandafter\gdef\csname\tcbth list#1name\endcsname{List of #2s}%
-  \expandafter\gdef\csname#1autorefname\endcsname{#2}%
+  \TcbthGdef{#1name}{#2}%
+  \TcbthGdef{list#1name}{List of #2s}%
+  \TcbthGdef[]{#1autorefname}{#2}%
   \AtEndPreamble{%
       \ifdefined\crefname\expandafter\crefname\expandafter{\tcbth#1}{#2}{#2s}\fi}%
-  \expandafter\gdef\csname\tcbth listof#1s\endcsname
+  \TcbthGdef{listof#1s}
   {%
     \ifdefined\chapter\chapter*{\csname\tcbth list#1name\endcsname}%
         \else\section*{\csname\tcbth list#1name\endcsname}\fi%
     \expandafter\@starttoc\expandafter{lo#1}%
   }
-  \expandafter\NewDocumentEnvironment\expandafter{\tcbth#1} {O{} m O{}}%
+  \TcbthNewDocumentEnvironment{#1} {O{} m O{}}%
   {% \begin{tcb<SOMETHING>}
     \begin{center}%
       \ifx\relax##2\relax
@@ -48,17 +58,31 @@
                         {\protect\numberline{\csname the\tcbth#1\endcsname}##1}%
         \fi
       \fi
-      \begin{tcolorbox}[breakable,
+      \begin{tcolorbox}[breakable,lowerbox=ignored,left=0mm,right=0mm,top=0mm,bottom=0mm,
                         title={\textbf{\csname\tcbth#1name\endcsname
                                \ifx\relax##2\relax\else
                                    ~\csname the\tcbth#1\endcsname\fi}~~##2},
                         #3, ##3,
                        ]%
-      \let\origpar=\par%
-      \def\par{\origpar\medskip}%
+      % \let\origpar=\par%
+      % \def\par{\origpar\medskip}%
       \ignorespaces%
   }{% \end{tcb<SOMETHING>}
        \end{tcolorbox}%
      \end{center}%
   }%
+  \TcbthNewDocumentEnvironment{#1*} {O{} m O{}}%
+  {% \begin{tcb<SOMETHING>}
+    \begin{center}%
+      \begin{tcolorbox}[breakable,lowerbox=ignored,left=0mm,right=0mm,top=0mm,bottom=0mm,
+                        title={\textbf{\csname\tcbth#1name\endcsname}~~##2},
+                        #3, ##3,
+                       ]%
+      % \let\origpar=\par%
+      % \def\par{\origpar\medskip}%
+      \ignorespaces%
+  }{% \end{tcb<SOMETHING>}
+       \end{tcolorbox}%
+     \end{center}%
+  }%
 }



More information about the tex-live-commits mailing list.