ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen via ntg-context <ntg-context@ntg.nl>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Cc: Hans Hagen <j.hagen@xs4all.nl>
Subject: Re: [DKIM] Re: [DKIM] circuitikz module seems broken
Date: Mon, 6 Dec 2021 20:30:25 +0100	[thread overview]
Message-ID: <86633c7c-22c5-3d8a-b1de-519224f56548@xs4all.nl> (raw)
In-Reply-To: <nycvar.YAK.7.78.908.2112061227170.2156027@nqv-guvaxcnq>

[-- Attachment #1: Type: text/plain, Size: 3520 bytes --]

On 12/6/2021 6:39 PM, Aditya Mahajan via ntg-context wrote:
> On Mon, 6 Dec 2021, Aditya Mahajan via ntg-context wrote:
>>
>> Something is still not working correctly though. With the simple example that Hans sent, I get error messages:
>>
>> tex error       > tex error on line 76 in file m-circuitikz.mkxl: Package pgfkeys Error: I do not know the key '/tikz/resistor', to which you passed 'american', and I am going to ignore it. Perhaps you misspelled it
>>
>> which are weird because tikz is looking at keys tikz/resistor rather than tikz/circuittikz/resistor. But I don't understand why this is the case.
> 
> Here is a minimal example to show the error.
> 
> \usemodule[m][tikz]
> 
> \tikzinputfile{pgfcirc.defines.tex}
> \tikzinputfile{pgfcircbipoles.tex}
> 
> \starttext
> \bgroup
> \loggingall
> \ctikzset{resistor=american}
> \egroup
> \stoptext
> 
> which gives the error
> 
> tex error       > tex error on line 10 in file ./t2.tex: Package pgfkeys Error: I do not know the key '/tikz/resistor', to which you passed 'american', and I am going to ignore it. Perhaps you misspelled it

different error here ... i need to load more files

> The file pgfcirc.defines.tex has:
> 
> \def\circuitikzbasekey{/tikz/circuitikz}
> \pgfkeys{\circuitikzbasekey/.is family}
> \def\circuitikzset{\expandafter\pgfqkeys\expandafter{\circuitikzbasekey}}
> \let\ctikzset\circuitikzset
> 
> 
> The file pgfcircbipoles.tex has the code:
> 
> \newif\ifpgf@circuit@europeanresistor
> \ctikzset{resistor/.is choice}
> \ctikzset{resistor/american/.code = \pgf@circuit@europeanresistorfalse }
> \ctikzset{resistor/european/.code = \pgf@circuit@europeanresistortrue }
> \tikzset{american resistors/.style = {\circuitikzbasekey/resistor = american}}
> \tikzset{european resistors/.style = {\circuitikzbasekey/resistor = european}}%
> 
> So, the key which is defined is \circuitikzbasekey/resistor. Not sure why pgfkeys is searching for tikz/resistor.

don't worry ... i'm even less sure ... one needs a bit different mindset 
for that kind of tex code (all can be fixed i guess but when it's not 
context specific it makes more sense to let the maintainer do it)

ths only difference wrt tikz between mkiv and mkxl is that we have 
different defaults wrt par handling (afaik both have the same catcode 
settings here) and i don't think tikz uses anything low level context

> @Hans, does the above code work correctly for you? If so, then we can wait until the next upload and test again.
with the attached:

\usemodule[m][circuitikz]

\starttext
\starttikzsettings % to be sure
\ctikzset{resistor=american}
\stoptikzsettings
\stoptext

that works (tons of files loaded) here but nothing graphic

(for those whio try: make sure that the t-* variants are gone)

i see it loading other t-* files so maybe we should more that code to 
the m-* files too ... easier to maintain that way .. and if we have a 
few (not too slow) test files in the test suite it's easier to see when 
/ why something fails

if it doesn't at your end we need to define 'how to install the right 
(circuit)tikz stuff' and 'from where'

(btw, does it all work ok in mkiv? after all, that hasn't changed for a 
while)

Hans


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
-----------------------------------------------------------------

[-- Attachment #2: m-tikz.mkxl --]
[-- Type: text/plain, Size: 3363 bytes --]

%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}\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.

\overloadmode\zerocount

\permanent\protected\def\starttikzsettings
  {\pushoverloadmode
   \autoparagraphmode\zerocount}

\permanent\protected\def\stoptikzsettings
  {\autoparagraphmode\plusone
   \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

[-- Attachment #3: m-circuitikz.mkxl --]
[-- Type: text/plain, Size: 3741 bytes --]

%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

[-- Attachment #4: Type: text/plain, Size: 493 bytes --]

___________________________________________________________________________________
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
___________________________________________________________________________________

  reply	other threads:[~2021-12-06 19:30 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-03  7:54 Jan-Erik Hägglöf via ntg-context
2021-12-03  9:49 ` [DKIM] " Hans Hagen via ntg-context
2021-12-03 13:54   ` [DKIM] " Hans Hagen via ntg-context
2021-12-03 14:17     ` skrantajanneman via ntg-context
2021-12-03 14:40       ` [DKIM] " Hans Hagen via ntg-context
2021-12-03 14:47     ` Aditya Mahajan via ntg-context
2021-12-03 18:16       ` Hans Hagen via ntg-context
2021-12-03 22:39         ` Jan-Erik Hägglöf via ntg-context
2021-12-03 23:27           ` Aditya Mahajan via ntg-context
2021-12-04  9:05             ` Henning Hraban Ramm via ntg-context
2021-12-04 21:37               ` Jan-Erik Hägglöf via ntg-context
2021-12-05 15:35                 ` [DKIM] " Hans Hagen via ntg-context
2021-12-05 20:45                   ` [DKIM] " Jan-Erik Hägglöf via ntg-context
2021-12-06  6:54                   ` [DKIM] " Aditya Mahajan via ntg-context
2021-12-06  9:02                 ` Aditya Mahajan via ntg-context
2021-12-06 17:39                   ` Aditya Mahajan via ntg-context
2021-12-06 19:30                     ` Hans Hagen via ntg-context [this message]
2021-12-06 20:49                     ` Jan-Erik Hägglöf via ntg-context
2021-12-07  8:48                       ` [DKIM] " Hans Hagen via ntg-context
2021-12-08  5:30                       ` Aditya Mahajan via ntg-context
2021-12-13 20:08                     ` Aditya Mahajan via ntg-context
2021-12-13 20:14                       ` Jan-Erik Hägglöf via ntg-context
2021-12-13 22:35                         ` Jan-Erik Hägglöf via ntg-context
2021-12-13 23:54                           ` Hans Hagen via ntg-context
2021-12-14  3:57                             ` Aditya Mahajan via ntg-context
2021-12-14 13:14                               ` Jan-Erik Hägglöf via ntg-context

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86633c7c-22c5-3d8a-b1de-519224f56548@xs4all.nl \
    --to=ntg-context@ntg.nl \
    --cc=j.hagen@xs4all.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).