ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* more problems ;-)
@ 2001-02-08 18:03 Uwe Koloska
  2001-02-09  7:23 ` Taco Hoekwater
  0 siblings, 1 reply; 3+ messages in thread
From: Uwe Koloska @ 2001-02-08 18:03 UTC (permalink / raw)


Hello,

1. \page[disable] seems not only to disable the next pagebreak -- it
   affects all following \page commands.  Is this right?  And is there
   a setting that only affects the next \page?

   Why?  In the FAQ there is a pagebreak before each new question.  Til I
   implement some better alternative for structuring I want to write
   \section{} and have no pagebreak after the section.  So I used
   \setuphead[section][after={\blank[disable]}] but then all pagebreaks
   are disabled.  So I have to add at the start of a question
   \page[reset,yes].

   is it possible to force a pagebreak?  I want to force every section on a
   new page.  With the above settings, the section break is disabled by the
   former section command if there is no question ...

2. What's wrong with
     \define[1]\command{\type{#1}}
     \command{\par}
   I get the error:
     Runaway argument?
     {
     ! Paragraph ended before \command was complete.
     <to be read again>
                        \par
     l.39 \command{\par
                       }). 

   but \type{\par} works as expected.  The text is inside a block. Maybe
   that's the reason.  But how can \command be defined to work right.

Uwe

-- 
mailto:koloska@rcs.urz.tu-dresden.de
http://rcswww.urz.tu-dresden.de/~koloska/
--                                    --
right now the web page is in german only
but this will change as time goes by ;-)


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

* Re: more problems ;-)
  2001-02-08 18:03 more problems ;-) Uwe Koloska
@ 2001-02-09  7:23 ` Taco Hoekwater
  2001-02-09  9:51   ` Hans Hagen
  0 siblings, 1 reply; 3+ messages in thread
From: Taco Hoekwater @ 2001-02-09  7:23 UTC (permalink / raw)


Uwe Koloska wrote:
> 
>    I get the error:
>      Runaway argument?
>      {
>      ! Paragraph ended before \command was complete.
>      <to be read again>
>                         \par
>      l.39 \command{\par
>                        }).

This is standard TeX behaviour: If you don't explicitly allow
\par's in arguments (by using \long\def), you get a runaway
error it the \par appears in the argument anyway.

\define does not have support for prefixes, so you need
to use the old-fashioned TeX command:

\long\def\command#1{\type{#1}}

or, alternatively, you can use \let:

\let\command\type

which is faster (it assigns \command to the current meaning of \type)

-- 
groeten,

Taco


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

* Re: more problems ;-)
  2001-02-09  7:23 ` Taco Hoekwater
@ 2001-02-09  9:51   ` Hans Hagen
  0 siblings, 0 replies; 3+ messages in thread
From: Hans Hagen @ 2001-02-09  9:51 UTC (permalink / raw)
  Cc: ntg-context

[-- Attachment #1: Type: text/plain, Size: 1176 bytes --]

At 08:23 AM 2/9/01 +0100, Taco Hoekwater wrote:
>Uwe Koloska wrote:
>> 
>>    I get the error:
>>      Runaway argument?
>>      {
>>      ! Paragraph ended before \command was complete.
>>      <to be read again>
>>                         \par
>>      l.39 \command{\par
>>                        }).
>
>This is standard TeX behaviour: If you don't explicitly allow
>\par's in arguments (by using \long\def), you get a runaway
>error it the \par appears in the argument anyway.
>
>\define does not have support for prefixes, so you need
>to use the old-fashioned TeX command:
>
>\long\def\command#1{\type{#1}}
>
>or, alternatively, you can use \let:
>
>\let\command\type
>
>which is faster (it assigns \command to the current meaning of \type)

If you want more fancy things: 

\define\mytype
  {\bgroup**\processinlineverbatim{**\egroup}}

\mytype {test \par \rubish{}}

Now, what you really want is:

\setupcolors[state=start]

\definetype[rubish][color=red]

\rubish{some tex \xxtext{} met $math$}

\definetype[morerubish][color=green,style=\ttsl]

\morerubish{some tex \xxtext{} met $math$}

see attachment [these kind of extensions fall in the category trivial]

Hans 

[-- Attachment #2: moretype.tex --]
[-- Type: text/plain, Size: 1762 bytes --]

% output=pdftex interface=en

\unprotect 

\def\setuptype%
  {\dodoubleempty\dosetuptype}

\def\dosetuptype[#1][#2]%
  {\ifsecondargument
     \getparameters[\??ty#1][#2]%
   \else
     \getparameters[\??ty][#1]%
   \fi}

\def\definetype%
  {\dodoubleempty\dodefinetype}

\def\dodefinetype[#1][#2]%
  {\unexpanded\setvalue{#1}{\dotype{#1}}%
   \copyparameters
     [\??ty#1][\??ty]
     [\c!spatie,\c!kleur,\c!letter,\c!pagina,\c!tab,\c!optie]%
   \getparameters[\??ty#1][#2]}

\let\@@currenttype\empty

\def\initializetype%
  {\let\obeylines=\ignorelines
   \setupcommonverbatim{\??ty\@@currenttype}%
   \setupinlineverbatim}

\unexpanded\def\type%
  {\dotype\empty}

\def\dotype#1%
  {\bgroup
   \def\@@currenttype{#1}%
   \catcode`\<=\@@other
   \catcode`\>=\@@other
   \futurelet\next\dodotype}

\def\dodotype%
  {\ifx\next\bgroup
     \initializetype
     \initializetypegrouping
     \def\next%
       {\afterassignment\protectfirsttype\let\next=}%
   \else\if\next<%
     \doifelsevalue{\??ty\@@currenttype\c!optie}{\v!geen}
       {\initializetype
        \setupnotypegrouping
        \def\next%
          {\let\next=}}
       {\def\next<##1%
          {\initializetype
           \if##1<%
           \else
             \setupalternativetypegrouping
             ##1%
           \fi}}%
   \else
     \def\next##1%
       {\initializetype
        \catcode`##1=\@@endgroup}%
   \fi\fi
   \verbatimcolor
   \next}

\def\setgroupedtype%
  {\initializetype
   \catcode`\{=\@@begingroup
   \catcode`\}=\@@endgroup}

\protect 

\starttext 

\setupbodyfont[pos]
\setupcolors[state=start]
\definetype[rubish][color=red]
\rubish{some tex \xxtext{} met $math$}
\definetype[morerubish][color=green,style=\ttsl]
\morerubish{some tex \xxtext{} met $math$}

\stoptekst

[-- Attachment #3: moretype.pdf --]
[-- Type: application/pdf, Size: 3142 bytes --]

[-- Attachment #4: Type: text/plain, Size: 370 bytes --]

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

end of thread, other threads:[~2001-02-09  9:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-02-08 18:03 more problems ;-) Uwe Koloska
2001-02-09  7:23 ` Taco Hoekwater
2001-02-09  9:51   ` 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).