2

I have some documents that use a register to keep track of items, that is then displayed in a list:

\defineregister[animals][pagenumber=no, indicator=no, before=, n=1]
\def\definegetanimal{\animals}
\define[1]\defineanimal{#1}
\starttext

    \defineanimal{cat}
    \defineanimal{pig}
    \defineanimal{sheep}
    
    \placeregister[animals]

\stoptext

I need to do some very simple formatting of the register, but whatever I try doesn't seem to work.

In one document, I need to display the register within a list:

\defineregister[animals][pagenumber=no, indicator=no, before=\item, n=1]
\def\definegetanimal{\animals}
\define[1]\defineanimal{#1}
\starttext

    \defineanimal{cat}
    \defineanimal{pig}
    \defineanimal{sheep}
    
    \startitemize[n]
        \placeregister[animals]
    \stopitemize

\stoptext

In another document, I need each item within a list to be displayed on its own on the page (i.e. a page break placed afterwards):

\defineregister[animals][pagenumber=no, indicator=no, before=, n=1, after=\pagebreak]
\def\definegetanimal{\animals}
\define[1]\defineanimal{#1}
\starttext

    \defineanimal{cat}
    \defineanimal{pig}
    \defineanimal{sheep}
    
    \placeregister[animals]

\stoptext

Neither of these worked, and I can't find any other \setup command that helps configure the appearance of the items appearing within the register's list.

How can I format the items within a register in ConTeXt?

1 Answer 1

4

If I get you right, you need to set \textcommand instead:

%\setuppapersize[A6]
\defineregister[animalsi]
    [pagenumber=no, 
     indicator=no, 
     n=1,
     before=,
     textcommand=\groupedcommand{\startitem}{\stopitem}]
\defineregister[animalsii][animalsi]
    [textcommand=\groupedcommand{}\page]
\animalsi{Ne}
\animalsi{ultra}
\animalsi{crepidam}
\animalsii{Feliz}
\animalsii{bicentenario}
\animalsii{Perú}
\starttext   
\startitemize[n]
\placeregister[animalsi]
\page
\placeregister[animalsii]
\stopitemize
\stoptext

For aliases, \let<whatever macro name I choose>\animalsi and so on is shorter and more direct than a \define solution IMO. enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .