[NTG-context] Grammar to parse TeX input?

Hans Hagen j.hagen at xs4all.nl
Wed Nov 28 11:43:01 CET 2018


On 11/28/2018 9:33 AM, Joseph Canedo wrote:
> I’d like to change some input to modify used font but only in parts of 
> it, for example to implement having first line with different font. So 
> basically if I have text with macros etc…:
% firstlines-001.tex

\setupbodyfont
   [pagella]

\setupalign
   [tolerant,stretch]

\setupfirstline
   [alternative=line,
    color=darkred,
    style=\setfontfeature{smallcaps}]

\setupfirstline
   [fancy]
   [n=3]

\setupfirstline
   [fancier]
   [alternative=word,
    color=darkblue,
    style=bold,
    n=3]

\setupfirstline
   [weirder]
   [alternative=line,
    color=darkgreen,
    style=\setfontfeature{smallcaps},
    n=3]

\setupinitial
   [location=text,
    n=2,
    color=darkred,
    voffset=1.2\lineheight,
    before={\blank[2*big]}]

% \enabletrackers[typesetters.firstlines,typesetters.initials]

\starttext

     \setfirstline

     \input ward \par

     \placeinitial

     \input ward \par

     \setupindenting[medium,yes]

     \setinitial % \placeinitial

     \input ward \par

     \setinitial %  \placeinitial
     \setfirstline

     \input ward \par

     \setfirstline[fancy]

     \input ward \par

     \setfirstline[fancier]

     \input ward \par

     \setinitial %  \placeinitial
     \setfirstline[weirder]

     \input ward \par

\stoptext

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------


More information about the ntg-context mailing list