ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* How to prevent empty page after MPpage?
@ 2009-07-12 16:02 Mojca Miklavec
  2009-07-12 20:45 ` Hans Hagen
  0 siblings, 1 reply; 11+ messages in thread
From: Mojca Miklavec @ 2009-07-12 16:02 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hello,

The following code works OK in mkiv, but in mkii it generates a
spurious empty page at the end. How can I get rid of it? (I think that
it used to work OK a while ago.)

\def\startGNUPLOTpage%
	{\obeyMPlines\dostartGNUPLOTpage}
\long\def\dostartGNUPLOTpage#1\stopGNUPLOTpage%
	{\startMPpage#1\stopMPpage}

\starttext
\startGNUPLOTpage
draw fullcircle scaled 3cm;
\stopGNUPLOTpage
\stoptext

Thanks,
   Mojca
___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: How to prevent empty page after MPpage?
  2009-07-12 16:02 How to prevent empty page after MPpage? Mojca Miklavec
@ 2009-07-12 20:45 ` Hans Hagen
  2009-07-12 20:49   ` Mojca Miklavec
  0 siblings, 1 reply; 11+ messages in thread
From: Hans Hagen @ 2009-07-12 20:45 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Mojca Miklavec wrote:
> Hello,
> 
> The following code works OK in mkiv, but in mkii it generates a
> spurious empty page at the end. How can I get rid of it? (I think that
> it used to work OK a while ago.)
> 
> \def\startGNUPLOTpage%
> 	{\obeyMPlines\dostartGNUPLOTpage}
> \long\def\dostartGNUPLOTpage#1\stopGNUPLOTpage%
> 	{\startMPpage#1\stopMPpage}
> 
> \starttext
> \startGNUPLOTpage
> draw fullcircle scaled 3cm;
> \stopGNUPLOTpage
> \stoptext


do you reset the color afterwards?

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
      tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                              | 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://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: How to prevent empty page after MPpage?
  2009-07-12 20:45 ` Hans Hagen
@ 2009-07-12 20:49   ` Mojca Miklavec
  2009-07-12 21:02     ` Wolfgang Schuster
  2009-07-13  7:47     ` Hans Hagen
  0 siblings, 2 replies; 11+ messages in thread
From: Mojca Miklavec @ 2009-07-12 20:49 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Sun, Jul 12, 2009 at 22:45, Hans Hagen wrote:
> Mojca Miklavec wrote:
>>
>> Hello,
>>
>> The following code works OK in mkiv, but in mkii it generates a
>> spurious empty page at the end. How can I get rid of it? (I think that
>> it used to work OK a while ago.)
>>
>> \def\startGNUPLOTpage%
>>        {\obeyMPlines\dostartGNUPLOTpage}
>> \long\def\dostartGNUPLOTpage#1\stopGNUPLOTpage%
>>        {\startMPpage#1\stopMPpage}
>>
>> \starttext
>> \startGNUPLOTpage
>> draw fullcircle scaled 3cm;
>> \stopGNUPLOTpage
>> \stoptext
>
>
> do you reset the color afterwards?

What color(s)? (I'm not sure that I understood the question.)

This is a complete minimal example (no need for any external package).
It seems that \obeyMPlines or something related introduces a space
somewhere, and that generates an empty page.

Mojca
___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: How to prevent empty page after MPpage?
  2009-07-12 20:49   ` Mojca Miklavec
@ 2009-07-12 21:02     ` Wolfgang Schuster
  2009-07-12 21:19       ` Mojca Miklavec
  2009-07-13  7:47     ` Hans Hagen
  1 sibling, 1 reply; 11+ messages in thread
From: Wolfgang Schuster @ 2009-07-12 21:02 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 12.07.2009 um 22:49 schrieb Mojca Miklavec:

> This is a complete minimal example (no need for any external package).
> It seems that \obeyMPlines or something related introduces a space
> somewhere, and that generates an empty page.

Why don't you use grouping then?

\def\startGNUPLOTpage
   {\begingroup\obeyMPlines\dostartGNUPLOTpage}

\long\def\dostartGNUPLOTpage#1\stopGNUPLOTpage
   {\endgroup\startMPpage#1\stopMPpage}

Wolfgang

___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: How to prevent empty page after MPpage?
  2009-07-12 21:02     ` Wolfgang Schuster
@ 2009-07-12 21:19       ` Mojca Miklavec
  2009-07-13  6:18         ` Vafa Khalighi
  2009-07-13  7:50         ` Hans Hagen
  0 siblings, 2 replies; 11+ messages in thread
From: Mojca Miklavec @ 2009-07-12 21:19 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Sun, Jul 12, 2009 at 23:02, Wolfgang Schuster wrote:
> Am 12.07.2009 um 22:49 schrieb Mojca Miklavec:
>
>> This is a complete minimal example (no need for any external package).
>> It seems that \obeyMPlines or something related introduces a space
>> somewhere, and that generates an empty page.
>
> Why don't you use grouping then?

I guess because I don't understand what's going on in the first place :)

> \def\startGNUPLOTpage
>  {\begingroup\obeyMPlines\dostartGNUPLOTpage}
>
> \long\def\dostartGNUPLOTpage#1\stopGNUPLOTpage
>  {\endgroup\startMPpage#1\stopMPpage}

Thanks a lot!!! The magic apparently works. I don't understand what
exactly the "obeylines" macro does (it seems that it just makes sure
that none of line endings get lost, not even inside definition
itself).

I had enough problems convincing the macro itself to work (metapost
was complaining about too long lines otherwise), but I would
definitely not come to the idea of ending the group even before the
real macro starts :)

Thanks again,
    Mojca
___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: How to prevent empty page after MPpage?
  2009-07-12 21:19       ` Mojca Miklavec
@ 2009-07-13  6:18         ` Vafa Khalighi
  2009-07-13  8:02           ` Hans Hagen
  2009-07-13  7:50         ` Hans Hagen
  1 sibling, 1 reply; 11+ messages in thread
From: Vafa Khalighi @ 2009-07-13  6:18 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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

>
>
> Thanks a lot!!! The magic apparently works. I don't understand what
> exactly the "obeylines" macro does (it seems that it just makes sure
> that none of line endings get lost, not even inside definition
> itself).
>
>

sometimes when you typeset a piece of text like poems, you actually want to
go to the next line, so one solution would be to put a \par at the end of
each line but if there are too much of these lines, then you will get sick
of typing \par at the end of each line and so there is a CS namely
\obeylines that does this automatically. Lets look at one example:

I am a Plain \TeX\ user,\par
and you are a Con\TeX t User,\par
There are other people who use La\TeX,\par
but we all are \TeX\ users.

{\obeylines
I am a Plain \TeX\ user,
and you are a Con\TeX t user.
There are other people who use La\TeX,
but we all are \TeX\ users.}

See in the above one, whenever I wanted to end the line and go to the next
line, I had to put a \par, but in the second one I just put \obeylines which
is the same that means ecah end of my lines will be treated like a \par.

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

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

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

* Re: How to prevent empty page after MPpage?
  2009-07-12 20:49   ` Mojca Miklavec
  2009-07-12 21:02     ` Wolfgang Schuster
@ 2009-07-13  7:47     ` Hans Hagen
  1 sibling, 0 replies; 11+ messages in thread
From: Hans Hagen @ 2009-07-13  7:47 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Mojca Miklavec wrote:
> On Sun, Jul 12, 2009 at 22:45, Hans Hagen wrote:
>> Mojca Miklavec wrote:
>>> Hello,
>>>
>>> The following code works OK in mkiv, but in mkii it generates a
>>> spurious empty page at the end. How can I get rid of it? (I think that
>>> it used to work OK a while ago.)
>>>
>>> \def\startGNUPLOTpage%
>>>        {\obeyMPlines\dostartGNUPLOTpage}
>>> \long\def\dostartGNUPLOTpage#1\stopGNUPLOTpage%
>>>        {\startMPpage#1\stopMPpage}
>>>
>>> \starttext
>>> \startGNUPLOTpage
>>> draw fullcircle scaled 3cm;
>>> \stopGNUPLOTpage
>>> \stoptext
>>
>> do you reset the color afterwards?
> 
> What color(s)? (I'm not sure that I understood the question.)
> 
> This is a complete minimal example (no need for any external package).
> It seems that \obeyMPlines or something related introduces a space
> somewhere, and that generates an empty page.

there is a node ending up on a page on its own, could be some skip or a 
special/literal (e.g. color related)

how does

\def\startGNUPLOTpage
   {\begingroup
    \obeyMPlines
    \dostartGNUPLOTpage}

\long\def\dostartGNUPLOTpage#1\stopGNUPLOTpage
   {\endgroup
    \startMPpage#1\stopMPpage}

perform? do you really need the \obeyMPlines?

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
      tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                              | 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://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: How to prevent empty page after MPpage?
  2009-07-12 21:19       ` Mojca Miklavec
  2009-07-13  6:18         ` Vafa Khalighi
@ 2009-07-13  7:50         ` Hans Hagen
  2009-07-13  8:56           ` Mojca Miklavec
  1 sibling, 1 reply; 11+ messages in thread
From: Hans Hagen @ 2009-07-13  7:50 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Mojca Miklavec wrote:
> On Sun, Jul 12, 2009 at 23:02, Wolfgang Schuster wrote:
>> Am 12.07.2009 um 22:49 schrieb Mojca Miklavec:
>>
>>> This is a complete minimal example (no need for any external package).
>>> It seems that \obeyMPlines or something related introduces a space
>>> somewhere, and that generates an empty page.
>> Why don't you use grouping then?

ah .. wolfgang was ahead of me -)

> I guess because I don't understand what's going on in the first place :)
> 
>> \def\startGNUPLOTpage
>>  {\begingroup\obeyMPlines\dostartGNUPLOTpage}
>>
>> \long\def\dostartGNUPLOTpage#1\stopGNUPLOTpage
>>  {\endgroup\startMPpage#1\stopMPpage}
> 
> Thanks a lot!!! The magic apparently works. I don't understand what
> exactly the "obeylines" macro does (it seems that it just makes sure
> that none of line endings get lost, not even inside definition
> itself).

it is not relevant here i think; there was a time when mp could not 
handle long lines so mkii has the option to split the source into lines 
(after a ;) which then makes mp happy

that restriction is no longer there

> I had enough problems convincing the macro itself to work (metapost
> was complaining about too long lines otherwise), but I would
> definitely not come to the idea of ending the group even before the
> real macro starts :)

oh? how old is your mp? can't you set the buffer to 200K in texmf.cnf?


Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
      tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                              | 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://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: How to prevent empty page after MPpage?
  2009-07-13  6:18         ` Vafa Khalighi
@ 2009-07-13  8:02           ` Hans Hagen
  0 siblings, 0 replies; 11+ messages in thread
From: Hans Hagen @ 2009-07-13  8:02 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Vafa Khalighi wrote:
>>
>> Thanks a lot!!! The magic apparently works. I don't understand what
>> exactly the "obeylines" macro does (it seems that it just makes sure
>> that none of line endings get lost, not even inside definition
>> itself).
>>
>>
> 
> sometimes when you typeset a piece of text like poems, you actually want to
> go to the next line, so one solution would be to put a \par at the end of
> each line but if there are too much of these lines, then you will get sick
> of typing \par at the end of each line and so there is a CS namely
> \obeylines that does this automatically. Lets look at one example:
> 
> I am a Plain \TeX\ user,\par
> and you are a Con\TeX t User,\par
> There are other people who use La\TeX,\par
> but we all are \TeX\ users.
> 
> {\obeylines
> I am a Plain \TeX\ user,
> and you are a Con\TeX t user.
> There are other people who use La\TeX,
> but we all are \TeX\ users.}
> 
> See in the above one, whenever I wanted to end the line and go to the next
> line, I had to put a \par, but in the second one I just put \obeylines which
> is the same that means ecah end of my lines will be treated like a \par.

\startlines
I am a Plain \TeX\ user,
and you are a Con\TeX t user.
There are other people who use La\TeX,
but we all are \TeX\ users.
\stoplines


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
      tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                              | 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://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: How to prevent empty page after MPpage?
  2009-07-13  7:50         ` Hans Hagen
@ 2009-07-13  8:56           ` Mojca Miklavec
  2009-07-13 12:40             ` Hans Hagen
  0 siblings, 1 reply; 11+ messages in thread
From: Mojca Miklavec @ 2009-07-13  8:56 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Mon, Jul 13, 2009 at 09:50, Hans Hagen wrote:
> Mojca Miklavec wrote:
>
>>> \def\startGNUPLOTpage
>>>  {\begingroup\obeyMPlines\dostartGNUPLOTpage}
>>>
>>> \long\def\dostartGNUPLOTpage#1\stopGNUPLOTpage
>>>  {\endgroup\startMPpage#1\stopMPpage}
>>
>> Thanks a lot!!! The magic apparently works. I don't understand what
>> exactly the "obeylines" macro does (it seems that it just makes sure
>> that none of line endings get lost, not even inside definition
>> itself).
>
> it is not relevant here i think; there was a time when mp could not handle
> long lines so mkii has the option to split the source into lines (after a ;)
> which then makes mp happy
>
> that restriction is no longer there

The macro handles both MKII and MKIV and I had problem in MKII. Not
all restrictions are gone now (I still get "memory limit exceeded" in
MKIV) and even if MP handles long lines now ... I don't want to risk
since the code is already there anyway.

>> I had enough problems convincing the macro itself to work (metapost
>> was complaining about too long lines otherwise), but I would
>> definitely not come to the idea of ending the group even before the
>> real macro starts :)
>
> oh? how old is your mp? can't you set the buffer to 200K in texmf.cnf?

That macro has been written back in 2006 I guess. I didn't try to
remove newlines, but the output of gnuplot could be as long as 1
million characters or more, so it's better to keep the lines splitted.
Not that those million characters would make sense: usually TeX
complains first about memory limit exceeded, but soon after that (even
in MKIV) metapost starts complaining. The TikZ terminal almost works
and that one manages to digest the contents (it just takes forever
before it's done).

(The point is not me trying to remove the limitation locally as any
other user will stumble upon the same limitation. I'll keep the
newlines there.)

To Vafa: I meant \obeyMPlines, not \obeylines, and that one behaves a
bit different.

Mojca
___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: How to prevent empty page after MPpage?
  2009-07-13  8:56           ` Mojca Miklavec
@ 2009-07-13 12:40             ` Hans Hagen
  0 siblings, 0 replies; 11+ messages in thread
From: Hans Hagen @ 2009-07-13 12:40 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Mojca Miklavec wrote:

> The macro handles both MKII and MKIV and I had problem in MKII. Not
> all restrictions are gone now (I still get "memory limit exceeded" in
> MKIV) and even if MP handles long lines now ... I don't want to risk
> since the code is already there anyway.

in mkiv you can use a dedicated instance for gnuplot graphics

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
      tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                              | 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://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

end of thread, other threads:[~2009-07-13 12:40 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-12 16:02 How to prevent empty page after MPpage? Mojca Miklavec
2009-07-12 20:45 ` Hans Hagen
2009-07-12 20:49   ` Mojca Miklavec
2009-07-12 21:02     ` Wolfgang Schuster
2009-07-12 21:19       ` Mojca Miklavec
2009-07-13  6:18         ` Vafa Khalighi
2009-07-13  8:02           ` Hans Hagen
2009-07-13  7:50         ` Hans Hagen
2009-07-13  8:56           ` Mojca Miklavec
2009-07-13 12:40             ` Hans Hagen
2009-07-13  7:47     ` Hans Hagen

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