From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/86784 Path: news.gmane.org!not-for-mail From: DesdeChaves Newsgroups: gmane.comp.tex.context Subject: Draw eletrical circuits in ConTeXt (Circuitikz or mpcirc.mp) Date: Tue, 25 Mar 2014 13:37:11 +0000 Message-ID: Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0799537851==" X-Trace: ger.gmane.org 1395754650 13213 80.91.229.3 (25 Mar 2014 13:37:30 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 25 Mar 2014 13:37:30 +0000 (UTC) Cc: m.redaelli@gmail.com, cholewo@lexmark.com To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Tue Mar 25 14:37:41 2014 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from balder.ntg.nl ([5.39.185.229]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1WSRXv-00013k-0b for gctc-ntg-context-518@m.gmane.org; Tue, 25 Mar 2014 14:37:39 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id CCBEB101F6; Tue, 25 Mar 2014 14:37:37 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 0rG68jnVdAwH; Tue, 25 Mar 2014 14:37:34 +0100 (CET) Original-Received: from balder.ntg.nl (localhost [IPv6:::1]) by balder.ntg.nl (Postfix) with ESMTP id 90EAA101EA; Tue, 25 Mar 2014 14:37:34 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 90D91101EA for ; Tue, 25 Mar 2014 14:37:33 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id ffkShjbn7TE5 for ; Tue, 25 Mar 2014 14:37:27 +0100 (CET) Original-Received: from filter1-utr.mf.surf.net (filter1-utr.mf.surf.net [195.169.124.152]) by balder.ntg.nl (Postfix) with ESMTP id A0C3F101E8 for ; Tue, 25 Mar 2014 14:37:17 +0100 (CET) Original-Received: from mail-ob0-x230.google.com (mail-ob0-x230.google.com [IPv6:2607:f8b0:4003:c01::230]) by filter1-utr.mf.surf.net (8.14.3/8.14.3/Debian-9.4) with ESMTP id s2PDbCPx023632 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT) for ; Tue, 25 Mar 2014 14:37:13 +0100 Original-Received: by mail-ob0-f176.google.com with SMTP id wp18so532624obc.21 for ; Tue, 25 Mar 2014 06:37:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:cc:content-type; bh=XB+nqItbkji/LwoNkgTB4sXg03AzV0BrK4ZBAzXOUsM=; b=hRtRZprz2G+wkX4NIpM9GDkqiUv6P2Pi3tWYfhX+Kup3s/ZPR8ueRIO7xkHQYm9HYr iexiBaYdx7TfiEYqi6Kb7SLq+UjyP8pzmWXZinVO72fRgIqtt1SqPnWBdvc7B6Zf0q28 8QGOYDgoZi6gHSFx2Q+HCHP2tYTM/g/yCowo28BW8R/HeqJyBMbk3qBh/0W91Iwu9UUP pEO17rj1ZnTNtoKpNDYGXXB/uvsPb5DDtmYkz/oQKhokvUZx4cantm01369walMsetqq OyV+j0SkLaVrzph2vQLjf4Gq4DT6XtsTUtG/m6Es2XkhF7nFTgzz/fipZzeOlGu4No6b JdHg== X-Received: by 10.182.241.67 with SMTP id wg3mr27943293obc.16.1395754631988; Tue, 25 Mar 2014 06:37:11 -0700 (PDT) Original-Received: by 10.60.132.20 with HTTP; Tue, 25 Mar 2014 06:37:11 -0700 (PDT) X-Bayes-Prob: 0.0001 (Score 0, tokens from: ntg-context@ntg.nl, base:default, @@RPTN) X-CanIt-Geo: ip=2607:f8b0:4003:c01::230; country=US X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 07LFNBdh4 - 90e1b4cf2f79 - 20140325 X-Scanned-By: CanIt (www . roaringpenguin . com) X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.14 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ntg-context-bounces@ntg.nl Original-Sender: ntg-context-bounces@ntg.nl Xref: news.gmane.org gmane.comp.tex.context:86784 Archived-At: --===============0799537851== Content-Type: multipart/alternative; boundary=001a11c2efb8088e9804f56e7361 --001a11c2efb8088e9804f56e7361 Content-Type: text/plain; charset=ISO-8859-1 Dear Sirs I need to draw some simple eletrical circuits. I try metapost (mpcirc.mp) and cicruitikz, but i found error messages in both. Is there a way to draw eletrical circuits in ConTeXt? Thanks in advance for your support. Jorge ConTeXt ver: 2014.02.14 17:07 MKIV beta fmt: 2014.2.15 int: english/english ######### with mpcirc.mp ###### With this code: \startMPinclusions input mpcirc; \stopMPinclusions \starttext %\forceMPTEXgraphictrue %%% command don't work \startMPcode u:=10bp; % unit of length prepare(L,C,Vac); % mention your elements z0=(10u,10u); % lower right node ht:=6u; % height of circuit z1=z0+(0,ht); % upper right node C=.5[z0,z1]; % location of capacitor L.t=T.r; % use default orientation C.t=Vac.t=T.u; % components rotated 90 degrees % set the distance between Voltage and Capacitor equally_spaced(5u,0) Vac, C; L=z1-0.5(C-Vac); % location of spool edraw; % draw components of the circuit % draw wires connecting components % the first ones rotated 90 degrees wire.v(Vac.a,z0); wire.v(Vac.b,L.a); wire.v(L.b,z1); wire(C.a,z0); wire(C.b,z1); \stopMPcode \stoptext I found this error message: metapost > error: (mpcirc.mp (ttex.mp) (circlib.mp >> circlib.mp >> circlib.mpx ! ! Unable to make mpx file. l.39 def Eplus_ = btex $+$etex enddef; ############ With Circuitikz ####### If i try use Circuitikz with this test code: \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); \stopcircuitikz \stoptext The error message is: (/Applications/Context/tex/texmf-modules/tex/generic/circuitikz/pgfcircquadpoles.sty) (/Applications/Context/tex/texmf-modules/tex/generic/circuitikz/pgfcirclabel.sty) (/Applications/Context/tex/texmf-modules/tex/generic/circuitikz/pgfcircvoltage.sty) (/Applications/Context/tex/texmf-modules/tex/generic/circuitikz/pgfcirccurrent.sty)) ! Missing \endcsname inserted. system > tex > error on line 16 in file /Applications/Context/tex/texmf-modules/tex/generic/circuitikz/t-circuitikz.tex: Missing \endcsname inserted ... 6 \usepgflibrary[decorations.pathmorphing] 7 \usetikzlibrary[calc] 8 9 \unprotect 10 11 \input circuitikz.code.tex 12 13 % defaults 14 15 \setupmodule[current=european, voltage=european, resistor=american, inductor=cute, logic=american, siunitx=true, arrowmos=false] 16 >> 17 \processaction[\currentmoduleparameter{voltage}] 18 [ european=>\ctikzset{voltage=european}, 19 american=>\ctikzset{voltage=american} 20 ] ################# --001a11c2efb8088e9804f56e7361 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable

Dear Sirs

I n= eed to draw some simple eletrical circuits. I try metapost (mpcirc.mp) and cicruitikz, but i found error messages in = both.

Is there a way to draw eletrical circuits in ConTeXt?


Thanks in advance =A0for your suppor= t.

Jorge

ConTeXt =A0ver: = 2014.02.14 17:07 MKIV beta =A0fmt: 2014.2.15 =A0int: english/english
######### with mpcirc.mp ######
=

With this code:



\startMPinclusions=A0
input mpcirc;
\stopMPinclusions



\starttext
=A0

%\forceMPTEXgrap= hictrue %%% command don't work

\startMPcode
u:=3D10bp; % unit of length
prepare(L,C,Vac); % mention your= elements
z0=3D(10u,10u); % lower right node
ht:=3D6u; = % height of circuit
z1=3Dz0+(0,ht); % upper right node
= C=3D.5[z0,z1]; % location of capacitor
L.t=3DT.r; % use default orientation
C.t=3DVac.t=3DT.u; % co= mponents rotated 90 degrees
% set the distance between Voltage an= d Capacitor
equally_spaced(5u,0) Vac, C;
L=3Dz1-0.5(C-V= ac); % location of spool
edraw; % draw components of the circuit
% draw wires connect= ing components
% the first ones rotated 90 degrees
wire= .v(Vac.a,z0);
wire.v(Vac.b,L.a);
wire.v(L.b,z1);
wire(C.a,z0);
wire(C.b,z1);

\stopMP= code
=A0
\stoptext


<= div>I found this error message:

metapost =A0 =A0 = =A0 =A0> error:=A0
>> circli= b.mpx
! ! Unable to make mpx file.
l.39 def Eplus_ =3D btex
<= div>=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 $+$etex enddef;
= =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=A0
=A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0=A0
############ With Circuitikz #####= ##

If i try use Circuitikz with this test code:
=
\usemodule[circuitikz]

\starttext
=A0
A simple example to test the installation.

\startcircuitikz[scale=3D1.2]
\draw=A0
=A0 (0,2) to[I=3D1\milli\= ampere] (2,2)
=A0 =A0 =A0 =A0 to[R, l_=3D2\kilo\ohm, *-*] (0,0)
=A0 =A0 =A0 =A0 to[R, l_=3D2\kilo\ohm] (2,0)
=A0 =A0 =A0 =A0 to[V, v_=3D2\volt] (2,2)
=A0 =A0 =A0 =A0 to[= cspst, l=3D$t_0$] (4,2) -- (4,1.5)
=A0 =A0 =A0 =A0 to [generic, i= =3D$i_1$, v=3D$v_1$] (4,-.5) -- (4,-1.5)
=A0 (0,2) -- (0,-1.5) to= [V, v_=3D4\volt] (2,-1.5)
=A0 =A0 =A0 =A0 to [R, l=3D1\kilo\ohm] (4,-1.5);
\stopcircuitikz<= /div>
=A0
\stoptext=A0

The error mes= sage is:

=A0(/Applications/Context/tex/texmf-modul= es/tex/generic/circuitikz/pgfcircquadpoles.sty) (/Applications/Context/tex/= texmf-modules/tex/generic/circuitikz/pgfcirclabel.sty) (/Applications/Conte= xt/tex/texmf-modules/tex/generic/circuitikz/pgfcircvoltage.sty) (/Applicati= ons/Context/tex/texmf-modules/tex/generic/circuitikz/pgfcirccurrent.sty))
! Missing \endcsname inserted.

system =A0 =A0= =A0 =A0 =A0> tex > error on line 16 in file /Applications/Context/te= x/texmf-modules/tex/generic/circuitikz/t-circuitikz.tex: Missing \endcsname= inserted ...

=A06 =A0 =A0 \usepgflibrary[decorations.pathmorphing]
=A07 =A0 =A0 \usetikzlibrary[calc]
=A08 =A0 =A0=A0
=
=A09 =A0 =A0 \unprotect
10 =A0 =A0=A0
11 =A0 =A0 \= input circuitikz.code.tex
12 =A0 =A0=A0
13 =A0 =A0 % defaults
14 =A0 =A0=A0
=
15 =A0 =A0 \setupmodule[current=3Deuropean, voltage=3Deuropean, =A0res= istor=3Damerican, =A0inductor=3Dcute, logic=3Damerican, siunitx=3Dtrue, arr= owmos=3Dfalse]
16 >> =A0
17 =A0 =A0 \processaction[\currentmoduleparameter{voltage}]
= 18 =A0 =A0 =A0 =A0[ =A0 =A0european=3D>\ctikzset{voltage=3Deuropean},
19 =A0 =A0 =A0 =A0 =A0 =A0 american=3D>\ctikzset{voltage=3Dameri= can}
20 =A0 =A0 =A0 =A0]

#################
=A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0 =A0 =A0


--001a11c2efb8088e9804f56e7361-- --===============0799537851== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ___________________________________________________________________________________ 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________ --===============0799537851==--