[NTG-context] TeX: Macro definition

Wolfgang Schuster schuster.wolfgang at googlemail.com
Thu Apr 7 11:45:06 CEST 2011


Am 07.04.2011 um 11:27 schrieb Procházka Lukáš Ing. - Pontex s. r. o.:

> Hello,
> 
> how to define a macro to take the new-line character as end-of-parameter?
> 
> The following macro:
> 
> \def\T#1\par{#1}
> 
> takes everything until \par (or empty line as it equals \par primitive) as #1, so the following is valid:
> 
> \T abc def\par
> \T abc
> 
> \T def
> 
> (#1 becomes: "abc def", "abc" and "def".)
> 
> How to define the same macro to accept end-of-line as end-of-parameter?
> 
> I tried (although I'm aware this may not lead to the goal):
> 
> \def\T#1^^M{#1}
> 
> or
> 
> \def\T#1\crlf{#1}
> 
> to allow writing:
> 
> \T abc def
> \T abc
> \T def
> 
> So how to define the macro?

\bgroup
\obeylines
\gdef\foo{\bgroup\obeylines\dofoo}%
\gdef\dofoo#1
  {\egroup%
   “#1”}%
\egroup

\starttext
<\foo some text
>
\stoptext

but don’t use it because this isn’t context style and we have
already enough exceptions with \DESCRIPTION and \item.

Wolfgang



More information about the ntg-context mailing list