summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/colorframed
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2022-09-24 03:04:02 +0000
committerNorbert Preining <norbert@preining.info>2022-09-24 03:04:02 +0000
commit41d1be12f4963b0f5bf9903116883f1458b58960 (patch)
treed12cd4aba21868c5b740e03dd751cd9088154b80 /macros/latex/contrib/colorframed
parent93fb03ea65cbfc0770b6b22d07b1a2d8098b23aa (diff)
CTAN sync 202209240304
Diffstat (limited to 'macros/latex/contrib/colorframed')
-rw-r--r--macros/latex/contrib/colorframed/README.md17
-rw-r--r--macros/latex/contrib/colorframed/colorframed-doc.pdfbin17300 -> 18830 bytes
-rw-r--r--macros/latex/contrib/colorframed/colorframed-doc.tex192
-rw-r--r--macros/latex/contrib/colorframed/colorframed.sty18
4 files changed, 129 insertions, 98 deletions
diff --git a/macros/latex/contrib/colorframed/README.md b/macros/latex/contrib/colorframed/README.md
index 59bc8c094b..1d5084a71a 100644
--- a/macros/latex/contrib/colorframed/README.md
+++ b/macros/latex/contrib/colorframed/README.md
@@ -1,6 +1,6 @@
-% colorframed 0.9
+% colorframed 0.9a
% Jean-François Burnol
-% 2022/09/22
+% 2022/09/23
## Usage
@@ -11,8 +11,8 @@ For reporting issues, use the
## Purpose
-The initial release `0.9` of `2022/09/22` fixes colour leak issues
-which one encounters with the environments provided by the
+The initial release fixes colour leak issues which one encounters
+with the environments provided by the
[framed](https://ctan.org/pkg/framed) package.
It is planned to extend `colorframed` with one more environment,
@@ -43,13 +43,6 @@ This Work has the LPPL maintenance status author-maintained.
The Author of this Work is Jean-François Burnol
-This Work consists of the package files `colorframed.sty`, the
+This Work consists of the package file `colorframed.sty`, the
documentation source `colorframed-doc.tex` and its conversion
`colorframed-doc.pdf`, as well as this `README.md`.
-
-<!--
-%! Local variables:
-%! sentence-end-double-space: t
-%! fill-column: 72
-%! End:
--->
diff --git a/macros/latex/contrib/colorframed/colorframed-doc.pdf b/macros/latex/contrib/colorframed/colorframed-doc.pdf
index 16ee21cf33..640c47d683 100644
--- a/macros/latex/contrib/colorframed/colorframed-doc.pdf
+++ b/macros/latex/contrib/colorframed/colorframed-doc.pdf
Binary files differ
diff --git a/macros/latex/contrib/colorframed/colorframed-doc.tex b/macros/latex/contrib/colorframed/colorframed-doc.tex
index cc2b6fca39..3f00ea2706 100644
--- a/macros/latex/contrib/colorframed/colorframed-doc.tex
+++ b/macros/latex/contrib/colorframed/colorframed-doc.tex
@@ -1,4 +1,5 @@
-\documentclass[a4paper,dvipdfmx,11pt]{article}
+\documentclass[a4paper,dvipdfmx,11pt,english]{article}
+\usepackage{babel}
\usepackage[T1]{fontenc}
\usepackage{geometry}
\usepackage[straightquotes,ttzdefault]{newtxtt}
@@ -9,19 +10,21 @@
% course
% titled-frame
\colorlet{TFFrameColor}{teal!20}
-\colorlet{TFTitleColor}{orange}
-\def\colorframedTFconlabcolorcommand{\color{red}}
+\colorlet{TFTitleColor}{purple}
+\def\colorframedTFconlabcolorcommand{\color{purple}}
% shaded
-\colorlet{shadecolor}{orange!20}
+\colorlet{shadecolor}{orange!10}
% framed
\FrameRule5pt\relax
-\FrameSep9pt\relax
+\FrameSep9pt\relax % this is framed.sty default anyhow, 3\fboxsep
+% attention that \FrameSep influences framed but also shaded, shaded* and
+% oframed, which is not so clear from reading only framed documentation
\def\colorframedbordercolorcommand{\color{red!20}}
\title{The \colorframed package%
\vadjust{\vtop to 0pt{\hbox
- to\linewidth{\strut\footnotesize Release 0.9 of
- 2022/09/22\hss report issues at \url{https://github.com/jfbu/colorframed}}\vss}}%
+ to\linewidth{\strut\footnotesize Release 0.9a of
+ 2022/09/23\hss report issues at \url{https://github.com/jfbu/colorframed}}\vss}}%
}
\author{Jean-François Burnol}
\date{}
@@ -54,22 +57,20 @@
This package fixes various colour leaks one encounters with
the environments from Donald Arseneau's package
\ctanpackage{framed}. Typically, colour leaks occur if using
-|\color| inside the environments, or more subtly also when
+|\color| (at top level) inside the environments, or more subtly also when
using |\textcolor| with an argument ending up being split at a
page break.
This latter type of colour leak (or colour disappearance) is the
more challenging one as the fix requires modifications or
replacements not only of some of the \ctanpackage{framed}.sty
-macros (such as its |\CustomFBox|) but also to some \LaTeX2e
-internals, as some environments of \ctanpackage{framed}.sty
-rely on usage of |\fbox| or |\colorbox|.
-
-However, rather than overwriting such internal \LaTeX2e macros
-as |\@frameb@x| or |\color@b@x|, the \ctanpackage{framed}.sty
-environments are modified by \colorframed to make use of
-custom replacements to |\fbox|, |\colorbox|, and
-|\CustomFBox|.
+macros (such as its |\CustomFBox|, which \colorframed overwrites)
+but also to some \LaTeX2e internals, as some environments of
+\ctanpackage{framed}.sty rely on usage of |\fbox| or |\colorbox|.
+Rather than overwriting internal \LaTeX2e macros such as
+|\@frameb@x| or |\color@b@x|, \colorframed simply replaces |\fbox|
+and |\colorbox| in the \ctanpackage{framed}.sty environments by
+appropriate substitutes.
I am aware \ctanpackage{tcolorbox} package documentation explains at
least one colour issue which looks similar to those fixed
@@ -80,42 +81,31 @@ currently.
The problems are solved here without involving an extra
colour stack, hence the fixes work also with xelatex.
-% The analysis and original workarounds for using framed.sty
-% with colours were developed by me in some contributions I made
-% to the Sphinx project (\url{https://github.com/sphinx-doc/sphinx})
-% and I am transferring here the general idea.
-
-% The key thing is that the boxes handled by framed.sty may
-% contain isolated colour push or colour pop. We must make
-% sure an isolated colour push, if followed by colour changes,
-% is always followed by paired ones, and never by a colour pop
-% from a colour command originated "prior".
-
-% TODO: transfer also the breakable box environment based on pict2e
-% and allowing rounded corners and shadows developped overthere.
-
\section{The environments from \ctanpackage{framed}}
\begin{titled-frame}{A list of the environments from package \ctanpackage{framed}}
- This indicates the boxing macros they are
- based upon originally, and what this package does as replacement:
- \begin{description}
- \item[framed] (|\fbox|) The \colorframed variant uses own |\CustomFBox| rather.
-
- \item[oframed] (|\CustomFBox|) \colorframed replaces it with own version.
-
- \item[titled-frame] (|\CustomFbox|) Replaced by own version.
-
- \item[shaded] (|\colorbox|) Replaced by |\colorframedcolorbox|.
-
- \item[shaded*] (|\colorbox|) Idem.
-
- \item[snugshade] (|\colorbox|) Idem.
-
- \item[snugshade*] (|\colorbox|) Idem.
-
- \item[leftbar] This one does not use any boxing macro.
- \end{description}
+ This list indicates which boxing macros are
+ used in the original, and their replacement.
+% (investigate later why something such as shortverb |#| in
+% preamble does not work)
+\halign{\bfseries#\hfil&(#\unskip)~\hfil&#\hfil\cr
+%
+ framed & |\fbox| & Replaced by specialization of own \rlap{\string\CustomFBox.}\cr
+%
+ oframed & |\CustomFBox| & \colorframed uses a redefined |\CustomFBox|.\cr
+%
+ titled-frame & |\CustomFBox| & \emph{id.}\cr
+%
+ shaded & |\colorbox| & Replaced by |\colorframedcolorbox|.\cr
+%
+ shaded* & |\colorbox| & \emph{id.}\cr
+%
+ snugshade & |\colorbox| & \emph{id.}\cr
+%
+ snugshade* & |\colorbox| & \emph{id.}\cr
+%
+ leftbar & none & This one does not use any boxing macro.\cr
+}
\end{titled-frame}
\begin{shaded*}
@@ -132,7 +122,8 @@ colour stack, hence the fixes work also with xelatex.
further one will need to renew the environment definition,
which is left untouched by \colorframed (which modifies
rather |\TitleBarFrame| and |\CustomFBox|). Here is
- how this environment is defined:
+ how this environment is defined inside \ctanpackage{framed}.sty: (code and comments by Donald Arseneau)\par
+\begin{footnotesize}
\begin{verbatim}
% A particular type of titled frame with continuation marks.
% Parameter #1 is the title, repeated on each page.
@@ -151,10 +142,14 @@ colour stack, hence the fixes work also with xelatex.
{\endMakeFramed}
\end{verbatim}
% pas de \footnote dans les environnements de framed...
-\begin{footnotesize}\normalcolor
-As a side note, this `titled-frame' environment was partly
+\normalcolor
+Side note: this `titled-frame' environment was in effect
broken in recent \LaTeX\ which has modified how |\smash|
-behaves; \colorframed fixes it in passing.\par
+behaves; \colorframed fixes this infelicity in passing.\par
+
+\emph{(the current box is an example of \emph{`shaded*'} environment, next one is with
+\emph{`snugshade*'}, both use a \emph{shadecolor} which must be defined by user)}
+\par
\end{footnotesize}
\end{shaded*}
% jeudi 22 septembre 2022 à 14:37:08
@@ -167,31 +162,32 @@ behaves; \colorframed fixes it in passing.\par
% Ce n'est pas induit par colorframed j'ai vérifié sans lui.
%\begin{enumerate}
%\item\relax% {\footnotesize Now testing the `snugshade*' environment.}
-\begin{snugshade*}\textcolor{ForestGreen}{% using textcolor to
- % avoid extra vspace from \color
+\begin{snugshade*}
+\leavevmode\color{OliveGreen}
One does not need to dive into the details of the macros
used above to understand intuitively how they are supposed
to influence the final output. To modify this output,
simply redefine this environment with suitable changes.
- Notice in particular that \expandafter|\string\blacktriangleright| requires to
- the best of my knowledge loading of \ctanpackage{amssymb} or
- other math symbols package and it is up to user to do it, if
- its usage is kept.}
-%\end{snugshade*}
-%\item\relax% {\footnotesize It appears to have a bug of not being
-% usable directly after |\item|.\par}
-%\begin{snugshade*}
-
-The original environment gives to the continuation label at
-bottom right of the first part of a broken box the same colour
-as the frame. The \colorframed variant adds the possibility
-to customize this colour via suitably defining a macro, in the
-example above we did:
+
+ Notice in particular that |$\blacktriangleright$|
+ (which produces $\blacktriangleright$ and acquires thus a colour
+ despite its name) requires to
+ the best of my knowledge loading \ctanpackage{amssymb} or
+ some other math symbols package and it is up to user to do it, if
+ its usage is kept.
+%
+ The original environment gives to this continuation label the
+ same colour as the frame. \colorframed adds the
+ possibility to customize this colour via suitably defining a
+ macro, like this for example:% le % pour éviter un bug lorsqu'un caractère
+ % espace est à la fin d'une ligne quasi-pleine,
+ % je soupçonne bug de TeX que j'ai déjà
+ % rencontré plusieurs fois, ou peut-être ici un
+ % problème du \trivlist de verbatim
\begin{verbatim}
-\renewcommand\colorframedTFconlabcolorcommand{\color{red}}
+\renewcommand\colorframedTFconlabcolorcommand{\color{purple}}
\end{verbatim}
\end{snugshade*}
-%\end{enumerate}
\begin{framed}
This is an example of usage of the environment `framed'.
@@ -203,6 +199,8 @@ example above we did:
matter of redefining the |\colorframedbordercolorcommand|
macro, which defaults to |\normalcolor|.
+\footnotesize (|\color{blue}| in source)
+\normalsize
\color{blue}
So the current frame was configured using:
\begin{verbatim}
@@ -210,29 +208,55 @@ example above we did:
\setlength{\FrameSep}{9pt}
\renewcommand\colorframedbordercolorcommand{\color{red!20}}
\end{verbatim}
+\begin{footnotesize}\normalcolor
+ The length |\FrameSep| influences also `oframed', `shaded', and `shaded*',
+ but `snugshade' and `snugshade*' employ |\fboxsep| rather.
+
+ As per |\FrameRule|, it influences `framed' and `oframed' but not
+ `titled-frame' which simply uses |\fboxrule| for its border width.\par
+\end{footnotesize}
The text colour induced from a |\color{blue}|
will not leak out to the frame or to the text following this
environment, even in case of a pagebreak.
\end{framed}
-As indicated the aim of \colorframed is not to modify the
-existing environments of \ctanpackage{framed}.sty into
-acquiring more capabilities and customizability, and we have
-indicated already the two sole customization additions. The aim
-was strictly to fix the colour leak issues.
+The aim of \colorframed regarding \ctanpackage{framed} existing
+code base is strictly limited to fixing the colour leak issues,
+there is not intent to extend the existing environments of
+\ctanpackage{framed} with additional capabilities and
+customizability: we have mentioned already the two sole
+customization additions.
\section{TODO}
-The author has developed based upon usage of
-\ctanpackage{pict2e} breakable boxes with round corners,
-background colour, optional shadow, and other goodies and is
-planning on incorporating this environment into the package.
-
+The author has developed based upon usage of \ctanpackage{pict2e}
+breakable boxes with round corners, background colour, optional
+shadow (possibly inset), and other goodies and is planning on
+incorporating this environment into the package.
+%
Of course, it will remain limited in comparison to the fully
customizable boxes provided by package \ctanpackage{tcolorbox}
but our testing showed significant speed-up in build time, which
may matter for long documents.
-Hopefully this addition will be done when time will permit.
-
+% Hopefully this addition will be done when time will permit.
+
+\thispagestyle{empty}
+\enlargethispage{2\baselineskip}
+
+\colorlet{shadecolor}{lightgray!50}
+\footnotesize
+\begin{snugshade}
+ After initial release made it to CTAN on
+ 2022/09/22 I became aware of \ctanpackage{longfbox} which
+ provides already such \ctanpackage{pict2e} breakable boxes with
+ rounded corners (even elliptical arcs), and furthermore with a
+ CSS-like interface which is exactly what I had done on my side
+ too... I need to check more \ctanpackage{longfbox} before a
+ decision is made here! Perhaps it will be better to keep
+ \colorframed as it is currently and produce another package for
+ extras such as \ctanpackage{pict2e}-based boxes or a key-value
+ interface to `inline' or `display' box macros and environments.
+\end{snugshade}
+\centerline{\hrulefill documentation ends here\hrulefill}
\end{document} \ No newline at end of file
diff --git a/macros/latex/contrib/colorframed/colorframed.sty b/macros/latex/contrib/colorframed/colorframed.sty
index db6a5d5e2f..677cdef8a2 100644
--- a/macros/latex/contrib/colorframed/colorframed.sty
+++ b/macros/latex/contrib/colorframed/colorframed.sty
@@ -1,9 +1,23 @@
-% colorframed.sty v0.9 2022/09/22
+% colorframed.sty v0.9a 2022/09/23
% Copyright (c) 2022 Jean-François Burnol
% Distributed under the terms of the LPPL 1.3c, see README.md
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{colorframed}
- [2022/09/22 v0.9 fix `framed' breakable boxes colour leaks (JFB)]
+ [2022/09/23 v0.9a fix `framed' breakable boxes colour leaks (JFB)]
+% This is actually same as 0.9 release of 2022/09/22 apart from these
+% comments:
+%
+% The analysis and original workarounds for using framed.sty
+% with colours were developed by me in some contributions I made
+% to the Sphinx project (\url{https://github.com/sphinx-doc/sphinx})
+% and I am transferring here the general idea.
+%
+% The key thing is that the boxes handled by framed.sty may
+% contain isolated colour push or colour pop. We must make
+% sure an isolated colour push, if followed by colour changes,
+% is always followed by paired ones, and never by a colour pop
+% from a colour command originated "prior".
+%
\RequirePackage{framed}
\RequirePackage{color}
% First we must make \MakeFramed/\endMakeFramed colour safe.