ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* plain ppchtex+supp-mps missing macros
@ 2001-11-10 18:32 Ricardo Sanchez Carmenes
  0 siblings, 0 replies; 4+ messages in thread
From: Ricardo Sanchez Carmenes @ 2001-11-10 18:32 UTC (permalink / raw)


Dear Hans,

In addition to the small supp-mps.tex bugs reported in another mail,
there are some other macros missing from supp-mps.tex that are needed
to use supp-msp+ppchtex from plain TeX (without loading full ConTeXt).

Ppchtex.tex uses \pushMPdrawing and \popMPdrawing, defined in supp-mps.tex,
and making use themselves of \pushmacro and \popmacro, that are not yet
defined.

The problem can be solved copying from syst-ext.tex the definitions of
\pushmacro and \popmacro, plus the \increment and \decrement familly of
macros, plus \let\redoglobal\relax and \let\dodoglobal\relax.

I am using a file like the attached one to use ppchtex with metapost,
useful with both pdftex and tex+dvips. Perhaps that you may find useful
to add some of the missing macros to supp-mps.tex.

Regards,
Ricardo.

%%%%%%%%%%%%%%%%%% ppchmp.tex %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% we need some conTeXt syst-ext.tex macros to avoid loading the full package
\catcode`\@=11

\let\redoglobal\relax
\let\dodoglobal\relax

%D \macros
%D   {newcounter,
%D    increment,decrement}
%D
%D Unfortunately the number of \COUNTERS\ in \TEX\ is limited,
%D but fortunately we can store numbers in a macro. We can
%D increment such pseudo \COUNTERS\ with \type{\increment}.
%D
%D \starttypen
%D \increment(\counter,20)
%D \increment(\counter,-4)
%D \increment(\counter)
%D \increment\counter
%D \stoptypen
%D
%D After this sequence of commands, the value of
%D \type{\counter} is 20, 16, 17 and~18. Of course there is
%D also the complementary command \type{\decrement}.
%D
%D Global assignments are possible too, using \type{\doglobal}:
%D
%D \starttypen
%D \doglobal\increment\counter
%D \stoptypen
%D
%D When \type{\counter} is undefined, it's value is initialized
%D at~0. It is nevertheless better to define a \COUNTER\
%D explicitly. One reason could be that the \COUNTER\ can be
%D part of a test with \type{\ifnum} and this conditional does
%D not accept undefined macro's. The \COUNTER\ in our example
%D can for instance be defined with:
%D
%D \starttypen
%D \newcounter\counter
%D \stoptypen
%D
%D The command \type{\newcounter} must not be confused with
%D \type{\newcount}! Of course this mechanism is much slower
%D than using \TEX's \COUNTERS\ directly. In practice
%D \COUNTERS\ (and therefore our pseudo counters too) are
%D seldom the bottleneck in the processing of a text. Apart
%D from some other incompatilities we want to mention a pitfal
%D when using \type{\ifnum}.
%D
%D \starttypen
%D \ifnum\normalcounter=\pseudocounter \doif \else \doelse \fi
%D \ifnum\pseudocounter=\normalcounter \doif \else \doelse \fi
%D \stoptypen
%D
%D In the first test, \TEX\ continues it's search for the
%D second number after reading  \type{\pseudocounter}, while
%D in the second test, it stops reading after having
%D encountered a real one. Tests like the first one therefore
%D can give unexpected results, for instance execution
%D of \type{\doif} even if both numbers are unequal.

\def\zerocountervalue{0}

\def\newcounter#1%
  {\dodoglobal\let#1\zerocountervalue}

\def\dodododoincrement(#1,#2)%
  {\ifx#1\undefined
     \redoglobal\let#1\zerocountervalue
   \else\ifx#1\relax % \csname...\endcsname
     \redoglobal\let#1\zerocountervalue
   \fi\fi
   \scratchcounter=#2\relax
   \scratchcounter=\incrementsign\scratchcounter
   \advance\scratchcounter #1\relax
   \dodoglobal\edef#1{\the\scratchcounter}}

\def\dododoincrement#1%
  {\dodododoincrement(#1,1)}

\def\dodoincrement(#1%
  {\doifnextcharelse{,}
     {\dodododoincrement(#1}
     {\dodododoincrement(#1,1}}

\def\doincrement#1%
  {\def\incrementsign{#1}%
   \doifnextcharelse{(}
     {\dodoincrement}
     {\dododoincrement}}

\def\increment%
  {\doincrement+}

\def\decrement%
  {\doincrement-}

%D \macros
%D   {pushmacro,popmacro}
%D
%D Premature and a bit of beta, we offer:
%D
%D \starttypen
%D \pushmacro\macro
%D \popmacro\macro
%D \stoptypen

\def\@s@{@s@}

\def\pushmacro#1% across groups !
  {\@EA\doglobal\@EA\increment\csname\@s@:\string#1\endcsname
   \global\@EA\let\csname\csname\@s@:\string#1\endcsname:\string#1\endcsname#1}

\def\popmacro#1%
  {\global\@EA\let\@EA#1\csname\csname\@s@:\string#1\endcsname:\string#1\endcsname
   \@EA\doglobal\@EA\decrement\csname\@s@:\string#1\endcsname}

\catcode`\@=12

% now, load context-metapost modules
\ifx\pdftexversion\undefined
%
% to insert the MP file using tex+dvips:
%
\input supp-eps
%
\def\insertMPfile#1%
  {\includeMPfonts{#1}%
   \dogetEPSboundingbox{#1}{\dimen2}{\dimen4}{\dimen6}{\dimen8}%
   \hbox to \dimen6{%
     \hskip-\EPSllx bp
     \vbox to \dimen8
       {\forgetall
        \vskip \EPSury bp
        \special{psfile=#1}%
        \vfill}%
     \hfill}}
%
% supp-mps.tex checks \pdfoutput, even if undefined!
\def\pdfoutput{0}
%
\else
%
% to insert the MP file using pdftex:
%
\input supp-pdf
%
\def\insertMPfile#1#2{\convertMPtoPDF{#1}{1}{1}}
%
\fi

\input supp-mps

% \startreusableMPgraphic needs this (yet) undefined macro:
\ifx\ifundefined\undefined
\message{*** define undefined macro (\string\ifundefined) ***}
\def\ifundefined#1{\expandafter\ifx\csname#1\endcsname\relax}
\fi

% activate MP output (assuming we are using web2c-[pdf]tex -shell-escape)
\runMPgraphicstrue

% finally, we may load context-ppchtex modules
\input m-pictex
\input m-ch-en

\endinput
%%%%%%%%%%% end of ppchmp.tex %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


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

* Re: plain ppchtex+supp-mps missing macros
       [not found]   ` <Pine.LNX.4.33.0111121520400.13333-100000@bioinf.medicina.u niovi.es>
@ 2001-11-12 16:43     ` Hans Hagen
  0 siblings, 0 replies; 4+ messages in thread
From: Hans Hagen @ 2001-11-12 16:43 UTC (permalink / raw)
  Cc: ntg-context

At 03:38 PM 11/12/2001 +0100, Ricardo Sanchez Carmenes wrote:
>On Mon, 12 Nov 2001, Hans Hagen wrote:
>
> > At 07:32 PM 11/10/2001 +0100, Ricardo Sanchez Carmenes wrote:
> >
> > >In addition to the small supp-mps.tex bugs reported in another mail,
> > >there are some other macros missing from supp-mps.tex that are needed
> > >to use supp-msp+ppchtex from plain TeX (without loading full ConTeXt).
> >
> > (well, it waqs never intended to work (that is: untested) so if it does
> > it's nice)
>
>Yes, indeed :)
>Well, supp-msp was perhaps not intended to be used outside conTeXt, but
>ppchtex was, and as ppchtex can work with pure pictex, or pictex+supp-msp,
>it seemed natural to be able to use ppchtex+supp-msp outside conTeXt.
>
>BTW, are you planing to produce pure-metapost ppchtex (without pictex) ?

maybe some day ... but then i would probably write the module from scratch

> > >Ppchtex.tex uses \pushMPdrawing and \popMPdrawing, defined in 
> supp-mps.tex,
> > >and making use themselves of \pushmacro and \popmacro, that are not yet
> > >defined.
> > >
> > >The problem can be solved copying from syst-ext.tex the definitions of
> > >\pushmacro and \popmacro, plus the \increment and \decrement familly of
> > >macros, plus \let\redoglobal\relax and \let\dodoglobal\relax.
> >
> > why not load syst-ext then? I would prefer that over letting supp-mis grow
> > too much; also because supp-mps might use other macros from syst-ext.
>
>Because it then complains about other missing things ... that enforces
>to call another module that complains of other missing things that ...
>and so on. It was my first idea, but, outside conTeXt, I found cleaner
>only to add the very few missing macros.

hm, but syst-ext is supposed to be rather independent

Hans
-------------------------------------------------------------------------
                                   Hans Hagen | PRAGMA ADE | pragma@wxs.nl
                       Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
  tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com
-------------------------------------------------------------------------


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

* Re: plain ppchtex+supp-mps missing macros
@ 2001-11-12 14:38 Ricardo Sanchez Carmenes
  0 siblings, 0 replies; 4+ messages in thread
From: Ricardo Sanchez Carmenes @ 2001-11-12 14:38 UTC (permalink / raw)
  Cc: ntg-context

On Mon, 12 Nov 2001, Hans Hagen wrote:

> At 07:32 PM 11/10/2001 +0100, Ricardo Sanchez Carmenes wrote:
>
> >In addition to the small supp-mps.tex bugs reported in another mail,
> >there are some other macros missing from supp-mps.tex that are needed
> >to use supp-msp+ppchtex from plain TeX (without loading full ConTeXt).
>
> (well, it waqs never intended to work (that is: untested) so if it does
> it's nice)

Yes, indeed :)
Well, supp-msp was perhaps not intended to be used outside conTeXt, but
ppchtex was, and as ppchtex can work with pure pictex, or pictex+supp-msp,
it seemed natural to be able to use ppchtex+supp-msp outside conTeXt.

BTW, are you planing to produce pure-metapost ppchtex (without pictex) ?

> >Ppchtex.tex uses \pushMPdrawing and \popMPdrawing, defined in supp-mps.tex,
> >and making use themselves of \pushmacro and \popmacro, that are not yet
> >defined.
> >
> >The problem can be solved copying from syst-ext.tex the definitions of
> >\pushmacro and \popmacro, plus the \increment and \decrement familly of
> >macros, plus \let\redoglobal\relax and \let\dodoglobal\relax.
>
> why not load syst-ext then? I would prefer that over letting supp-mis grow
> too much; also because supp-mps might use other macros from syst-ext.

Because it then complains about other missing things ... that enforces
to call another module that complains of other missing things that ...
and so on. It was my first idea, but, outside conTeXt, I found cleaner
only to add the very few missing macros.

> >I am using a file like the attached one to use ppchtex with metapost,
> >useful with both pdftex and tex+dvips. Perhaps that you may find useful
> >to add some of the missing macros to supp-mps.tex.
>
> some of those macros have been optimized for speed recently so i would have
> to look into it in more detail
>
> Hans

Regards,
Ricardo.


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

* Re: plain ppchtex+supp-mps missing macros
       [not found] <Pine.LNX.4.33.0111101930270.9924-100000@bioinf.medicina.un iovi.es>
@ 2001-11-12 11:16 ` Hans Hagen
       [not found]   ` <Pine.LNX.4.33.0111121520400.13333-100000@bioinf.medicina.u niovi.es>
  0 siblings, 1 reply; 4+ messages in thread
From: Hans Hagen @ 2001-11-12 11:16 UTC (permalink / raw)
  Cc: ntg-context

At 07:32 PM 11/10/2001 +0100, Ricardo Sanchez Carmenes wrote:

>In addition to the small supp-mps.tex bugs reported in another mail,
>there are some other macros missing from supp-mps.tex that are needed
>to use supp-msp+ppchtex from plain TeX (without loading full ConTeXt).

(well, it waqs never intended to work (that is: untested) so if it does 
it's nice)

>Ppchtex.tex uses \pushMPdrawing and \popMPdrawing, defined in supp-mps.tex,
>and making use themselves of \pushmacro and \popmacro, that are not yet
>defined.
>
>The problem can be solved copying from syst-ext.tex the definitions of
>\pushmacro and \popmacro, plus the \increment and \decrement familly of
>macros, plus \let\redoglobal\relax and \let\dodoglobal\relax.

why not load syst-ext then? I would prefer that over letting supp-mis grow 
too much; also because supp-mps might use other macros from syst-ext.

>I am using a file like the attached one to use ppchtex with metapost,
>useful with both pdftex and tex+dvips. Perhaps that you may find useful
>to add some of the missing macros to supp-mps.tex.

some of those macros have been optimized for speed recently so i would have 
to look into it in more detail

Hans
-------------------------------------------------------------------------
                                   Hans Hagen | PRAGMA ADE | pragma@wxs.nl
                       Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
  tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com
-------------------------------------------------------------------------


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

end of thread, other threads:[~2001-11-12 16:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-11-10 18:32 plain ppchtex+supp-mps missing macros Ricardo Sanchez Carmenes
     [not found] <Pine.LNX.4.33.0111101930270.9924-100000@bioinf.medicina.un iovi.es>
2001-11-12 11:16 ` Hans Hagen
     [not found]   ` <Pine.LNX.4.33.0111121520400.13333-100000@bioinf.medicina.u niovi.es>
2001-11-12 16:43     ` Hans Hagen
2001-11-12 14:38 Ricardo Sanchez Carmenes

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