How to prevent empty page after MPpage?
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
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 -----------------------------------------------------------------
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
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
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
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.
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 -----------------------------------------------------------------
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 -----------------------------------------------------------------
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
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 -----------------------------------------------------------------
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 -----------------------------------------------------------------
participants (4)
-
Hans Hagen
-
Mojca Miklavec
-
Vafa Khalighi
-
Wolfgang Schuster