ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* using metapost library makecirc with context.
@ 2019-04-19 15:48 Andrea De Michele
  2019-04-19 16:10 ` Hans Hagen
  0 siblings, 1 reply; 7+ messages in thread
From: Andrea De Michele @ 2019-04-19 15:48 UTC (permalink / raw)
  To: ntg-context


I'm trying to use with Context  makecirc a metapost library to draw
electric circuits, but I have problems with the labels of the circuits
element that are not displayed correctly.

FIRST EXAMPLE (No labels are displayed)
-------------
\starttext

\startMPinclusions
  input makecirc;
\stopMPinclusions


\startstaticMPfigure{circ1}
        u:= 1cm ;
        source.e((0,0u),DC,90,"\Delta V","2V") ;
        resistor.a((2u,1u),normal,90,"R_1","1$\Omega$") ;
        resistor.b((2u,-1u),normal,90,"R_2","2$\Omega$") ;
        wire(S.e.p,R.a.r,udsq) ;
        wire(S.e.n,R.b.l,udsq) ;
        wire(R.a.l,R.b.r,udsq) ;
\stopstaticMPfigure
\usestaticMPfigure[circ1]

\stoptext
-----------------

SECOND EXAMPLE (In the first circuit are displayed the labels of the
second one and in the second only ?? are displayed)
-----------------
\starttext

\startstaticMPfigure{circ1}
  input makecirc;
        u:= 1cm ;
        source.e((0,0u),DC,90,"\Delta V","2V") ;
        resistor.a((2u,1u),normal,90,"R_1","1$\Omega$") ;
        resistor.b((2u,-1u),normal,90,"R_2","2$\Omega$") ;
        wire(S.e.p,R.a.r,udsq) ;
        wire(S.e.n,R.b.l,udsq) ;
        wire(R.a.l,R.b.r,udsq) ;
\stopstaticMPfigure
\usestaticMPfigure[circ1]

\startstaticMPfigure{circ2}
  input makecirc;
        u:= 1cm ;
        source.e((0,0u),DC,90,"\Delta V","4V") ;
        resistor.a((2u,1u),normal,90,"R_3","3$\Omega$") ;
        resistor.b((2u,-1u),normal,90,"R_4","4$\Omega$") ;
        wire(S.e.p,R.a.r,udsq) ;
        wire(S.e.n,R.b.l,udsq) ;
        wire(R.a.l,R.b.r,udsq) ;
\stopstaticMPfigure
\usestaticMPfigure[circ2]

\stoptext


-- 
Andrea De Michele

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: using metapost library makecirc with context.
  2019-04-19 15:48 using metapost library makecirc with context Andrea De Michele
@ 2019-04-19 16:10 ` Hans Hagen
  2019-04-20 20:09   ` Andrea De Michele
  0 siblings, 1 reply; 7+ messages in thread
From: Hans Hagen @ 2019-04-19 16:10 UTC (permalink / raw)
  To: andrea.demichele, mailing list for ConTeXt users

On 4/19/2019 5:48 PM, Andrea De Michele wrote:
> 
> I'm trying to use with Context  makecirc a metapost library to draw
> electric circuits, but I have problems with the labels of the circuits
> element that are not displayed correctly.
> 
> FIRST EXAMPLE (No labels are displayed)
> -------------
> \starttext
> 
> \startMPinclusions
>    input makecirc;
> \stopMPinclusions
> 
> 
> \startstaticMPfigure{circ1}
>          u:= 1cm ;
>          source.e((0,0u),DC,90,"\Delta V","2V") ;
>          resistor.a((2u,1u),normal,90,"R_1","1$\Omega$") ;
>          resistor.b((2u,-1u),normal,90,"R_2","2$\Omega$") ;
>          wire(S.e.p,R.a.r,udsq) ;
>          wire(S.e.n,R.b.l,udsq) ;
>          wire(R.a.l,R.b.r,udsq) ;
> \stopstaticMPfigure
> \usestaticMPfigure[circ1]
> 
> \stoptext
I searched ctab for that library and it has soem hard wired latex stuff 
in it. You can make latex.mp empty (to play safe),

Load the file with:

\startMPinclusions
     string LaTeXsetup ; LaTeXsetup := "";
     input "makecirc.mp";
     vardef latex(expr t) = textext(t) enddef ;
\stopMPinclusions

I didn't look into the details but yoru example runs then.


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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: using metapost library makecirc with context.
  2019-04-19 16:10 ` Hans Hagen
@ 2019-04-20 20:09   ` Andrea De Michele
  2019-04-20 21:00     ` Hans Hagen
  0 siblings, 1 reply; 7+ messages in thread
From: Andrea De Michele @ 2019-04-20 20:09 UTC (permalink / raw)
  To: ntg-context

Hans Hagen <j.hagen@xs4all.nl> writes:

> On 4/19/2019 5:48 PM, Andrea De Michele wrote:
>>
>> I'm trying to use with Context  makecirc a metapost library to draw
>> electric circuits, but I have problems with the labels of the circuits
>> element that are not displayed correctly.
>>
>> FIRST EXAMPLE (No labels are displayed)
>> -------------
>> \starttext
>>
>> \startMPinclusions
>>    input makecirc;
>> \stopMPinclusions
>>
>>
>> \startstaticMPfigure{circ1}
>>          u:= 1cm ;
>>          source.e((0,0u),DC,90,"\Delta V","2V") ;
>>          resistor.a((2u,1u),normal,90,"R_1","1$\Omega$") ;
>>          resistor.b((2u,-1u),normal,90,"R_2","2$\Omega$") ;
>>          wire(S.e.p,R.a.r,udsq) ;
>>          wire(S.e.n,R.b.l,udsq) ;
>>          wire(R.a.l,R.b.r,udsq) ;
>> \stopstaticMPfigure
>> \usestaticMPfigure[circ1]
>>
>> \stoptext
> I searched ctab for that library and it has soem hard wired latex
> stuff in it. You can make latex.mp empty (to play safe),
>
> Load the file with:
>
> \startMPinclusions
>     string LaTeXsetup ; LaTeXsetup := "";
>     input "makecirc.mp";
>     vardef latex(expr t) = textext(t) enddef ;
> \stopMPinclusions
>
> I didn't look into the details but yoru example runs then.
>
>
> 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
> -----------------------------------------------------------------
> ___________________________________________________________________________________
> 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
> ___________________________________________________________________________________
>
Thank you,

I didn't understand the magic behind that  but it's works.

Another question: there is a library to draw electrics circuit
alternative to makecirc but more context/metafun friendly?



-- 
Andrea De Michele

-- 
Andrea De Michele

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: using metapost library makecirc with context.
  2019-04-20 20:09   ` Andrea De Michele
@ 2019-04-20 21:00     ` Hans Hagen
  2019-04-20 21:16       ` Alan Braslau
  0 siblings, 1 reply; 7+ messages in thread
From: Hans Hagen @ 2019-04-20 21:00 UTC (permalink / raw)
  To: andrea.demichele, mailing list for ConTeXt users

On 4/20/2019 10:09 PM, Andrea De Michele wrote:

> I didn't understand the magic behind that  but it's works.

mp has no real text typesetting options so this hack provides it

> Another question: there is a library to draw electrics circuit
> alternative to makecirc but more context/metafun friendly?
the node library but it lacks things for drawing resistors ... i'll 
discuss this whith alan

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: using metapost library makecirc with context.
  2019-04-20 21:00     ` Hans Hagen
@ 2019-04-20 21:16       ` Alan Braslau
  2019-04-20 21:49         ` Hans Hagen
  0 siblings, 1 reply; 7+ messages in thread
From: Alan Braslau @ 2019-04-20 21:16 UTC (permalink / raw)
  To: Hans Hagen; +Cc: mailing list for ConTeXt users, andrea.demichele

On Sat, 20 Apr 2019 23:00:09 +0200
Hans Hagen <j.hagen@xs4all.nl> wrote:

> On 4/20/2019 10:09 PM, Andrea De Michele wrote:
> 
> > I didn't understand the magic behind that  but it's works.  
> 
> mp has no real text typesetting options so this hack provides it

Why not
	let latex=textext ;

> > Another question: there is a library to draw electrics circuit
> > alternative to makecirc but more context/metafun friendly?  
> the node library but it lacks things for drawing resistors ... i'll 
> discuss this whith alan

I played with makecirc a while back (and I even used it to make simple circuit diagrams that I used in a patent application). A real electronic circuit drawing program these days will do circuit board layouts and automatic routing, etc. I'm not sure that we want to get into this with MP.

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: using metapost library makecirc with context.
  2019-04-20 21:16       ` Alan Braslau
@ 2019-04-20 21:49         ` Hans Hagen
  2019-04-21 14:02           ` Alan Braslau
  0 siblings, 1 reply; 7+ messages in thread
From: Hans Hagen @ 2019-04-20 21:49 UTC (permalink / raw)
  To: Alan Braslau; +Cc: mailing list for ConTeXt users, andrea.demichele

On 4/20/2019 11:16 PM, Alan Braslau wrote:
> On Sat, 20 Apr 2019 23:00:09 +0200
> Hans Hagen <j.hagen@xs4all.nl> wrote:
> 
>> On 4/20/2019 10:09 PM, Andrea De Michele wrote:
>>
>>> I didn't understand the magic behind that  but it's works.
>>
>> mp has no real text typesetting options so this hack provides it
> 
> Why not
> 	let latex=textext ;

That crashed here.

>>> Another question: there is a library to draw electrics circuit
>>> alternative to makecirc but more context/metafun friendly?
>> the node library but it lacks things for drawing resistors ... i'll
>> discuss this whith alan
> 
> I played with makecirc a while back (and I even used it to make simple circuit diagrams that I used in a patent application). A real electronic circuit drawing program these days will do circuit board layouts and automatic routing, etc. I'm not sure that we want to get into this with MP.
I assume only for some simple educational drawings.

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: using metapost library makecirc with context.
  2019-04-20 21:49         ` Hans Hagen
@ 2019-04-21 14:02           ` Alan Braslau
  0 siblings, 0 replies; 7+ messages in thread
From: Alan Braslau @ 2019-04-21 14:02 UTC (permalink / raw)
  To: andrea.demichele; +Cc: mailing list for ConTeXt users

On Sat, 20 Apr 2019 23:49:26 +0200
Hans Hagen <j.hagen@xs4all.nl> wrote:

> > 	let latex=textext ;  
> 
> That crashed here.

In fact, when I used makecirc.mp, I just commented out the following few lines at the head of the file:

%input latex;
%
% Commands definitions to do the labeled easier %
%
%LaTeXsetup:=LaTeXsetup & 
%"\def\ohm{\ensuremath{\,\Omega}}" &
%"\def\kohm{\,k\ensuremath{\Omega}}" &
%"\def\modarg#1#2{\setbox0=\hbox{$\mkern-1mu/#2^\circ$}" &
%"\dp0=.21ex $#1\underline{\box0}$}";

and everything worked (the macros use label() for text).

Alan

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-04-21 14:02 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-19 15:48 using metapost library makecirc with context Andrea De Michele
2019-04-19 16:10 ` Hans Hagen
2019-04-20 20:09   ` Andrea De Michele
2019-04-20 21:00     ` Hans Hagen
2019-04-20 21:16       ` Alan Braslau
2019-04-20 21:49         ` Hans Hagen
2019-04-21 14:02           ` Alan Braslau

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