diff options
author | Karl Berry <karl@freefriends.org> | 2020-01-09 22:12:42 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2020-01-09 22:12:42 +0000 |
commit | 5a49a16364de5bdb0b342263c630719965ca6f89 (patch) | |
tree | f4b36e642899f434bac3a9292a6d1161862f7324 /Master/texmf-dist/tex/latex/circledsteps | |
parent | 549247b6ff6c51c2403214da644afd565bfda9ba (diff) |
circledsteps (9jan20)
git-svn-id: svn://tug.org/texlive/trunk@53356 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/circledsteps')
-rw-r--r-- | Master/texmf-dist/tex/latex/circledsteps/circledsteps.sty | 60 |
1 files changed, 50 insertions, 10 deletions
diff --git a/Master/texmf-dist/tex/latex/circledsteps/circledsteps.sty b/Master/texmf-dist/tex/latex/circledsteps/circledsteps.sty index 8949ec71cb3..db49c69cbc7 100644 --- a/Master/texmf-dist/tex/latex/circledsteps/circledsteps.sty +++ b/Master/texmf-dist/tex/latex/circledsteps/circledsteps.sty @@ -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,20 +13,30 @@ \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@strokeGraph} + {\ifcstepsfilledovals\pIIe@fillGraph\else\pIIe@strokeGraph\fi} + {}{} + \newsavebox\csteps@CBox \newlength\csteps@XLength \newlength\csteps@YLength \newlength\csteps@YDepth \newlength\csteps@tmplen @@ -33,15 +44,21 @@ \edef\csteps@none{none}% \edef\csteps@outercolor{\pgfkeysvalueof{/csteps/outer color}}% \edef\csteps@innercolor{\pgfkeysvalueof{/csteps/inner color}}% + \edef\csteps@fillcolor{\pgfkeysvalueof{/csteps/fill color}}% \csteps@XLength=\wd\csteps@CBox\advance\csteps@XLength by\pgfkeysvalueof{/csteps/inner xsep}\relax \csteps@tmplen=\pgfkeysvalueof{/csteps/inner ysep}\relax \csteps@YDepth=\dp\csteps@CBox\advance\csteps@YDepth by 0.5\csteps@tmplen\relax \csteps@YLength=\ht\csteps@CBox\advance\csteps@YLength by\dp\csteps@CBox\advance\csteps@YLength by\pgfkeysvalueof{/csteps/inner ysep}\relax % \typeout{DBG:#2\space X:\the\csteps@XLength\space Y:\the\csteps@YLength\space D:\the\csteps@YDepth}% + % \typeout{DBG\space inner:\csteps@innercolor\space outer:\csteps@outercolor\space ARG2:#2}% \raisebox{-#1\csteps@YDepth}{% \ifdim\csteps@XLength>\csteps@YLength \makebox[\csteps@XLength]{% X bigger than Y \makebox(0,\csteps@YLength){% + \ifx\csteps@fillcolor\csteps@none\else + \color{\csteps@fillcolor}% + {\cstepsfilledovalstrue\put(0,0){\oval(\csteps@XLength,\csteps@YLength)}}% + \fi \ifx\csteps@outercolor\csteps@none\else \color{\csteps@outercolor}% \fi @@ -49,7 +66,7 @@ }% \makebox(0,\csteps@YLength){% \put(-.5\wd\csteps@CBox,0){% - \ifx\csteps@outercolor\csteps@none + \ifx\csteps@innercolor\csteps@none #2\relax% \else \textcolor{\csteps@innercolor}{#2}% @@ -59,6 +76,10 @@ \else \makebox[\csteps@YLength]{% \makebox(0,\csteps@YLength){% + \ifx\csteps@fillcolor\csteps@none\else + \color{\csteps@fillcolor}% + \put(0,0){\circle*{\csteps@YLength}}% + \fi \ifx\csteps@outercolor\csteps@none\else \color{\csteps@outercolor}% \fi @@ -66,7 +87,7 @@ }% \makebox(0,\csteps@YLength){% \put(-.5\wd\csteps@CBox,0){% - \ifx\csteps@outercolor\csteps@none + \ifx\csteps@innercolor\csteps@none #2\relax% \else \textcolor{\csteps@innercolor}{#2}% @@ -79,14 +100,33 @@ % \end{macrocode} % Main commands: % \begin{macrocode} -\def\Circled#1{\csteps@CircledParam{1}{#1}} -\def\CircledTop#1{\csteps@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@CircledParam{#2}{$\displaystyle #3$}% + }% + {% + \csteps@CircledParam{#2}{$\textstyle #3$}% + }% + {% + \csteps@CircledParam{#2}{$\scriptstyle #3$}% + }% + {% + \csteps@CircledParam{#2}{$\scriptscriptstyle #3$}% + }% + \else + \csteps@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} |