texlive[53356] Master/texmf-dist: circledsteps (9jan20)

commits+karl at tug.org commits+karl at tug.org
Thu Jan 9 23:12:42 CET 2020


Revision: 53356
          http://tug.org/svn/texlive?view=revision&revision=53356
Author:   karl
Date:     2020-01-09 23:12:42 +0100 (Thu, 09 Jan 2020)
Log Message:
-----------
circledsteps (9jan20)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/circledsteps/circledsteps-manual.pdf
    trunk/Master/texmf-dist/doc/latex/circledsteps/circledsteps-manual.tex
    trunk/Master/texmf-dist/tex/latex/circledsteps/circledsteps.sty

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

Modified: trunk/Master/texmf-dist/doc/latex/circledsteps/circledsteps-manual.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/circledsteps/circledsteps-manual.tex	2020-01-09 22:11:07 UTC (rev 53355)
+++ trunk/Master/texmf-dist/doc/latex/circledsteps/circledsteps-manual.tex	2020-01-09 22:12:42 UTC (rev 53356)
@@ -16,10 +16,10 @@
     urlcolor=blue,            % color of external links
 }
 \usepackage{showexpl}
-\lstset{pos=t, overhang=0pt,hsep=\columnsep,vsep=\bigskipamount,
+\lstset{pos=l, overhang=0pt,hsep=\columnsep,vsep=\bigskipamount,
     rframe=single,numbers=left,numberstyle=\tiny,numbersep=.3em, xleftmargin=1em,
     columns=flexible, language=[LaTeX]TEX,breaklines=true,
-    basicstyle=\small\ttfamily,tabsize=3, varwidth}
+    basicstyle=\small\ttfamily,tabsize=3, width=0.4\linewidth}
 \usepackage{circledsteps}
 
 \title{The \texttt{circledsteps} package: circled numbers, circled steps and more}
@@ -36,6 +36,22 @@
 
 This package provides two things: the first one, macros to generate the circled text that use the original \texttt{pict2e} method, and then a (simple, to be taken as an example) set of macro to generate sequential circled numbers that can be referenced afterward.
 
+The package loads (if not already loaded) the packages \texttt{pict2e}, \texttt{pictures}, \texttt{xcolor} and \texttt{pgfkeys} (the latter one is automatically loaded by \texttt{tikz}; you do not need \texttt{tikz} to use just \texttt{circledsteps}). Moreover, \texttt{etoolbox} is loaded to modify \texttt{pict2e} to have filled ovals.
+
+The manual is for version~\cstepsversion. The main changes between version are listed below.
+\begin{description}
+    \item[v1.2] Added optional argument to the commands and make them sensitive to math mode (thanks to \texttt{@tallmarmot} for the suggestion and example code); fixed several bugs.
+
+        Added \texttt{fill color} for the circles background.
+    \item[v1.1] Default to normal colors; keep the ``red/blue'' theme as optional.
+        If you use the package option \texttt{redblue} or \texttt{legacy} you will have the same effect than
+        \begin{lstlisting}[]
+    \pgfkeys{/csteps/inner color=red, /csteps/outer color=blue}
+        \end{lstlisting}
+    \item[v1.0] Initial release.
+\end{description}
+
+
 \section{Basic commands}
 
 The basic commands are:
@@ -42,14 +58,15 @@
 
 \begin{tabular}{>{\ttfamily\textbackslash}ll}
     \toprule
-    Circled\{\} & circled text using the package colors, text on the baseline\\
-    CircledTop\{\} & circled text using the package colors, circle on the baseline\\
-    CircledText\{\} & circled text using the current color (may fail\footnotemark{} across pages break in header or footers)\\
+    Circled[]\{\} & circled text using the package colors, text on the baseline\\
+    CircledTop[]\{\} & circled text using the package colors, circle on the baseline\\
+    CircledText[]\{\} & circled text using the current color\footnotemark{}\\
     \bottomrule
 \end{tabular}
-\footnotetext{in the sense it can select the wrong color.}
+\footnotetext{it may fail when used in headers or footers, in the sense it can select the wrong color in case of page breaks.}
 
-The parameters for the output are controlled using \texttt{pgfkeys}; you can change them with \verb|\tikzset|; you can obviously limit the effect of change using normal \LaTeX{} scoping rules.
+The parameters for the output are controlled using \texttt{pgfkeys}; you can change them with \verb|\pgfkeys| or \verb|\tikzset|; you can obviously limit the effect of change using normal \LaTeX{} scoping rules. Also, you can specify parameters (without the initial \texttt{/csteps/} as optional arguments to the commands.
+
 The pseudo-color \texttt{none} means that the current color is used for both the text and the circle.
 
 \begin{tabular}{>{\ttfamily}lll}
@@ -60,15 +77,18 @@
     /csteps/inner xsep  & horizontal spacing & 4pt\\
     /csteps/inner color & color of the text  & none\\
     /csteps/outer color & color of the circle & none\\
+    /csteps/fill color & background color of the circle & none\\
     \bottomrule
 \end{tabular}
 
-The working of the package is better explained with examples.
+The usage of the package is better explained with examples.
 
+
 \begin{LTXexample}
-This is normal text: \Circled{1} is on the baseline, \CircledTop{2} is on top.
-
-This is more evident if you have descendents, like p:\Circled{p} and \CircledTop{p}.
+This is normal text: \Circled{1} is on the baseline, \CircledTop{2} is on top.\par
+This is more evident if you have descendents, like p: \Circled{p} and \CircledTop{p}.\par
+You can set options as optional arguments, like \Circled[inner color=red]{R} or \CircledTop[outer color=green]{g}.\par
+Math mode is detected too: \Circled{A} and $\Circled{A}^{\Circled{A}}$.
 \end{LTXexample}
 
 
@@ -80,16 +100,18 @@
 \begin{LTXexample}
 Inside \texttt{tikz} they work ok:
 
+\tikzset{/csteps/outer color=green!30!black}
 \begin{tikzpicture}[scale=0.8, rotate=30,
     text width=3cm, transform shape]
-    \node [draw,color=purple]{text \Circled{1}};
+    \node [draw,color=purple]{text \Circled{1}
+        \Circled[inner color=blue]{2}};
 \end{tikzpicture}
 \end{LTXexample}
 
 
 \begin{LTXexample}
-\tikzset{/csteps/inner ysep=10pt}
-\tikzset{/csteps/inner xsep=10pt}
+\pgfkeys{/csteps/inner ysep=10pt}
+\pgfkeys{/csteps/inner xsep=10pt}
 If you like more breathing space:
 \Circled{1}  \Circled{2} \Circled{p} \Circled{200} \Circled{199}.
 \par\bigskip
@@ -96,30 +118,43 @@
 \end{LTXexample}
 
 \begin{LTXexample}
-\tikzset{/csteps/inner color=green}
-\tikzset{/csteps/outer color=gray}
+\pgfkeys{/csteps/inner color=green}
+\pgfkeys{/csteps/outer color=gray}
 If you want to change colors it's easy:
 \Circled{1}  \Circled{2} \Circled{p} \Circled{200} \Circled{199}.
 \par\bigskip
 \end{LTXexample}
 
-If you use the package option \texttt{redblue} or \texttt{legacy} you will have the same effect than
+\begin{LTXexample}
+\pgfkeys{/csteps/inner color=white}
+\pgfkeys{/csteps/outer color=red}
+\pgfkeys{/csteps/fill color=black}
+And you can have filled circles and ovals:
+\Circled{\textbf{1}} \Circled{\textbf{199}}.
+\par\bigskip
+\end{LTXexample}
 
-\begin{lstlisting}[]
-    \tikzset{/csteps/inner color=red, /csteps/outer color=blue}
-\end{lstlisting}
 
 \begin{LTXexample}
-Or even you can have inline numbers like \CircledText{1} or
+You can have inline numbers like \CircledText{1} or
 exponents\textsuperscript{\CircledText{2}} and so on.
 \textcolor{red}{They follow the current color:  \CircledText{1} and \CircledText{2} automatically,} as you can see:  \CircledText{$1+1\approx3$}. In-text circled numbers look better when a bit smaller, though, as you can see in {\small\CircledText{1}} for example.
 \end{LTXexample}
 
-No, you can't fill the circle/oval. Pull requests in that sense are welcome.
+You can have also quite nice math mode effects, thanks to suggestion from \texttt{@tallmarmot}:
 
+\begin{LTXexample}
+    \[\Circled[outer color=red]{x}\]
+    \[\int\limits_{-1}^1\!\mathrm{d}x\,f_{\ell_1}(x)\]
+    \[\Circled[outer color=blue]{\int\limits_{-1}^1}\!
+        \Circled[outer color=orange]{\mathrm{d}x}
+    f_{\Circled[outer color=red]{\ell}_{\Circled[outer color=cyan]{1}}}(x)\]
+\end{LTXexample}
+
+
 \section{Automatically generated numbers}
 
-The command \verb|\cstep| will generate a circled number, starting from \texttt{1}, that can be referenced with the normal \verb|\label| mechanism. You can reset the numbering with
+The command \verb|\cstep| will generate a circled number, starting from \texttt{1}, that can be referenced with the normal \verb|\label|/\verb|\ref| mechanism.\footnote{Notice that in the example the numbers in the references one the right are blue to to \texttt{hyperref} configuration!} You can reset the numbering with
 \verb|\startcstep|. For example:
 
 \input{ctikzexample.tex}
@@ -126,6 +161,7 @@
 
 \lstinputlisting{ctikzexample.tex}
 
+
 \bigskip
 
 \section{Personalize it!}
@@ -133,14 +169,12 @@
 The definition of \verb|CircledTexT| is simply the following one; you can get idea and define your own easily (beware of spaces at the end of the lines, though!):
 
 \begin{lstlisting}
-\newcommand{\CircledText}[1]{%
-    \begingroup
-    \tikzset{/csteps/inner color=none, /csteps/outer color=none,}
-    \Circled{#1}%
-    \endgroup
+\newcommand{\CircledText}[2][]{%
+    \csteps at CircledParamOpts{inner color=none, outer color=none, #1}{1}{#2}%
 }
 \end{lstlisting}
 
+where \verb|\CircledParamOpts| is a macro with three arguments: the first one is the list of options (without the \texttt{/csteps/} part), the second one is 1 is you want the circle content on the baseline and 0 if you want it on top of it, and finally the third one is the text to be ``circled''.
 
 Also the implementation of the \verb|\cstep| command and relatives is quite simple, and you can play a lot with it to change things (formats, colors, the type of numbering, and so on):
 

Modified: trunk/Master/texmf-dist/tex/latex/circledsteps/circledsteps.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/circledsteps/circledsteps.sty	2020-01-09 22:11:07 UTC (rev 53355)
+++ trunk/Master/texmf-dist/tex/latex/circledsteps/circledsteps.sty	2020-01-09 22:12:42 UTC (rev 53356)
@@ -1,6 +1,7 @@
 %    \begin{macrocode}
 \NeedsTeXFormat{LaTeX2e}[1996/06/01]
-\ProvidesPackage{circledsteps}[2019/11/01 v1.1 Circled steps that you can reference]
+\ProvidesPackage{circledsteps}[2020/01/08 v1.2 Circled steps that you can reference]
+\def\cstepsversion{v1.2}
 %    \end{macrocode}
 %
 % Copyright (c) 2019 Romano Giannetti
@@ -12,21 +13,31 @@
 \RequirePackage{pict2e}
 \RequirePackage{picture}
 \RequirePackage{pgfkeys} % for the pgfkeys
+\pgfkeys{/csteps/.is family}
 \pgfkeys{/csteps/inner ysep/.initial=4pt,
     /csteps/inner xsep/.initial=4pt,
     /csteps/inner color/.initial=none,
     /csteps/outer color/.initial=none,
+    /csteps/fill color/.initial=none,
 }
 \DeclareOption{redblue}{
-    \tikzset{/csteps/inner color=red, /csteps/outer color=blue}%
+    \pgfkeys{/csteps/inner color=red, /csteps/outer color=blue}%
 }
 \DeclareOption{legacy}{
-    \tikzset{/csteps/inner color=red, /csteps/outer color=blue}%
+    \pgfkeys{/csteps/inner color=red, /csteps/outer color=blue}%
 }
 
 % end of options definitions
 \ProcessOptions\relax
+% thanks @egreg https://tex.stackexchange.com/a/523450/38080
+\RequirePackage{etoolbox}
+\newif\ifcstepsfilledovals\cstepsfilledovalsfalse
+\@ifpackageloaded{picture}{\patchcmd\PcOrg@@oval}{\patchcmd\@oval}
+  {\pIIe at strokeGraph}
+  {\ifcstepsfilledovals\pIIe at fillGraph\else\pIIe at strokeGraph\fi}
+  {}{}
 
+
 \newsavebox\csteps at CBox
 \newlength\csteps at XLength \newlength\csteps at YLength \newlength\csteps at YDepth \newlength\csteps at tmplen
 \def\csteps at CircledParam#1#2{\sbox\csteps at CBox{#2}%
@@ -33,15 +44,21 @@
     \edef\csteps at none{none}%
     \edef\csteps at outercolor{\pgfkeysvalueof{/csteps/outer color}}%
     \edef\csteps at innercolor{\pgfkeysvalueof{/csteps/inner color}}%
+    \edef\csteps at fillcolor{\pgfkeysvalueof{/csteps/fill color}}%
     \csteps at XLength=\wd\csteps at CBox\advance\csteps at XLength by\pgfkeysvalueof{/csteps/inner xsep}\relax
     \csteps at tmplen=\pgfkeysvalueof{/csteps/inner ysep}\relax
     \csteps at YDepth=\dp\csteps at CBox\advance\csteps at YDepth by 0.5\csteps at tmplen\relax
     \csteps at YLength=\ht\csteps at CBox\advance\csteps at YLength by\dp\csteps at CBox\advance\csteps at YLength by\pgfkeysvalueof{/csteps/inner ysep}\relax
     % \typeout{DBG:#2\space X:\the\csteps at XLength\space Y:\the\csteps at YLength\space D:\the\csteps at YDepth}%
+    % \typeout{DBG\space inner:\csteps at innercolor\space outer:\csteps at outercolor\space ARG2:#2}%
     \raisebox{-#1\csteps at YDepth}{%
     \ifdim\csteps at XLength>\csteps at YLength
     \makebox[\csteps at XLength]{% X bigger than Y
         \makebox(0,\csteps at YLength){%
+            \ifx\csteps at fillcolor\csteps at none\else
+                \color{\csteps at fillcolor}%
+                {\cstepsfilledovalstrue\put(0,0){\oval(\csteps at XLength,\csteps at YLength)}}%
+            \fi
             \ifx\csteps at outercolor\csteps at none\else
                 \color{\csteps at outercolor}%
             \fi
@@ -49,7 +66,7 @@
         }%
     \makebox(0,\csteps at YLength){%
         \put(-.5\wd\csteps at CBox,0){%
-            \ifx\csteps at outercolor\csteps at none
+            \ifx\csteps at innercolor\csteps at none
                 #2\relax%
             \else
                 \textcolor{\csteps at innercolor}{#2}%
@@ -59,6 +76,10 @@
     \else
     \makebox[\csteps at YLength]{%
         \makebox(0,\csteps at YLength){%
+            \ifx\csteps at fillcolor\csteps at none\else
+                \color{\csteps at fillcolor}%
+                \put(0,0){\circle*{\csteps at YLength}}%
+            \fi
             \ifx\csteps at outercolor\csteps at none\else
                 \color{\csteps at outercolor}%
             \fi
@@ -66,7 +87,7 @@
         }%
     \makebox(0,\csteps at YLength){%
         \put(-.5\wd\csteps at CBox,0){%
-            \ifx\csteps at outercolor\csteps at none
+            \ifx\csteps at innercolor\csteps at none
                 #2\relax%
             \else
                 \textcolor{\csteps at innercolor}{#2}%
@@ -79,14 +100,33 @@
 %    \end{macrocode}
 % Main commands:
 %    \begin{macrocode}
-\def\Circled#1{\csteps at CircledParam{1}{#1}}
-\def\CircledTop#1{\csteps at CircledParam{0}{#1}}
-\newcommand{\CircledText}[1]{%
+\newcommand{\CircledParamOpts}[3]{%
     \begingroup
-    \tikzset{/csteps/inner color=none, /csteps/outer color=none}%
-    \Circled{#1}%
+        \pgfkeys{/csteps/.cd, #1}%
+        \ifmmode
+            \mathchoice{%
+            \csteps at CircledParam{#2}{$\displaystyle #3$}%
+            }%
+            {%
+            \csteps at CircledParam{#2}{$\textstyle #3$}%
+            }%
+            {%
+            \csteps at CircledParam{#2}{$\scriptstyle #3$}%
+            }%
+            {%
+            \csteps at CircledParam{#2}{$\scriptscriptstyle #3$}%
+            }%
+        \else
+            \csteps at CircledParam{#2}{#3}%
+        \fi
     \endgroup
 }
+
+\newcommand{\Circled}[2][]{\CircledParamOpts{#1}{1}{#2}}
+\newcommand{\CircledTop}[2][]{\CircledParamOpts{#1}{0}{#2}}
+\newcommand{\CircledText}[2][]{%
+    \CircledParamOpts{inner color=none, outer color=none, #1}{1}{#2}%
+}
 %    \end{macrocode}
 % Automatic counters code
 %    \begin{macrocode}



More information about the tex-live-commits mailing list