Re: [NTG-context] using metapost library makecirc with context.

2019-04-21 Thread Alan Braslau
On Sat, 20 Apr 2019 23:49:26 +0200
Hans Hagen  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
___


Re: [NTG-context] using metapost library makecirc with context.

2019-04-20 Thread Hans Hagen

On 4/20/2019 11:16 PM, Alan Braslau wrote:

On Sat, 20 Apr 2019 23:00:09 +0200
Hans Hagen  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
___


Re: [NTG-context] using metapost library makecirc with context.

2019-04-20 Thread Alan Braslau
On Sat, 20 Apr 2019 23:00:09 +0200
Hans Hagen  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
___


Re: [NTG-context] using metapost library makecirc with context.

2019-04-20 Thread Hans Hagen

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
___


Re: [NTG-context] using metapost library makecirc with context.

2019-04-20 Thread Andrea De Michele
Hans Hagen  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
___


Re: [NTG-context] using metapost library makecirc with context.

2019-04-19 Thread Hans Hagen

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
___