0

I am trying to figuring out how to setup in ConTeXt a fluid grid to have all the elements of a catalog in a clear and recognizable pattern.

The more I read about grid and the more I am convinced that is working only aligning elements on the base lines while I need to define cells where putting inside my block composed by title, subtitle, bullet point, pictures and features.

Something closer to the HTML Grid: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Grid_Layout

I wonder if to create something closer to this example:

A simulation of grid like layout

I had better to create a table (as in the HTML4 age) and inside each cell using something like a "bounding box" to create relative coordinates. I can't imagine anything to abstract the graphic I made into ConTeXt basic commands, thanks! 🙏

4
  • 1
    I don’t know ConTeXt that well, but I guess, you just need to create boxes (minipages for example) of a certain width and height and place them next to each other. Boxes in TeX behave more or less like inline-block in CSS. As for fluidity: this is not really something that TeX supports, but the width of the boxes, for example, can be defined as multiples of \textwidth. Feb 25 at 7:16
  • 2
    You might wan't to consider speedata publisher
    – DG'
    Feb 25 at 8:44
  • Will all the pages look like in the image? I guess several TABLEs in a row could be an option for you. I'm less convinced about a grid based solution. Before I sit down and write code it could be good to have a clearer picture of what you want.
    – mickep
    Feb 25 at 11:53
  • 1
    @DG' I haven't realized that Speedata Pub was an open source project built on top TeX... Actually I think this is exactly what I am looking for and trying to achieve,,, It separate content from presentation by default. The paid service version is a plus for me. Thanks!
    – freezr
    Feb 27 at 0:29

1 Answer 1

4

Here is something that might get you started. I made a photo board out of all employees at work, and then I abused the bibliography system. That might work out OK for a catalog as well, as long as the different items do look more or less the same. If not, then I suggest that you ask a new question with perhaps a bit more information.

Note that what I do here could easily be done with a macro, but with a bibliography database (here in a buffer, but could be in a separate file) one is really separating layout and data. I am not sure how, but I am sure that one can also use a SQL database with the data (that might be even more convenient with a product catalog).

Anyways, this is how it looks:

a page

The code looks like this (I'm sorry if I forgot to delete/change some setup from the photo board I made at work):

\setupbodyfont[iwona]

\definemeasure[columnseparation][0.4cm]
\definemeasure[tablewidth][(\textwidth - 3\measured{columnseparation})/4]
\definemeasure[figwidth][\measured{tablewidth} - 2\measured{columnseparation}]
\definemeasure[figheight][2.6cm]
\definemeasure[tabletitleheight][1.25cm]
\definemeasure[tabledescriptionheight][1.5cm]
\definemeasure[tabelfigheight][\measured{figheight} + 2\measured{columnseparation}]

\setuplayout
  [backspace=1.5cm,
   topspace=1.5cm,
   margin=0cm,
   header=0cm,
   footer=0cm,
   height=fit,
   width=fit,
   ]

\setupexternalfigures
  [location={local,global,default}]

\useMPlibrary[dum]

\defineexternalfigure
  [catalogfigure]
  [width=\measure{figwidth},
   height=\measure{figheight},
   text=no]

\usecolors[crayola]

\startuseMPgraphic{TableBackground}
  path p ;
  p := unitsquare xyscaled(OverlayWidth, OverlayHeight) ;
  fill p superellipsed 0.97 withcolor "CulturedPearl" ;
  draw p superellipsed 0.97 withcolor "OceanBluePearl" ;
\stopuseMPgraphic

\defineoverlay
  [TableBackground]
  [\useMPgraphic{TableBackground}]

\setupTABLE[width=\measure{tablewidth},offset=\measured{columnseparation},frame=off]
\setupTABLE[r][1][height=\measure{tabletitleheight},align={middle,lohi},style={\definedfont[SansBold*default at 12pt]\setupinterlinespace}]
\setupTABLE[r][2][height=\measure{tabledescriptionheight},align={high},style={\definedfont[Sans*default at 8pt]\setupinterlinespace}]
\setupTABLE[r][3][height=\measure{tabelfigheight},align={middle,lohi}]


\startbuffer[catalog]
@catalogitem {foo1,
       title = {Test title},
 description = {This is a sentence about the current product.},
}
@catalogitem {foo2,
       title = {Test title},
 description = {This is a sentence about the current product.},
}
@catalogitem {foo3,
       title = {Test title},
 description = {This is a sentence about the current product.},
}
@catalogitem {foo4,
       title = {Test title},
 description = {This is a sentence about the current product.},
}
@catalogitem {foo5,
       title = {Test title},
 description = {This is a sentence about the current product.},
}
@catalogitem {foo6,
       title = {Test title},
 description = {This is a sentence about the current product.},
}
@catalogitem {foo7,
       title = {Test title},
 description = {This is a sentence about the current product.},
}
@catalogitem {foo8,
       title = {Test title},
 description = {This is a sentence about the current product.},
}
@catalogitem {foo9,
       title = {Test title},
 description = {This is a sentence about the current product.},
}
@catalogitem {cow,
       title = {Mew!},
 description = {This is indeed a cow.},
}
@catalogitem {bar1,
       title = {A little longer title},
 description = {This is a sentence about the current product. It continues with some more text.},
}
@catalogitem {bar2,
       title = {A little longer title},
 description = {This is a sentence about the current product. It continues with some more text.},
}
@catalogitem {bar3,
       title = {A little longer title},
 description = {This is a sentence about the current product. It continues with some more text.},
}
@catalogitem {bar4,
       title = {A little longer title},
 description = {This is a sentence about the current product. It continues with some more text.},
}
@catalogitem {bar5,
       title = {A little longer title},
 description = {This is a sentence about the current product. It continues with some more text.},
}
@catalogitem {bar6,
       title = {A little longer title},
 description = {This is a sentence about the current product. It continues with some more text.},
}
@catalogitem {bar7,
       title = {A little longer title},
 description = {This is a sentence about the current product. It continues with some more text.},
}
@catalogitem {bar8,
       title = {A little longer title},
 description = {This is a sentence about the current product. It continues with some more text.},
}
@catalogitem {bar9,
       title = {A little longer title},
 description = {This is a sentence about the current product. It continues with some more text.},
}
\stopbuffer

\definebtxdataset
  [catalog]

\usebtxdataset
  [catalog]
  [catalog.buffer]

\definebtx
  [catalog]
  [default=,
   specification=catalog]

\definebtxrendering
  [catalog]
  [specification=catalog,
   group=catalog,
   dataset=catalog,
   method=dataset,
   numbering=no,
   criterium=all]

\startsetups catalog
  \currentlistentrytitle\hskip\measured{columnseparation}
  \allowbreak
\stopsetups

\definelistalternative
  [catalog]
  [renderingsetup=catalog]

\setuplist
  [btx]
  [alternative=catalog]

\startsetups btx:catalog:list:catalogitem
  \startframed
    [offset=overlay,
    boffset=\measure{columnseparation},
    frame=off]
    \startframed
      [background=TableBackground,
      offset=overlay,
      frame=off]
      \bTABLE
        \bTR
          \bTD
            \begstrut\btxflush{title}\endstrut
          \eTD
        \eTR
        \bTR
          \bTD
            \begstrut\btxflush{description}\endstrut
          \eTD
        \eTR
        \bTR
          \bTD
            \externalfigure[\btxflush{tag}][catalogfigure]
          \eTD
        \eTR
      \eTABLE
    \stopframed
  \stopframed
\stopsetups

\starttext

\placebtxrendering[catalog]

\stoptext

This is a close up of a few items.

a closer look at some entries

3
  • This is pretty cool, and thanks for sharing. However it looks like you stretched tool that are meant for others stuff. Also I must admit that ConTeXt is not very suited to perform specific tasks, Speeddata Publishing marks many checkpoint, I mean as professional typesetter I expect to work based on a certain workflow even if I am using a GUI software, I found Speedata is closer to my mindset than ConTeXt, which I would use to create books, expecially complex ones, rather than to create a retail catalog.
    – freezr
    Feb 27 at 15:39
  • 1
    Please go on and use the tool that suits you. (I think you can do most things i. Context that you can do on skördats, though...)
    – mickep
    Feb 27 at 15:45
  • 1
    I am still in an explorative phase, I may try Speedata and coming back with a total different opinion. Who knows, certainly ConTeXt is extremely fascinating and I want go further and get more knowledge about it! Thanks, F.
    – freezr
    Feb 27 at 16:01

You must log in to answer this question.

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