ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: DesdeChaves <desdechaves@gmail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Cc: m.redaelli@gmail.com, cholewo@lexmark.com
Subject: Draw eletrical circuits in ConTeXt (Circuitikz or mpcirc.mp)
Date: Tue, 25 Mar 2014 13:37:11 +0000	[thread overview]
Message-ID: <CAPBmU9E8ptm2=_+4_iKSCSk8b50WzwZzXzFrbD21hm82LR_HDQ@mail.gmail.com> (raw)


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

                 reply	other threads:[~2014-03-25 13:37 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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='CAPBmU9E8ptm2=_+4_iKSCSk8b50WzwZzXzFrbD21hm82LR_HDQ@mail.gmail.com' \
    --to=desdechaves@gmail.com \
    --cc=cholewo@lexmark.com \
    --cc=m.redaelli@gmail.com \
    --cc=ntg-context@ntg.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).