3

I want to print some labels on label paper and therefore have to align pieces of text at very precise locations on the page. I'll have to measure the actual numbers again but it's something like 27 rows and 9 columns of labels, each being 2 cm wide and 1 cm high with about 2 mm distance between columns and no (0 mm) distance between rows.

Now my question is: How do I best do that in ConTeXt? My first idea was using a table mechanism but ideally I'd like to stay away from that and rather use something where I can just feed in the individual label contents and not worry about when a column is full and I have to go the next one.

I expect this would be possible with a combination of frameds and startcolumns but I can't get the frames to go where I want them:

\setupframed[width=2cm, height=1cm,after=]
\setupcolumns[distance=1.75mm]
\setuplayout[backspace=8mm,width=194mm,topspace=12mm,height=273mm]


\starttext
\startcolumns[n=9]
\dorecurse{50}{\framed{Label \recurselevel}}
\stopcolumns
\stoptext

The three problems I have are:

  1. It seems to ignore my topspace, it still starts way too low
  2. There is vertical space between the framed's and I don't know how to get rid of it
  3. Instead of completely filling the first column before going to the second, it seems to try and balance them out across all column. I'd rather have that done differently.

Can someone give me some pointers on how to fix those? Or is there another mechanism that's exactly made for this kind of problem that I'm overlooking?

1
  • 4
    1. Set the header to 0pt (\setuplayout[header=0pt]) 2. Disable the grid in the columns environment (\startcolumns[grid=no]) and prevent ConTeXt from adding space between frames (\setupinterlinespace[off]) 3. Disable columns balancing (\startcolumns[balance=no]) Feb 23, 2020 at 23:00

2 Answers 2

5

Using framed and columns

To stack frames in a columns environment without additonal spaces between the frames or an extra space at the top of each columns you have to make the following changes.

  1. Disable the grid for the columns to avoid extra space at the begin of each column.

  2. Disable the lineskip value which is inserted when the content between separate lines would touch.

  3. Disable column balancing to ensure each column is filled till the bottom until a new column is started.


\defineframed
  [Label]
  [ width=2.5cm,
   height=1cm]

\setuplayout
  [page]
  [backspace=8mm,
    topspace=13mm]

\setuplayout [page]

\setupinterlinespace [off]

\setupcolumns
  [       n=7,
   distance=2.5mm,
       grid=no,
    balance=no]

\starttext

\startcolumns
\dorecurse{200}{\Label{Label \recurselevel}}
\stopcolumns

\stoptext

Labels with the columns environment

Using the imposition mechanism

Instead of misusing the columns environment you could use the imposition mechanism to place multiple smaller pages on one large paper.

With the nx and ny key from \setuppaper you can set the number of rows and columns for your labels.


\definepapersize
  [label]
  [width=2.5cm,
   height=1cm]

\setuppapersize [label] [A4]

\setuppaper
  [nx=7,
   ny=27,
   dx=2.5mm,
   dy=1sp]

\setuplayout
  [page]
  [backspace=0.25ex,
    topspace=0.25ex]

\setuplayout [page]

\setuppaper
  [backspace=8mm,
    topspace=13mm]

\setuparranging [XY]

\setuplayout
  [location=middle]

\showframe [paper]

\starttext
\dorecurse{200}{Label \recurselevel\page}
\stoptext

Labels with the imposition mechanism

2
  • Placing "boxes" on a page (as in frameds) feels more intuitive to me than placing pages on a page, and also like less overhead. Is there an advantage to the second approach?
    – DP.
    Feb 24, 2020 at 22:56
  • What is better depends on your use case, with the frames you have better control about horizontal and vertical alignment and it's faster when you have many labels. WIth real pages you can create double sided labels for business cards, vocabulary cards etc. Feb 25, 2020 at 5:11
1

Using the modifications as commented by Wolfgang Schuster (and after measuring the paper again), this produces the PDF that I wanted:

\setupframed[width=2.5cm, height=1cm,after=]
\setupcolumns[distance=2.5mm]
\setuplayout[backspace=8mm,width=194mm,header=0mm,topspace=13mm,height=272mm,footer=0mm]
\setupinterlinespace[off]


\starttext
\startcolumns[n=7,grid=no,balance=no]
\dorecurse{200}{\framed{Label \recurselevel}}
\stopcolumns
\stoptext

You must log in to answer this question.

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