1

I need to create a simple block showing recipe content. A tabulate seems as the easiest way to do that. Below is an example of what I mean

\starttext

\def\leaderfill{\leaders\hbox to 0.3em{\hss.\hss}\hfill}

\starttabulate[|p|l|Il|]
    \NC Item 1                  \leaderfill     200 \NC     \NC g   \NR
    \NC Item Item 2             \leaderfill     60  \NC     \NC ml  \NR
    \NC Item Item Item Item 3   \leaderfill     10  \NC     \NC ml  \NR
    \NC Item Item 4             \leaderfill     0   \NC.5   \NC g   \NR
    \NC Item Item 5             \leaderfill     0   \NC.25  \NC g   \NR
    \NC Very very very long name of Item 6          \NC     \NC     \NR
    \NC the rest of the name    \leaderfill 10--15  \NC     \NC pcs.\NR
\stoptabulate

\stoptext

The result is as follows:

enter image description here

To make fractions look correct, I need to remove the distance between the first and second columns (set zero width) and set the distance between the second and third ones equal to the width of a space character.

I've reviewed the Why are my tables running off the edge of the page in ConTeXt? topic, however, it hasn't helped me. Using o0 and s0 are break my table:

\starttabulate[o0|p|l|Il|]
    \NC Item 1                  \leaderfill     200 \NC     \NC g   \NR
    \NC Item Item 2             \leaderfill     60  \NC     \NC ml  \NR
    \NC Item Item Item Item 3   \leaderfill     10  \NC     \NC ml  \NR
    \NC Item Item 4             \leaderfill     0   \NC.5   \NC g   \NR
    \NC Item Item 5             \leaderfill     0   \NC.25  \NC g   \NR
    \NC Very very very long name of Item 6          \NC     \NC     \NR
    \NC the rest of the name    \leaderfill 10--15  \NC     \NC pcs.\NR
\stoptabulate

enter image description here

Using a fixed width for columns is undesirable since tables may be used in various width parent environments.

So, how can I set up a distance between columns in tabulate?

1 Answer 1

1

Welcome to the site!

You can use i and j to set space between columns, see the context garden.

This could be what you want (but have a look at the link above and play with the keys):

\starttabulate[|pj0|i0l|Il|]
     \NC Item 1                  \leaderfill     200 \NC     \NC g   \NR
     \NC Item Item 2             \leaderfill     60  \NC     \NC ml  \NR
     \NC Item Item Item Item 3   \leaderfill     10  \NC     \NC ml  \NR
     \NC Item Item 4             \leaderfill     0   \NC.5   \NC g   \NR
     \NC Item Item 5             \leaderfill     0   \NC.25  \NC g   \NR
     \NC Very very very long name of Item 6          \NC     \NC     \NR
     \NC the rest of the name    \leaderfill 10--15  \NC     \NC pcs.\NR
\stoptabulate

The output becomes (I used A5 paper to get a slightly tighter page):

the table

One could think of using the units module (or at least roman) for the units.

You must log in to answer this question.

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