ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Draw eletrical circuits in ConTeXt (Circuitikz or mpcirc.mp)
@ 2014-03-25 13:37 DesdeChaves
  0 siblings, 0 replies; only message in thread
From: DesdeChaves @ 2014-03-25 13:37 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: m.redaelli, cholewo


[-- Attachment #1.1: Type: text/plain, Size: 2929 bytes --]

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        ]

#################

[-- Attachment #1.2: Type: text/html, Size: 4675 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2014-03-25 13:37 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-25 13:37 Draw eletrical circuits in ConTeXt (Circuitikz or mpcirc.mp) DesdeChaves

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