ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Basic TeX question, how to redefine ^^M
@ 2007-04-20  3:33 Zhichu Chen
  2007-04-20  4:16 ` Aditya Mahajan
  0 siblings, 1 reply; 10+ messages in thread
From: Zhichu Chen @ 2007-04-20  3:33 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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

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

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

[-- Attachment #2: Type: text/plain, Size: 139 bytes --]

_______________________________________________
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context

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

* Re: Basic TeX question, how to redefine ^^M
  2007-04-20  3:33 Basic TeX question, how to redefine ^^M Zhichu Chen
@ 2007-04-20  4:16 ` Aditya Mahajan
  2007-04-20  4:22   ` Zhichu Chen
  2007-04-20  6:55   ` Hans Hagen
  0 siblings, 2 replies; 10+ messages in thread
From: Aditya Mahajan @ 2007-04-20  4:16 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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

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

* Re: Basic TeX question, how to redefine ^^M
  2007-04-20  4:16 ` Aditya Mahajan
@ 2007-04-20  4:22   ` Zhichu Chen
  2007-04-20 13:08     ` Aditya Mahajan
  2007-04-20  6:55   ` Hans Hagen
  1 sibling, 1 reply; 10+ messages in thread
From: Zhichu Chen @ 2007-04-20  4:22 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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

Hi Aditya,

Thank you for pointing out my foolish mistake.


On 4/20/07, Aditya Mahajan <adityam@umich.edu> 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
>



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

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

[-- Attachment #2: Type: text/plain, Size: 139 bytes --]

_______________________________________________
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context

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

* Re: Basic TeX question, how to redefine ^^M
  2007-04-20  4:16 ` Aditya Mahajan
  2007-04-20  4:22   ` Zhichu Chen
@ 2007-04-20  6:55   ` Hans Hagen
  1 sibling, 0 replies; 10+ messages in thread
From: Hans Hagen @ 2007-04-20  6:55 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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

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

* Re: Basic TeX question, how to redefine ^^M
  2007-04-20  4:22   ` Zhichu Chen
@ 2007-04-20 13:08     ` Aditya Mahajan
  2007-04-21 14:18       ` Zhichu Chen
  2007-04-23  4:43       ` Zhichu Chen
  0 siblings, 2 replies; 10+ messages in thread
From: Aditya Mahajan @ 2007-04-20 13:08 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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 <adityam@umich.edu> 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

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

* Re: Basic TeX question, how to redefine ^^M
  2007-04-20 13:08     ` Aditya Mahajan
@ 2007-04-21 14:18       ` Zhichu Chen
  2007-04-23  4:43       ` Zhichu Chen
  1 sibling, 0 replies; 10+ messages in thread
From: Zhichu Chen @ 2007-04-21 14:18 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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

Thanks Hans, your code is fine too.


On 4/20/07, Aditya Mahajan <adityam@umich.edu> wrote:
>
> 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 <adityam@umich.edu> 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
----------------------------------------------------------------

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

[-- Attachment #2: Type: text/plain, Size: 139 bytes --]

_______________________________________________
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context

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

* Re: Basic TeX question, how to redefine ^^M
  2007-04-20 13:08     ` Aditya Mahajan
  2007-04-21 14:18       ` Zhichu Chen
@ 2007-04-23  4:43       ` Zhichu Chen
  2007-04-23  7:26         ` Aditya Mahajan
  1 sibling, 1 reply; 10+ messages in thread
From: Zhichu Chen @ 2007-04-23  4:43 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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

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 <adityam@umich.edu> wrote:
>
> 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 <adityam@umich.edu> 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
----------------------------------------------------------------

[-- Attachment #1.2: Type: text/html, Size: 3659 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] 10+ messages in thread

* Re: Basic TeX question, how to redefine ^^M
  2007-04-23  4:43       ` Zhichu Chen
@ 2007-04-23  7:26         ` Aditya Mahajan
  2007-04-23  8:15           ` Hans Hagen
  0 siblings, 1 reply; 10+ messages in thread
From: Aditya Mahajan @ 2007-04-23  7:26 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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
___________________________________________________________________________________
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] 10+ messages in thread

* Re: Basic TeX question, how to redefine ^^M
  2007-04-23  7:26         ` Aditya Mahajan
@ 2007-04-23  8:15           ` Hans Hagen
  2007-04-24  9:27             ` Zhichu Chen
  0 siblings, 1 reply; 10+ messages in thread
From: Hans Hagen @ 2007-04-23  8:15 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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
___________________________________________________________________________________


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

* Re: Basic TeX question, how to redefine ^^M
  2007-04-23  8:15           ` Hans Hagen
@ 2007-04-24  9:27             ` Zhichu Chen
  0 siblings, 0 replies; 10+ messages in thread
From: Zhichu Chen @ 2007-04-24  9:27 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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

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 <pragma@wxs.nl> wrote:
>
> 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
----------------------------------------------------------------

[-- Attachment #1.2: Type: text/html, Size: 6097 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] 10+ messages in thread

end of thread, other threads:[~2007-04-24  9:27 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-04-20  3:33 Basic TeX question, how to redefine ^^M Zhichu Chen
2007-04-20  4:16 ` Aditya Mahajan
2007-04-20  4:22   ` Zhichu Chen
2007-04-20 13:08     ` Aditya Mahajan
2007-04-21 14:18       ` Zhichu Chen
2007-04-23  4:43       ` Zhichu Chen
2007-04-23  7:26         ` Aditya Mahajan
2007-04-23  8:15           ` Hans Hagen
2007-04-24  9:27             ` Zhichu Chen
2007-04-20  6:55   ` 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).