summaryrefslogtreecommitdiff
path: root/tex/context/modules
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2021-12-10 12:12:32 +0100
committerContext Git Mirror Bot <phg@phi-gamma.net>2021-12-10 12:12:32 +0100
commitfe714093ebb95e4a870282782e2124cff2e546e5 (patch)
tree3ffe691c3ed50e03ab62b52dc240c21caa3f4178 /tex/context/modules
parent9c5a6d1bc8ad88a74f8d5243ed057819ce6bec2d (diff)
downloadcontext-fe714093ebb95e4a870282782e2124cff2e546e5.tar.gz
2021-12-10 11:31:00
Diffstat (limited to 'tex/context/modules')
-rw-r--r--tex/context/modules/mkxl/m-circuitikz.mkxl137
-rw-r--r--tex/context/modules/mkxl/m-tikz.mkxl87
2 files changed, 181 insertions, 43 deletions
diff --git a/tex/context/modules/mkxl/m-circuitikz.mkxl b/tex/context/modules/mkxl/m-circuitikz.mkxl
new file mode 100644
index 000000000..9a105ff09
--- /dev/null
+++ b/tex/context/modules/mkxl/m-circuitikz.mkxl
@@ -0,0 +1,137 @@
+%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]
+
+\def\pgfcircversion {1.4.4}
+\def\pgfcircversiondate {2021/10/31}
+
+\usetikzlibrary[calc]
+\usetikzlibrary[arrows.meta, 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}
+
+% 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 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}}]
+
+\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/mkxl/m-tikz.mkxl b/tex/context/modules/mkxl/m-tikz.mkxl
index 5b1f6e76c..df8d44f49 100644
--- a/tex/context/modules/mkxl/m-tikz.mkxl
+++ b/tex/context/modules/mkxl/m-tikz.mkxl
@@ -22,43 +22,52 @@
\protect
\fi
-
-\pushoverloadmode
-
- \pushcatcodetable
-
- \setcatcodetable\texcatcodes
-
- \catcode`\@=11
- \catcode`\|=12
- \catcode`\!=12
-
- \input t-pgf.tex
- \input t-pgffor.tex
- \input tikz.code.tex
-
- \popcatcodetable
-
-\popoverloadmode
+\permanent\protected\def\starttikzinput
+ {\pushoverloadmode
+ \pushcatcodetable
+ \setcatcodetable\texcatcodes
+ \unprotect
+ \catcode`\@=11
+ \catcode`\|=12
+ \catcode`\!=12
+ \autoparagraphmode\zerocount}
+
+\permanent\protected\def\stoptikzinput
+ {\autoparagraphmode\plusone
+ \protect
+ \popcatcodetable
+ \popoverloadmode}
+
+\permanent\protected\def\tikzinputfile#1%
+ {\starttikzinput
+ \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}}
-% 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.
+% 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.
\overloadmode\zerocount
\permanent\protected\def\starttikzsettings
- {\pushoverloadmode}
+ {\pushoverloadmode
+ \autoparagraphmode\zerocount}
\permanent\protected\def\stoptikzsettings
- {\popoverloadmode}
+ {\autoparagraphmode\plusone
+ \popoverloadmode}
\permanent\protected\def\starttikzpicture
{\dontleavehmode
\hcontainer\bgroup
+ \autoparagraphmode\zerocount
% \pushoverloadmode
\ifdefined\PackageError\else \let\PackageError\tikzerrormessage \fi
\tikzpicture}
@@ -68,33 +77,18 @@
% \popoverloadmode
\egroup}
-% \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
+ \let\pgfcoredefined\relax
- \input pgfcore.code.tex
-
- \catcode`\@=\pgfcoreatcode
- \catcode`\|=\pgfcorebarcode
- \catcode`\!=\pgfcoreexclaimcode
+ \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
@@ -105,6 +99,13 @@
\fi
+ \let\normalusepgfmodule\usepgfmodule
+
+ \protected\def\usepgfmodule[#1]%
+ {\starttikzinput
+ \normalusepgfmodule[#1]%
+ \stoptikzinput}
+
\usepgfmodule[shapes,plot]
\fi