diff options
Diffstat (limited to 'tex/context/modules')
-rw-r--r-- | tex/context/modules/mkiv/m-circuitikz.mkiv | 138 | ||||
-rw-r--r-- | tex/context/modules/mkiv/m-tikz.mkiv | 155 | ||||
-rw-r--r-- | tex/context/modules/mkxl/m-circuitikz.mkxl | 89 | ||||
-rw-r--r-- | tex/context/modules/mkxl/m-tikz.mkxl | 87 |
4 files changed, 326 insertions, 143 deletions
diff --git a/tex/context/modules/mkiv/m-circuitikz.mkiv b/tex/context/modules/mkiv/m-circuitikz.mkiv new file mode 100644 index 000000000..27ef72642 --- /dev/null +++ b/tex/context/modules/mkiv/m-circuitikz.mkiv @@ -0,0 +1,138 @@ +%D \module +%D [ file=m-circuitikz, +%D version=2021.12.03, +%D title=\CONTEXT\ Extra Modules, +%D subtitle=CURCUITIKZ support, +%D author=Hans Hagen, +%D date=\currentdate, +%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}] +%C +%C This module is part of the \CONTEXT\ macro||package and is +%C therefore copyrighted by \PRAGMA. See mreadme.pdf for +%C details. + +%D A fixed variant of the t-curcuitikz module distributed with tikz. This one +%D is for \LMTX. + +\usemodule[m][tikz] + +\startmodule[circuitikz] + +\usetikzlibrary[calc] +\usetikzlibrary[arrows.meta] +\usetikzlibrary[bending] +\usetikzlibrary[fpu] % may be needed for use fpu reciprocal (v1.0.1) + +\tikzinputfile{pgfcirc.defines.tex} +\tikzinputfile{pgfcircutils.tex} +\tikzinputfile{pgfcircpath.tex} + +\tikzinputfile{pgfcircshapes.tex} +\tikzinputfile{pgfcircmonopoles.tex} +\tikzinputfile{pgfcircbipoles.tex} +\tikzinputfile{pgfcirctripoles.tex} +\tikzinputfile{pgfcircquadpoles.tex} +\tikzinputfile{pgfcircmultipoles.tex} + +\tikzinputfile{pgfcirclabel.tex} +\tikzinputfile{pgfcircvoltage.tex} +\tikzinputfile{pgfcirccurrent.tex} +\tikzinputfile{pgfcircflow.tex} + +\ifdefined\pgfcircversion \else \def\pgfcircversion {0.0.0} \fi +\ifdefined\pgfcircversiondate \else \def\pgfcircversiondate {1010/01/01} \fi + +% defaults + +\setupmodule + [current=european, + voltage=european, + resistor=american, + inductor=cute, + logic=american, + %siunitx=true, + arrowmos=false] + +% can be done nicer ... todo + +\processaction + [\currentmoduleparameter{voltage}] + [european=>\ctikzset{voltage=european}, + american=>\ctikzset{voltage=american}] + +\processaction + [\currentmoduleparameter{current}] + [european=>\ctikzset{current=european}, + american=>\ctikzset{current=american}] + +\processaction + [\currentmoduleparameter{label}] + [straight=>\ctikzset{label/align=straight}, + align=>\ctikzset{label/align=rotate}, + smart=>\ctikzset{label/align=smart}] + +\processaction + [\currentmoduleparameter{resistor}] + [european=>\ctikzset{resistor=european}, + american=>\ctikzset{resistor=american}] + +\processaction + [\currentmoduleparameter{inductor}] + [european=>\ctikzset{inductor=european}, + american=>\ctikzset{inductor=american}, + cute=>\ctikzset{inductor=cute}] + +\processaction + [\currentmoduleparameter{diode}] + [ full=>\ctikzset{diode=full}, + empty=>\ctikzset{diode=empty}] + +\processaction + [\currentmoduleparameter{logic}] + [european=>\ctikzset{logic ports=european}, + american=>\ctikzset{logic ports=american}] + +% hm, we have units since '97 so one can load the units module in mkii or +% assume it is present (mkiv and therefore lmtx) +% +% \processaction +% [\currentmoduleparameter{siunitx}] +% [true=>\def\SI #1#2{#1\,#2} +% \def\ampere {\rm{A}} +% \def\volt {\rm{V}} +% \def\ohm {\Omega} +% \def\siemens {\rm{S}} +% \def\farad {\rm{F}} +% \def\henry {\rm{H}} +% \def\second {\rm{s}} +% \def\coulomb {\rm{C}} +% \def\siemens {\rm{S}} +% \def\radians {\rm{rad}} +% \def\milli {\rm{m}} +% \def\micro {\mu} +% \def\nano {\rm{n}} +% \def\pico {\rm{p}} +% \def\kilo {\rm{k}} +% \def\mega {\rm{M}} +% \def\giga {\rm{G}} +% \def\tera {\rm{T}}] + +\unprotect + +\processaction + [\currentmoduleparameter{arrowmos}] + [true=>\pgf@circuit@mos@arrowstrue, + false=>\pgf@circuit@mos@arrowsfalse] + +\protect + +\ctikzset{tripoles/op amp/font/.initial=\switchtobodyfont[small]} + +\aliased\let\stopcircuitikz\relax + +\permanent\protected\def\startcircuitikz#1\stopcircuitikz + {\starttikzpicture#1\stoptikzpicture} + +\stopmodule + +\endinput diff --git a/tex/context/modules/mkiv/m-tikz.mkiv b/tex/context/modules/mkiv/m-tikz.mkiv index 536ab554a..221c074ad 100644 --- a/tex/context/modules/mkiv/m-tikz.mkiv +++ b/tex/context/modules/mkiv/m-tikz.mkiv @@ -11,86 +11,115 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -%D A fixed variant of the t-tikz module distributed with tikz. For -%D practical reasons per 2021 we split the module for \MKIV\ and -%D \LMTX. (Maybe some day I'll optimize TIKZ a bit.) +%D A fixed variant of the t-tikz module distributed with tikz. For practical reasons +%D per 2021 we split the module for \MKIV\ and \LMTX. (Maybe some day I'll optimize +%D TIKZ a bit.) +%D +%D All these t-* modules in the tikz distribution make no sense as we can just load +%D them here which is way cleaner. There is also some mkii filename mapping going on +%D that is not needed on todays systems (windows has no 8.3 limitation and on unix +%D tds finally adopted a case insensitive approach.) + +%D Just in case someone does a hard input ... + +\ifdefined\pgfdefined \endinput \fi +\ifdefined\pgfcoredefined\endinput \fi + +%D ... but normally we end up here: + +\startmodule[tikz] \ifdefined\pdflastxpos \else \unprotect - \frozen\overloaded\protected\def\pdflastxpos{\numexpr\clf_lastxpos\relax} - \frozen\overloaded\protected\def\pdflastypos{\numexpr\clf_lastypos\relax} + \unexpanded\def\pdflastxpos{\numexpr\clf_lastxpos\relax} + \unexpanded\def\pdflastypos{\numexpr\clf_lastypos\relax} \protect \fi -\pushcatcodetable - - \setcatcodetable\texcatcodes - - \catcode`\@=11 - \catcode`\|=12 - \catcode`\!=12 +\permanent\protected\def\starttikzinput + {\pushcatcodetable + \setcatcodetable\texcatcodes + \catcode`\@=11 + \catcode`\|=12 + \catcode`\!=12 + \relax} - \input t-pgf.tex - \input t-pgffor.tex - \input tikz.code.tex +\permanent\protected\def\stoptikzinput + {\relax + \popcatcodetable} -\popcatcodetable +\permanent\protected\def\tikzinputfile#1% + {\starttikzinput + \input{#1}\relax + \stoptikzinput} \permanent\protected\def\tikzerrormessage#1#2#3% {\writestatus{#1}{#2}} -\let\starttikzsettings\relax -\let\stoptikzsettings \relax +% For now we need this but we need to educate the user to wrap settings in the +% wrappers. So some day the next line will go. I need to check what commands are +% possible outside a picture. + +\protected\def\starttikzsettings + {} + +\protected\def\stoptikzsettings + {} \protected\def\starttikzpicture - {% \dontleavehmode - \begingroup + {\dontleavehmode + \hbox\bgroup \ifdefined\PackageError\else \let\PackageError\tikzerrormessage \fi \tikzpicture} -\protected\def\stoptikzpicture +\permanent\protected\def\stoptikzpicture {\endtikzpicture - \endgroup} - -% \input t-pgf.tex - -\ifx\pgfdefined\undefined - - \let\pgfdefined\relax - - % \input t-pgfcor.tex - - \ifx\pgfcoredefined\undefined - - \let\pgfcoredefined=\relax - - \input t-pgfsys.tex - - \edef\pgfcoreatcode {\the\catcode`\@} - \edef\pgfcorebarcode {\the\catcode`\|} - \edef\pgfcoreexclaimcode{\the\catcode`\!} - - \catcode`\@=11 - \catcode`\|=12 - \catcode`\!=12 - - \input pgfcore.code.tex - - \catcode`\@=\pgfcoreatcode - \catcode`\|=\pgfcorebarcode - \catcode`\!=\pgfcoreexclaimcode - - \let\startpgfpicture \pgfpicture \let\stoppgfpicture \endpgfpicture - \let\startpgfscope \pgfscope \let\stoppgfscope \endpgfscope - \let\startpgflowlevelscope \pgflowlevelscope \let\stoppgflowlevelscope \endpgflowlevelscope - \let\startpgfinterruptpath \pgfinterruptpath \let\stoppgfinterruptpath \endpgfinterruptpath - \let\startpgfinterruptpicture \pgfinterruptpicture \let\stoppgfinterruptpicture \endpgfinterruptpicture - \let\startpgfinterruptboundingbox\pgfinterruptboundinbox \let\stoppgfinterruptboudingbox\endpgfinterruptboundingbox - - \fi - - \usepgfmodule[shapes,plot] - -\fi + \egroup} + +\let\pgfdefined \relax +\let\pgfcoredefined\relax + +\tikzinputfile{pgfutil-common.tex} +\tikzinputfile{pgfutil-context.def} +\tikzinputfile{pgfrcs.code.tex} +\tikzinputfile{pgfsys.code.tex} +\tikzinputfile{pgfkeys.code.tex} +\tikzinputfile{pgfsyssoftpath.code.tex} +\tikzinputfile{pgfsysprotocol.code.tex} +\tikzinputfile{pgfcore.code.tex} +\tikzinputfile{pgffor.code.tex} +\tikzinputfile{pgfmoduleplot.code.tex} +\tikzinputfile{tikz.code.tex} + +\let\startpgfpicture \pgfpicture \let\stoppgfpicture \endpgfpicture +\let\startpgfscope \pgfscope \let\stoppgfscope \endpgfscope +\let\startpgflowlevelscope \pgflowlevelscope \let\stoppgflowlevelscope \endpgflowlevelscope +\let\startpgfinterruptpath \pgfinterruptpath \let\stoppgfinterruptpath \endpgfinterruptpath +\let\startpgfinterruptpicture \pgfinterruptpicture \let\stoppgfinterruptpicture \endpgfinterruptpicture +\let\startpgfinterruptboundingbox\pgfinterruptboundinbox \let\stoppgfinterruptboudingbox\endpgfinterruptboundingbox + +\let\normalusepgfmodule \usepgfmodule +\let\normalusepgflibrary\usepgflibrary + +\unexpanded\def\usepgfmodule {\doifelsenextoptional\dousepgfmoduleyes \dousepgfmodulenop } +\unexpanded\def\usepgflibrary{\doifelsenextoptional\dousepgflibraryyes\dousepgflibrarynop} + +\def\dousepgfmodulenop #1{\dousepgfmoduleyes [#1]} +\def\dousepgflibrarynop#1{\dousepgflibraryyes[#1]} + +\def\dousepgfmoduleyes[#1]% + {\starttikzinput + \normalusepgfmodule[#1]% + \stoptikzinput} + +\def\dousepgflibraryyes[#1]% + {\starttikzinput + \normalusepgflibrary[#1]% + \stoptikzinput} + +\usepgfmodule[shapes] +\usepgfmodule[plot] +\usepgfmodule[matrix] +\usepgfmodule[decorations] \stopmodule diff --git a/tex/context/modules/mkxl/m-circuitikz.mkxl b/tex/context/modules/mkxl/m-circuitikz.mkxl index 9a105ff09..27ef72642 100644 --- a/tex/context/modules/mkxl/m-circuitikz.mkxl +++ b/tex/context/modules/mkxl/m-circuitikz.mkxl @@ -18,11 +18,9 @@ \startmodule[circuitikz] -\def\pgfcircversion {1.4.4} -\def\pgfcircversiondate {2021/10/31} - \usetikzlibrary[calc] -\usetikzlibrary[arrows.meta, bending] +\usetikzlibrary[arrows.meta] +\usetikzlibrary[bending] \usetikzlibrary[fpu] % may be needed for use fpu reciprocal (v1.0.1) \tikzinputfile{pgfcirc.defines.tex} @@ -41,6 +39,9 @@ \tikzinputfile{pgfcirccurrent.tex} \tikzinputfile{pgfcircflow.tex} +\ifdefined\pgfcircversion \else \def\pgfcircversion {0.0.0} \fi +\ifdefined\pgfcircversiondate \else \def\pgfcircversiondate {1010/01/01} \fi + % defaults \setupmodule @@ -49,7 +50,7 @@ resistor=american, inductor=cute, logic=american, - siunitx=true, + %siunitx=true, arrowmos=false] % can be done nicer ... todo @@ -61,60 +62,60 @@ \processaction [\currentmoduleparameter{current}] - [european=>\ctikzset{ current=european}, - american=>\ctikzset{ current=american}] + [european=>\ctikzset{current=european}, + american=>\ctikzset{current=american}] \processaction [\currentmoduleparameter{label}] - [straight=>\ctikzset{label/align = straight}, - align=>\ctikzset{label/align = rotate}, - smart=>\ctikzset{label/align = smart}] + [straight=>\ctikzset{label/align=straight}, + align=>\ctikzset{label/align=rotate}, + smart=>\ctikzset{label/align=smart}] \processaction [\currentmoduleparameter{resistor}] - [european=>\ctikzset{ resistor=european}, - american=>\ctikzset{ resistor=american}] + [european=>\ctikzset{resistor=european}, + american=>\ctikzset{resistor=american}] \processaction [\currentmoduleparameter{inductor}] - [european=>\ctikzset{ inductor=european}, - american=>\ctikzset{ inductor=american}, - cute=>\ctikzset{ inductor=cute}] + [european=>\ctikzset{inductor=european}, + american=>\ctikzset{inductor=american}, + cute=>\ctikzset{inductor=cute}] \processaction [\currentmoduleparameter{diode}] - [full=>\ctikzset{ diode=full}, - empty=>\ctikzset{ diode=empty}] + [ full=>\ctikzset{diode=full}, + empty=>\ctikzset{diode=empty}] \processaction [\currentmoduleparameter{logic}] - [european=>\ctikzset{ logic ports=european}, - american=>\ctikzset{ logic ports=american}] - -% hm, we have units built in and in mkii one can load the units module -% ... always been so ... - -\processaction - [\currentmoduleparameter{siunitx}] - [true=>\def\SI #1#2{#1\,#2} - \def\ampere {\rm{A}} - \def\volt {\rm{V}} - \def\ohm {\Omega} - \def\siemens {\rm{S}} - \def\farad {\rm{F}} - \def\henry {\rm{H}} - \def\second {\rm{s}} - \def\coulomb {\rm{C}} - \def\siemens {\rm{S}} - \def\radians {\rm{rad}} - \def\milli {\rm{m}} - \def\micro {\mu} - \def\nano {\rm{n}} - \def\pico {\rm{p}} - \def\kilo {\rm{k}} - \def\mega {\rm{M}} - \def\giga {\rm{G}} - \def\tera {\rm{T}}] + [european=>\ctikzset{logic ports=european}, + american=>\ctikzset{logic ports=american}] + +% hm, we have units since '97 so one can load the units module in mkii or +% assume it is present (mkiv and therefore lmtx) +% +% \processaction +% [\currentmoduleparameter{siunitx}] +% [true=>\def\SI #1#2{#1\,#2} +% \def\ampere {\rm{A}} +% \def\volt {\rm{V}} +% \def\ohm {\Omega} +% \def\siemens {\rm{S}} +% \def\farad {\rm{F}} +% \def\henry {\rm{H}} +% \def\second {\rm{s}} +% \def\coulomb {\rm{C}} +% \def\siemens {\rm{S}} +% \def\radians {\rm{rad}} +% \def\milli {\rm{m}} +% \def\micro {\mu} +% \def\nano {\rm{n}} +% \def\pico {\rm{p}} +% \def\kilo {\rm{k}} +% \def\mega {\rm{M}} +% \def\giga {\rm{G}} +% \def\tera {\rm{T}}] \unprotect diff --git a/tex/context/modules/mkxl/m-tikz.mkxl b/tex/context/modules/mkxl/m-tikz.mkxl index df8d44f49..394709c3c 100644 --- a/tex/context/modules/mkxl/m-tikz.mkxl +++ b/tex/context/modules/mkxl/m-tikz.mkxl @@ -11,9 +11,23 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -%D A fixed variant of the t-tikz module distributed with tikz. For -%D practical reasons per 2021 we split the module for \MKIV\ and -%D \LMTX. (Maybe some day I'll optimize TIKZ a bit.) +%D A fixed variant of the t-tikz module distributed with tikz. For practical reasons +%D per 2021 we split the module for \MKIV\ and \LMTX. (Maybe some day I'll optimize +%D TIKZ a bit.) +%D +%D All these t-* modules in the tikz distribution make no sense as we can just load +%D them here which is way cleaner. There is also some mkii filename mapping going on +%D that is not needed on todays systems (windows has no 8.3 limitation and on unix +%D tds finally adopted a case insensitive approach.) + +%D Just in case someone does a hard input ... + +\ifdefined\pgfdefined \endinput \fi +\ifdefined\pgfcoredefined\endinput \fi + +%D ... but normally we end up here: + +\startmodule[tikz] \ifdefined\pdflastxpos \else \unprotect @@ -26,7 +40,6 @@ {\pushoverloadmode \pushcatcodetable \setcatcodetable\texcatcodes - \unprotect \catcode`\@=11 \catcode`\|=12 \catcode`\!=12 @@ -34,7 +47,6 @@ \permanent\protected\def\stoptikzinput {\autoparagraphmode\plusone - \protect \popcatcodetable \popoverloadmode} @@ -43,10 +55,6 @@ \input{#1}\relax \stoptikzinput} -\tikzinputfile{t-pgf.tex} -\tikzinputfile{t-pgffor.tex} -\tikzinputfile{tikz.code.tex} - \permanent\protected\def\tikzerrormessage#1#2#3% {\writestatus{#1}{#2}} @@ -77,37 +85,44 @@ % \popoverloadmode \egroup} -\ifx\pgfdefined\undefined - - \let\pgfdefined\relax - - \ifx\pgfcoredefined\undefined - - \let\pgfcoredefined\relax - - \tikzinputfile{pgfsys.code.tex} - \tikzinputfile{pgfsyssoftpath.code.tex} - \tikzinputfile{pgfsysprotocol.code.tex} - \tikzinputfile{pgfcore.code.tex} - - \let\startpgfpicture \pgfpicture \let\stoppgfpicture \endpgfpicture - \let\startpgfscope \pgfscope \let\stoppgfscope \endpgfscope - \let\startpgflowlevelscope \pgflowlevelscope \let\stoppgflowlevelscope \endpgflowlevelscope - \let\startpgfinterruptpath \pgfinterruptpath \let\stoppgfinterruptpath \endpgfinterruptpath - \let\startpgfinterruptpicture \pgfinterruptpicture \let\stoppgfinterruptpicture \endpgfinterruptpicture - \let\startpgfinterruptboundingbox\pgfinterruptboundinbox \let\stoppgfinterruptboudingbox\endpgfinterruptboundingbox +\let\pgfdefined \relax +\let\pgfcoredefined\relax + +\tikzinputfile{pgfutil-common.tex} +\tikzinputfile{pgfutil-context.def} +\tikzinputfile{pgfrcs.code.tex} +\tikzinputfile{pgfsys.code.tex} +\tikzinputfile{pgfkeys.code.tex} +\tikzinputfile{pgfsyssoftpath.code.tex} +\tikzinputfile{pgfsysprotocol.code.tex} +\tikzinputfile{pgfcore.code.tex} +\tikzinputfile{pgffor.code.tex} +\tikzinputfile{pgfmoduleplot.code.tex} +\tikzinputfile{tikz.code.tex} - \fi +\let\startpgfpicture \pgfpicture \let\stoppgfpicture \endpgfpicture +\let\startpgfscope \pgfscope \let\stoppgfscope \endpgfscope +\let\startpgflowlevelscope \pgflowlevelscope \let\stoppgflowlevelscope \endpgflowlevelscope +\let\startpgfinterruptpath \pgfinterruptpath \let\stoppgfinterruptpath \endpgfinterruptpath +\let\startpgfinterruptpicture \pgfinterruptpicture \let\stoppgfinterruptpicture \endpgfinterruptpicture +\let\startpgfinterruptboundingbox\pgfinterruptboundinbox \let\stoppgfinterruptboudingbox\endpgfinterruptboundingbox - \let\normalusepgfmodule\usepgfmodule +\let\normalusepgfmodule\usepgfmodule +\let\normalusepgflibrary\usepgflibrary - \protected\def\usepgfmodule[#1]% - {\starttikzinput - \normalusepgfmodule[#1]% - \stoptikzinput} +\tolerant\protected\def\usepgfmodule[#1]#;#2% somehow both variants are used + {\starttikzinput + \normalusepgfmodule[#1#2]% + \stoptikzinput} - \usepgfmodule[shapes,plot] +\tolerant\protected\def\usepgflibrary[#1]#;#2% somehow both variants are used + {\starttikzinput + \normalusepgflibrary[#1#2]% + \stoptikzinput} -\fi +\usepgfmodule[shapes] +\usepgfmodule[plot] +\usepgfmodule[matrix] +\usepgfmodule[decorations] \stopmodule |