[NTG-context] Headers another way

Procházka Lukáš lpr at pontex.cz
Tue Feb 8 18:32:10 CET 2011


Hello,

I'm trying to solve an interesting problem.

(The document should be generated by Lua actually, but probably this is not of importance.)

I'd need create various headers, but it's not known which command to be used a priori; only their "relative position" is known.

The head creating command should be the same (= \HEAD) and the level should be determined by \PUSHHEAD + \POPHEAD commands.

I'd need to solve something like this:

---
\starttext
   \HEAD{...} % Should expand to \chapter
   \PUSHHEAD
     \HEAD{...} % Should expand to \section
     \PUSHHEAD
       \HEAD{...} % Should expand to \subsection
       \PUSHHEAD
         \HEAD{...} % Should expand to \subsubsection
         \PUSHHEAD
           \HEAD{...} % Should expand to \subsubsubsection
         \POPHEAD

         \HEAD{...} % Should expand to \subsubsection again
       \POPHEAD
     \POPHEAD
   \POPHEAD
\stoptext
---

Any idea how to solve this?

(The aim is that Lua should generate or not the \PUSHHEAD + \POPHEAD commands very simply; it's much easier to do this instead to define complicated rules whether to call \section or \subsection at a particular place.)

Best regards,

Lukas



More information about the ntg-context mailing list