On 12/3/2021 3:47 PM, Aditya Mahajan via ntg-context wrote:
On Fri, 3 Dec 2021, Hans Hagen via ntg-context wrote:
On 12/3/2021 10:49 AM, Hans Hagen via ntg-context wrote:
I’ve been struggeling with the circuitikz module since my upgrade to
LMTX.
btw, We can have more 'catches' in the loader (t) module if needed. In
any case, also check if things work with mkiv.
I tested the example on mkiv, I got error that dipchip and fliflop JK are not defined.
The file compiles if I comment those out. But in LMTX, I also get a "missing
semicolon" error. There is also this warning, which may have something to do with
what is going wrong:
system > module wrapping error in 'tikz'
The error appears to be related to keyword arguments. The following example
works:
\usemodule[circuitikz]
\starttext
\startcircuitikz
\draw (0,2) to[I] (2,2) ;
\stopcircuitikz
\stoptext
But this does not:
\usemodule[circuitikz]
\starttext
\startcircuitikz
\draw (0,2) to[I=1] (2,2) ;
\stopcircuitikz
\stoptext
can you test the attached ... this works here
\usemodule[circuitikz]
% \usemodule[tikz]
\starttext
\starttikzpicture
\draw (0,2) -- (2,2) ;
\stoptikzpicture
\startcircuitikz
\draw (0,2) to[I=1] (2,2) ;
\stopcircuitikz
\stoptext
Hans
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
%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
%D \module
%D [ file=m-tikz,
%D version=2021.07.12,
%D title=\CONTEXT\ Extra Modules,
%D subtitle=TIKZ 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-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.)
\ifdefined\pdflastxpos \else
\unprotect
\frozen\overloaded\protected\def\pdflastxpos{\numexpr\clf_lastxpos\relax}
\frozen\overloaded\protected\def\pdflastypos{\numexpr\clf_lastypos\relax}
\protect
\fi
\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}
\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.
\overloadmode\zerocount
\permanent\protected\def\starttikzsettings
{\pushoverloadmode}
\permanent\protected\def\stoptikzsettings
{\popoverloadmode}
\permanent\protected\def\starttikzpicture
{\dontleavehmode
\hcontainer\bgroup
\autoparagraphmode\zerocount
% \pushoverloadmode
\ifdefined\PackageError\else \let\PackageError\tikzerrormessage \fi
\tikzpicture}
\permanent\protected\def\stoptikzpicture
{\endtikzpicture
% \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
\fi
\let\normalusepgfmodule\usepgfmodule
\protected\def\usepgfmodule[#1]%
{\starttikzinput
\normalusepgfmodule[#1]%
\stoptikzinput}
\usepgfmodule[shapes,plot]
\fi
\stopmodule
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the
Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___________________________________________________________________________________