Basic TeX question, how to redefine ^^M
Hi everybody, I want to insert some special thing between every paragraph, e.g., I'd like to make each paragraph on seperated pages. Then I use: ============================= \appendtoks\feedcurrentpage\to\everypar \def\feedcurrentpage{\page[yes]} ============================= and ConTeXt gives an error about TeX capacity exceeded. And I define: ===================== \def\^^M{\endgraf\page[yes]} ===================== nothing happened. So I'm lost. Can you tell me how to make it? -- Best Regards Chen ---------------------------------------------------------------- Zhi-chu Chen | Shanghai Synchrotron Radiation Facility No. 2019 | Jialuo Rd. | Jiading | Shanghai | P.R. China tel: 086 21 5955 3405 | zhichu.chen.googlepages.com | www.sinap.ac.cn ----------------------------------------------------------------
On Fri, 20 Apr 2007, Zhichu Chen wrote:
Hi everybody, ===================== \def\^^M{\endgraf\page[yes]} ===================== nothing happened.
So I'm lost. Can you tell me how to make it?
This seems to work for me: \starttext \catcode`\^^M=\active \def^^M{\page[yes]} This Test \stoptext Aditya
Hi Aditya,
Thank you for pointing out my foolish mistake.
On 4/20/07, Aditya Mahajan
On Fri, 20 Apr 2007, Zhichu Chen wrote:
Hi everybody, ===================== \def\^^M{\endgraf\page[yes]} ===================== nothing happened.
So I'm lost. Can you tell me how to make it?
This seems to work for me:
\starttext \catcode`\^^M=\active \def^^M{\page[yes]}
This
Test
\stoptext
Aditya _______________________________________________ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context
-- Best Regards Chen ---------------------------------------------------------------- Zhi-chu Chen | Shanghai Synchrotron Radiation Facility No. 2019 | Jialuo Rd. | Jiading | Shanghai | P.R. China tel: 086 21 5955 3405 | zhichu.chen.googlepages.com | www.sinap.ac.cn ----------------------------------------------------------------
On Fri, 20 Apr 2007, Zhichu Chen wrote:
Hi Aditya,
Thank you for pointing out my foolish mistake.
Remember that this only works if each paragraph is a single line. See the output of \starttext \catcode`\^^M=\active \def^^M{\page[yes]} \input knuth \stoptext Aditya
On 4/20/07, Aditya Mahajan
wrote: On Fri, 20 Apr 2007, Zhichu Chen wrote:
Hi everybody, ===================== \def\^^M{\endgraf\page[yes]} ===================== nothing happened.
So I'm lost. Can you tell me how to make it?
This seems to work for me:
\starttext \catcode`\^^M=\active \def^^M{\page[yes]}
This
Test
\stoptext
Aditya _______________________________________________ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context
-- Aditya Mahajan | EECS Systems, University of Michigan http://www.eecs.umich.edu/~adityam | Ph: 734.262.4008
Thanks Hans, your code is fine too.
On 4/20/07, Aditya Mahajan
On Fri, 20 Apr 2007, Zhichu Chen wrote:
Hi Aditya,
Thank you for pointing out my foolish mistake.
Remember that this only works if each paragraph is a single line. See the output of
\starttext \catcode`\^^M=\active \def^^M{\page[yes]}
\input knuth
\stoptext
Oh, it's bad. Maybe I shall define ^^M in a better way, like check the next character and if it's ^^M too, futurelet the next ^^M to be \page[yes]. I will think through the logic. Thanks Aditya. Aditya
On 4/20/07, Aditya Mahajan
wrote: On Fri, 20 Apr 2007, Zhichu Chen wrote:
Hi everybody, ===================== \def\^^M{\endgraf\page[yes]} ===================== nothing happened.
So I'm lost. Can you tell me how to make it?
This seems to work for me:
\starttext \catcode`\^^M=\active \def^^M{\page[yes]}
This
Test
\stoptext
Aditya _______________________________________________ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context
-- Aditya Mahajan | EECS Systems, University of Michigan http://www.eecs.umich.edu/~adityam | Ph: 734.262.4008 _______________________________________________ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context
-- Best Regards Chen ---------------------------------------------------------------- Zhi-chu Chen | Shanghai Synchrotron Radiation Facility No. 2019 | Jialuo Rd. | Jiading | Shanghai | P.R. China tel: 086 21 5955 3405 | zhichu.chen.googlepages.com | www.sinap.ac.cn ----------------------------------------------------------------
Hi, Aditya
I've made another definition, the output is OK, with some errors. Can you
tell me what's wrong?
==============================
\starttext
\catcode`\^^M=\active
\def^^M#1{\ifx#1^^M\page[yes]\else{} #1\fi}
Hello body
hello
Hi
\input knuth
\stoptext
=================================
On 4/20/07, Aditya Mahajan
On Fri, 20 Apr 2007, Zhichu Chen wrote:
Hi Aditya,
Thank you for pointing out my foolish mistake.
Remember that this only works if each paragraph is a single line. See the output of
\starttext \catcode`\^^M=\active \def^^M{\page[yes]}
\input knuth
\stoptext
Aditya
On 4/20/07, Aditya Mahajan
wrote: On Fri, 20 Apr 2007, Zhichu Chen wrote:
Hi everybody, ===================== \def\^^M{\endgraf\page[yes]} ===================== nothing happened.
So I'm lost. Can you tell me how to make it?
This seems to work for me:
\starttext \catcode`\^^M=\active \def^^M{\page[yes]}
This
Test
\stoptext
Aditya _______________________________________________ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context
-- Aditya Mahajan | EECS Systems, University of Michigan http://www.eecs.umich.edu/~adityam | Ph: 734.262.4008 _______________________________________________ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context
-- Best Regards Chen ---------------------------------------------------------------- Zhi-chu Chen | Shanghai Synchrotron Radiation Facility No. 2019 | Jialuo Rd. | Jiading | Shanghai | P.R. China tel: 086 21 5955 3405 | zhichu.chen.googlepages.com | www.sinap.ac.cn ----------------------------------------------------------------
On Mon, 23 Apr 2007, Zhichu Chen wrote:
Hi, Aditya
I've made another definition, the output is OK, with some errors. Can you tell me what's wrong?
Here is a more robust solution \everypar{% \let\normalpar\par% \let\par\donothing% \page[yes]% \let\par\normalpar} or \everypar{% \begingroup \let\par\donothing% \page[yes]% \endgroup} or \everypar{% \bgroup \let\par\donothing% \page[yes]% \egroup} Aditya
Aditya Mahajan wrote:
On Mon, 23 Apr 2007, Zhichu Chen wrote:
Hi, Aditya
I've made another definition, the output is OK, with some errors. Can you tell me what's wrong?
Here is a more robust solution
\everypar{% \let\normalpar\par% \let\par\donothing% \page[yes]% \let\par\normalpar}
or
\everypar{% \begingroup \let\par\donothing% \page[yes]% \endgroup}
or
\everypar{% \bgroup \let\par\donothing% \page[yes]% \egroup}
you loose a lot of features this way \EveryPar{} may be more helpful then or maybe \prependtoks\page[yes]\to\everypar
Aditya ___________________________________________________________________________________ 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 ___________________________________________________________________________________
-- ----------------------------------------------------------------- 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 -----------------------------------------------------------------
Hi Hans,
Thank you and thank Aditya for helping me so much.
Your codes are OK with some small test files. But in my file, pdftex just
hang up. I used page arrangement, and pop 26 sub-pages (\box255 or
something) onto a pdf page, and pdftex refuse to go on when the log shows
that the 14th page is been processing.
But the previous codes that you or Aditya gave me are OK with my complex
document:
both
======================
\obeylines
\def\obeyedline{\page[yes]}
======================
and
======================
\catcode`\^^M=\active
\def^^M{\page[yes]}
======================
works well with my document (since they are the same).
I will try to redefine ^^M to meet my need. And until I make it, I'll try to
write one paragraph on one line or put a comment symbol % at the end of a
line to avoid unwanted things.
I'm sorry I can't upload my file because it's a Chinese module and you need
to install the fonts, they are huge and messy. I think few of you are
interested in it.
On 4/23/07, Hans Hagen
Aditya Mahajan wrote:
On Mon, 23 Apr 2007, Zhichu Chen wrote:
Hi, Aditya
I've made another definition, the output is OK, with some errors. Can you tell me what's wrong?
Here is a more robust solution
\everypar{% \let\normalpar\par% \let\par\donothing% \page[yes]% \let\par\normalpar}
or
\everypar{% \begingroup \let\par\donothing% \page[yes]% \endgroup}
or
\everypar{% \bgroup \let\par\donothing% \page[yes]% \egroup}
you loose a lot of features this way
\EveryPar{}
may be more helpful then
or maybe
\prependtoks\page[yes]\to\everypar
Aditya
___________________________________________________________________________________
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
___________________________________________________________________________________
--
----------------------------------------------------------------- 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
___________________________________________________________________________________
-- Best Regards Chen ---------------------------------------------------------------- Zhi-chu Chen | Shanghai Synchrotron Radiation Facility No. 2019 | Jialuo Rd. | Jiading | Shanghai | P.R. China tel: 086 21 5955 3405 | zhichu.chen.googlepages.com | www.sinap.ac.cn ----------------------------------------------------------------
Aditya Mahajan wrote:
On Fri, 20 Apr 2007, Zhichu Chen wrote:
Hi everybody, ===================== \def\^^M{\endgraf\page[yes]} ===================== nothing happened.
So I'm lost. Can you tell me how to make it?
This seems to work for me:
\starttext \catcode`\^^M=\active \def^^M{\page[yes]}
This
Test
\stoptext
\obeylines \def\obeyedline{\page[yes]} should also work ----------------------------------------------------------------- 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 (3)
-
Aditya Mahajan
-
Hans Hagen
-
Zhichu Chen