Re: [NTG-context] circuitikz module seems broken
HI ALL! Finally it worked after complete reinstall Tikz circuitikz pgfplots from ctan, updated LMTX to latest 2021.12.10 And replaced m-tikz.mkxl and m-circuitikz.mkxl with the attached files from Hans. test2.log Description: Binary data Fingers crossed and praying and impressive help from Hans and Aditya Many thanks Sincerely Jan-Erik > 14 dec. 2021 kl. 04:57 skrev Aditya Mahajan via ntg-context > : > > I tested with my course assignments (simple tikz block diagrams, lots of > pgdplots code) and everything works correctly. I haven't tested circuitikz; > the simple example fails and I am trying to understand why that is happening. > >> Aditya: can you check if we load enough? > > I believe so. This is what my notes say (it is no fun to trace down these > files): > > % Order in which files are loaded > % 1. t-tikz > % 1.1 t-pgf > % 1.1.1 t-pgfcor > % 1.1.1.1 t-pgfsys > % 1.1.1.1.1 t-pgfrcs > % 1.1.1.1.1.1 t-pgfmod % Ignore > % 1.1.1.1.1.2 pgfutil-common.tex(1) > % 1.1.1.1.1.3 pgfutil-context.def (2) > % 1.1.1.1.1.4 pgfrcs.code.tex (3) > % 1.1.1.1.2 pgfsys.code.tex (4) > % 1.1.1.1.3 pgfsyssoftpath.code.tex (5) > % 1.1.1.1.4 pgfsysprotocol.code.tex (6) > % 1.1.1.2 pgfcore.code.tex (7) > % 1.1.2 \usepgfmodule[shapes,plot] (8) > % 1.2 t-pgffor > % 1.2.1 t-pgfrcs (already loaded) > % 1.2.2 t-pgfkey > % 1.2.2.1 pgfkeys.code.tex (9) > % 1.2.3 pgffor.code.tex(10) > % 1.3 tikz.code.tex(11) > > You also have pgfmoduleplot.code.tex, which I had missed. > >> 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. > > Agreed. I believe that the pgf module provides so many modules as a means to > be modular. For example, it possible to use `pgffor` module to get the for > loop syntax; or load `pgfkey` to get the key-value arguments, etc. But each > of these t-* files has so much boilerplate code, so I like your method > better. > >> (nyw, it looks like tikz creates empty pfg files during a run but that's >> probbably has a reason) > > tikz's ChangeLog has the following entries: > > 2007-01-18: >- Fixed .aux problems in plain and ConTeXt mode. Using .pgf as > extension now. > > Grepping the source for `.pgf` gives: > > tex/generic/pgf/utilities/pgfutil-context.def: > \pgfutil@IfFileExists{\jobname.pgf}{\input \jobname.pgf\relax}{} > tex/generic/pgf/utilities/pgfutil-context.def: \immediate\csname > openout\endcsname\pgfutil@auxout\jobname.pgf\relax > tex/generic/pgf/utilities/pgfutil-plain.def: > \pgfutil@IfFileExists{\jobname.pgf}{\input \jobname.pgf\relax}{} > tex/generic/pgf/utilities/pgfutil-plain.def: \immediate\csname > openout\endcsname\pgfutil@auxout\jobname.pgf > > The file handle \pgfutil@auxout is used in the macro \pgfutil@writetoaux > which gets used in the driver files to write absolute positioning stuff to > file. For example, pgfsys-luatex.def has: > > \def\pgfsys@markposition#1{% > \savepos% > \edef\pgf@temp{#1}% > \expandafter\pgfutil@writetoaux\expandafter{% > > \expandafter\noexpand\expandafter\pgfsyspdfmark\expandafter{\pgf@temp}{\the\lastxpos}{\the\lastypos}}% > } > > This can easily be stored in the tuc file using two-pass data, but I don't > use this feature of tikz, so don't have examples to test this. > > @HenriMenke: Do you know if it is save to not create the `.pgf` file and > rewrite the above macro to read store the \pgfsyspdfmark table in the `.tuc` > file? > > > > ___ > 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 > ___ ___ 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 ___
Re: [NTG-context] circuitikz module seems broken
I tested with my course assignments (simple tikz block diagrams, lots of pgdplots code) and everything works correctly. I haven't tested circuitikz; the simple example fails and I am trying to understand why that is happening. > Aditya: can you check if we load enough? I believe so. This is what my notes say (it is no fun to trace down these files): % Order in which files are loaded % 1. t-tikz % 1.1 t-pgf % 1.1.1 t-pgfcor % 1.1.1.1 t-pgfsys % 1.1.1.1.1 t-pgfrcs % 1.1.1.1.1.1 t-pgfmod % Ignore % 1.1.1.1.1.2 pgfutil-common.tex(1) % 1.1.1.1.1.3 pgfutil-context.def (2) % 1.1.1.1.1.4 pgfrcs.code.tex (3) % 1.1.1.1.2 pgfsys.code.tex (4) % 1.1.1.1.3 pgfsyssoftpath.code.tex (5) % 1.1.1.1.4 pgfsysprotocol.code.tex (6) % 1.1.1.2 pgfcore.code.tex (7) % 1.1.2 \usepgfmodule[shapes,plot] (8) % 1.2 t-pgffor % 1.2.1 t-pgfrcs (already loaded) % 1.2.2 t-pgfkey % 1.2.2.1 pgfkeys.code.tex (9) % 1.2.3 pgffor.code.tex(10) % 1.3 tikz.code.tex(11) You also have pgfmoduleplot.code.tex, which I had missed. > 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. Agreed. I believe that the pgf module provides so many modules as a means to be modular. For example, it possible to use `pgffor` module to get the for loop syntax; or load `pgfkey` to get the key-value arguments, etc. But each of these t-* files has so much boilerplate code, so I like your method better. > (nyw, it looks like tikz creates empty pfg files during a run but that's > probbably has a reason) tikz's ChangeLog has the following entries: 2007-01-18: - Fixed .aux problems in plain and ConTeXt mode. Using .pgf as extension now. Grepping the source for `.pgf` gives: tex/generic/pgf/utilities/pgfutil-context.def: \pgfutil@IfFileExists{\jobname.pgf}{\input \jobname.pgf\relax}{} tex/generic/pgf/utilities/pgfutil-context.def: \immediate\csname openout\endcsname\pgfutil@auxout\jobname.pgf\relax tex/generic/pgf/utilities/pgfutil-plain.def: \pgfutil@IfFileExists{\jobname.pgf}{\input \jobname.pgf\relax}{} tex/generic/pgf/utilities/pgfutil-plain.def: \immediate\csname openout\endcsname\pgfutil@auxout\jobname.pgf The file handle \pgfutil@auxout is used in the macro \pgfutil@writetoaux which gets used in the driver files to write absolute positioning stuff to file. For example, pgfsys-luatex.def has: \def\pgfsys@markposition#1{% \savepos% \edef\pgf@temp{#1}% \expandafter\pgfutil@writetoaux\expandafter{% \expandafter\noexpand\expandafter\pgfsyspdfmark\expandafter{\pgf@temp}{\the\lastxpos}{\the\lastypos}}% } This can easily be stored in the tuc file using two-pass data, but I don't use this feature of tikz, so don't have examples to test this. @HenriMenke: Do you know if it is save to not create the `.pgf` file and rewrite the above macro to read store the \pgfsyspdfmark table in the `.tuc` file? ___ 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 ___
Re: [NTG-context] circuitikz module seems broken
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 -%D \module %D [ file=m-tikz, %Dversion=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% someh
Re: [NTG-context] circuitikz module seems broken
Seems to not solve my issue but i’m supplying my logs.I did update tikz and circuitikz and the whole LMTX refresh and new.Tested the code belowCheck my logs whats wrong.Giving up on this oneThanks in advanceJan-Erik test-error.log Description: Binary data test.log Description: Binary data test.tex Description: Binary data 13 dec. 2021 kl. 21:14 skrev Jan-Erik Hägglöf:Good work and thank you very much. I dig in to it and try it outSincerelyJan-Erik Den mån 13 dec. 2021 21:09Aditya Mahajan via ntg-context skrev:On Mon, 6 Dec 2021, 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. There was an error in circuitikz, which is now fixed in the latest version: https://github.com/circuitikz/circuitikz/pull/600 So, the following works (with latest circuittiz from ctan): \usemodule[t][circuitikz] \starttext \startcircuitikz \draw (0,2) to[I] (2,2); \stopcircuitikz \stoptext But fails with m-circuitikz (even after I remove \unprotect ... \protect from \starttikzinput as in the other thread). So, I don't know what is going wrong with the catcodes in m-circuitikz. Aditya ___ 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 ___ ___ 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 ___
Re: [NTG-context] circuitikz module seems broken
Good work and thank you very much. I dig in to it and try it out Sincerely Jan-Erik Den mån 13 dec. 2021 21:09Aditya Mahajan via ntg-context skrev: > On Mon, 6 Dec 2021, 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. > > There was an error in circuitikz, which is now fixed in the latest > version: > > https://github.com/circuitikz/circuitikz/pull/600 > > So, the following works (with latest circuittiz from ctan): > > \usemodule[t][circuitikz] > > \starttext > > \startcircuitikz > \draw (0,2) to[I] (2,2); > \stopcircuitikz > > \stoptext > > But fails with m-circuitikz (even after I remove \unprotect ... \protect > from \starttikzinput as in the other thread). So, I don't know what is > going wrong with the catcodes in m-circuitikz. > > Aditya > > ___ > 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 > > ___ > ___ 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 ___
Re: [NTG-context] circuitikz module seems broken
On Mon, 6 Dec 2021, 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. There was an error in circuitikz, which is now fixed in the latest version: https://github.com/circuitikz/circuitikz/pull/600 So, the following works (with latest circuittiz from ctan): \usemodule[t][circuitikz] \starttext \startcircuitikz \draw (0,2) to[I] (2,2); \stopcircuitikz \stoptext But fails with m-circuitikz (even after I remove \unprotect ... \protect from \starttikzinput as in the other thread). So, I don't know what is going wrong with the catcodes in m-circuitikz. Aditya ___ 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 ___
[NTG-context] circuitikz module seems broken
Dear List! I’ve been struggeling with the circuitikz module since my upgrade to LMTX. The following test of installation failed, running file circuitikz-context.tex in ../modules/t-tikz/ directory % Copyright 2018-2021 by Romano Giannetti % Copyright 2015-2021 by Stefan Lindner % Copyright 2013-2021 by Stefan Erhardt % Copyright 2007-2021 by Massimo Redaelli % % This file may be distributed and/or modified % % 1. under the LaTeX Project Public License and/or % 2. under the GNU Public License. % % See the files gpl-3.0_license.txt and lppl-1-3c_license.txt for more details. \usemodule[circuitikz] \starttext A simple example to test the installation. \startcircuitikz[scale=1.2] \draw (0,2) to[I=1\milli\ampere] (2,2) to[R, l_=2\kilo\ohm, *-*] (0,0) to[R, l_=2\kilo\ohm] (2,0) to[V, v_=2\volt] (2,2) to[cspst, l=$t_0$] (4,2) -- (4,1.5) to [generic, i=$i_1$, v=$v_1$] (4,-.5) -- (4,-1.5) (0,2) -- (0,-1.5) to[V, v_=4\volt] (2,-1.5) to [R, l=1\kilo\ohm] (4,-1.5) (5,2) node[dipchip, anchor=pin 1]{} (5,-2) node[flipflop JK, anchor=pin 1]{}; \stopcircuitikz \stoptext with this error message pgfcircutils.tex|103 error| Undefined control sequence \undefined Below is a snippet from pgfcircutils.tex %% %% subcircuits (experimental) %% %% introduced by Romano Giannetti around April 2021 %% changes suggested by Jonathan P. Spratte %% \newbox\ctikz@scratchbox \pgfutil@protected\def\ctikzsubcircuitdef#1#2#3{% \expandafter\gdef\csname #1@Anchor\endcsname{}% \expandafter\gdef\csname #1@setanchors\endcsname{% \setbox\ctikz@scratchbox=\hbox{% \begin{circuitikz} \draw (0,0) \csname#1\endcsname{T-#1}{}; \foreach [count=\i] \anchor in {#2} % reference anchor is -center \draw (0,{2-\i/2}) let \p1 = ($(T-#1-subckt@reference)-(T-#1-\anchor)$) in node[right]{\anchor: \x1,\y1 \expandafter\xdef\csname #1@Anchor\anchor\endcsname{++(\x1,\y1)}}; \end{circuitikz}% }% }% \expandafter\gdef\csname#1\endcsname##1##2{% \csname #1@Anchor##2\endcsname coordinate(##1-subckt@reference)#3% }% } \long\def\ctikzsubcircuitactivate#1{\csname #1@setanchors\endcsname} My installation info: context --version mtx-context | ConTeXt Process Management 1.04 mtx-context | mtx-context | main context file: /Users/jan-erikhagglof/context/context-osx-64/tex/texmf-context/tex/context/base/mkiv/context.mkiv mtx-context | current version: 2021.10.28 10:19 mtx-context | main context file: /Users/jan-erikhagglof/context/context-osx-64/tex/texmf-context/tex/context/base/mkxl/context.mkxl mtx-context | current version: 2021.10.28 10:19 Because of my lack of knowledge in this matter, I have no idea what is wrong here. Many thanks in advance Jan-Erik Hägglöf ___ 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 ___