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>,
	Aditya Mahajan <adityam@umich.edu>
Cc: Hans Hagen <j.hagen@xs4all.nl>
Subject: Re: circuitikz module seems broken
Date: Tue, 14 Dec 2021 00:54:44 +0100	[thread overview]
Message-ID: <41f06234-caab-6576-aa5e-8396c8ee34db@xs4all.nl> (raw)
In-Reply-To: <4D14A877-E4F8-47CB-90AF-BA65572ADA55@gmail.com>

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

Hi,

This works here:

\usemodule[circuitikz]

\starttext
     \startcircuitikz
         \draw (0,2) to[I] (2,2);
     \stopcircuitikz
     \startcircuitikz
         \draw (0,2) to[I] (2,2);
     \stopcircuitikz
\stoptext

with the attached. Make sure to put it in the regular context base path 
and run mtxrun --generate.

Aditya: can you check if we load enough? We really need to get rid of 
all these (kind of strange) t-* modules that somehow ended up in tikz 
and it's way easier and robust to occasionally add something needed to 
m-tikz than to try to catch hard-to-locate-and-fix stuff in the tikz 
distribution. If needed we can apply runtime patches too.

(nyw, it looks like tikz creates empty pfg files during a run but that's 
probbably has a reason)

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: 4087 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 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}
    \protect
\fi

\permanent\protected\def\starttikzinput
  {\pushoverloadmode
   \pushcatcodetable
   \setcatcodetable\texcatcodes
   \catcode`\@=11
   \catcode`\|=12
   \catcode`\!=12
   \autoparagraphmode\zerocount}

\permanent\protected\def\stoptikzinput
  {\autoparagraphmode\plusone
   \popcatcodetable
   \popoverloadmode}

\permanent\protected\def\tikzinputfile#1%
  {\starttikzinput
   \input{#1}\relax
   \stoptikzinput}

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

\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

\tolerant\protected\def\usepgfmodule[#1]#;#2% somehow both variants are used
  {\starttikzinput
   \normalusepgfmodule[#1#2]%
   \stoptikzinput}

\tolerant\protected\def\usepgflibrary[#1]#;#2% somehow both variants are used
  {\starttikzinput
   \normalusepgflibrary[#1#2]%
   \stoptikzinput}

\usepgfmodule[shapes]
\usepgfmodule[plot]
\usepgfmodule[matrix]
\usepgfmodule[decorations]

\stopmodule

[-- Attachment #3: m-circuitikz.mkxl --]
[-- Type: text/plain, Size: 3758 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]
\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}

% 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-13 23:54 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
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 [this message]
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=41f06234-caab-6576-aa5e-8396c8ee34db@xs4all.nl \
    --to=ntg-context@ntg.nl \
    --cc=adityam@umich.edu \
    --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).