Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

ConTeXt beginner, typesetting recipe book

51 views
Skip to first unread message

amo...@gmail.com

unread,
Jan 31, 2007, 9:30:17 AM1/31/07
to
I'm just starting learning ConTeXt, and plan to use it to typeset a
recipe book. This will be printed in full colour and should have an
attractive layout akin to a glossy magazine -- I'm demanding a lot
from my typesetting system! I decided on ConTeXt after seeing some of
the PDF examples; it seems able to make more sophisticated layouts
than LaTeX.

I plan to use one product for each chapter and one component for each
recipe. Does this sound a sensible way of structuring the project?

Within each c_ file (one per recipe), I'll mark up the ingredients
with \startingredients and \ingredient{120g flour}. Then I'll have
\startmethod and the method will be formatted as normal paragraphs.
But in which file should I define the ingredients and method macros?

Sorry if these questions seem a bit obvious. I want to get this right
first time, at least regarding the structure of the recipe files,
since changing hundreds of them would be a trial.

Thanks for your help!

Sanjoy Mahajan

unread,
Jan 31, 2007, 11:00:15 AM1/31/07
to
> I'm just starting learning ConTeXt

The wiki is helpful <contextgarden.net>, as is the mailing list.

> I plan to use one product for each chapter and one component for
> each recipe. Does this sound a sensible way of structuring the
> project?

Only if you want to publish chapters one by one. But if, as I imagine
is the case, you want to publish all the chapters as a book, then make
the whole book the product with each chapter a component. You
shouldn't be texexecing the project file (which is just for setup
information), only the product or component files.

> But in which file should I define the ingredients and method macros?

Put them in an environment file included by the project file or by the
product file.

Here's is how I use projects/products/components in my current
mathematics course (<web.mit.edu/18.098/>). The project has one
product, notes.tex (a textbook), as well as several pieces that aren't
grouped into products, but they share definitions. Some definitions
are shared, like the printing papersize (letter), but some are
specific to the product: for example, the textbook product uses a
different typesetting page size (7"x9", for eventual trimming),
whereas the handouts and problem sets typeset for letter paper.

Here is the file
structure:

env.tex % project-wide definitions
street-fighting-math.tex % project file (mentions env.tex)

handouts/env_handouts.tex % common definitions for the handouts
% some overriding the global ../env.tex
handouts/nigeria.tex
handouts/reading-memos.tex
handouts/sine-picture.tex
handouts/syllabus.tex
handouts/your-turn.tex

notes/notes.tex % product file (a textbook):
% mentions env_notes.tex
notes/env_notes.tex % definitions common to the product
notes/analogy-again.tex % one component (chapter in the textbook)
notes/analogy.tex % another component
notes/dimensions.tex
notes/discretization.tex
notes/extreme-cases.tex
notes/generalization.tex
notes/picture-proofs.tex
notes/taking-out-the-big-part.tex
notes/why.tex

% 1.tex, s1.tex etc. use env_problems.tex plus the project-wide ../env.tex
problems/env_problems.tex % defintions common to the problems/solutions
problems/1.tex % problem set 1
problems/2.tex
problems/s1.tex
problems/s2.tex

When I say 'uses an environment file' or 'mentions blah.tex', here's
an example, from problems/1.tex:

\environment env % finds ../env.tex, the global settings
\environment env_problems % ./env_problems.tex to override any of thse
\starttext
...

Hope that helps,

-Sanjoy

`Not all those who wander are lost.' (J.R.R. Tolkien)

amo...@gmail.com

unread,
Jan 31, 2007, 2:57:44 PM1/31/07
to
> > I plan to use one product for each chapter and one component for
> > each recipe. Does this sound a sensible way of structuring the
> > project?
>
> Only if you want to publish chapters one by one. But if, as I imagine
> is the case, you want to publish all the chapters as a book, then make
> the whole book the product with each chapter a component. You
> shouldn't be texexecing the project file (which is just for setup
> information), only the product or component files.

I don't plan on publishing the chapters separately. I was thinking of
doing it that way so as to be able to re-order recipes within a
chapter more easily.

So you're suggesting I have just one project file, one product file,
and one component file per chapter? That certainly reduces the file
count, at least :)

amo...@gmail.com

unread,
Jan 31, 2007, 7:13:22 PM1/31/07
to
Just a quick macro question: the following code gives me an error:

\definestartstop[ingredients][
before={\startitemize },
after={\stopitemize }]

\def\ingredient #1{\item #1}

\startingredients
\ingredient{juice}
\ingredient{jam}
\stopingredients

The error is: "Extra }, or forgotten \endgroup", and it seems to refer
to the \stopingredients command. Any ideas?

Sanjoy Mahajan

unread,
Jan 31, 2007, 10:53:38 PM1/31/07
to
I don't now why that doesn't work, but I don't understand
definestartstop very well. But you'd get a quick and useful answer on
the ConTeXt email list.

Aditya Mahajan

unread,
Jan 31, 2007, 11:57:16 PM1/31/07
to

I do not know why this error is occuring. However, if you want to
define something like itemize, ConTeXt has a formal way of doing this.

% Define a new itemgroup called ingredients

\defineitemgroup [ingredients]

% You can now also use
% \setupitemgroup [ingredients] [each] [joinedup]
% etc to customize ingredients independent of other itemgroups


% Now lets make ingredient behave like \item

\appendtoks \let\ingredient \itemgroupitem \to \itemgroupcommands

% Note that this is done inside the itemgroupcommands token. This is
% so that \ingredient is only defined inside itemgroups and does not
% cause any interference outside them. You can also say
% \let\ingredient \itemgroupitem
% and that would also work fine.

% Now everything works :)
\starttext


\startingredients
\ingredient juice
\ingredient jam
\stopingredients

\stoptext

Aditya

amo...@gmail.com

unread,
Feb 1, 2007, 8:43:46 AM2/1/07
to
> I do not know why this error is occuring. However, if you want to
> define something like itemize, ConTeXt has a formal way of doing this.

Excellent! Works like a charm.

This is the sort of thing that I believe the documentation misses
slightly. There's so many ways to do things, it's hard to pick the
best one!

Maybe when I've learnt a few more things I'll start adding to the wiki.

0 new messages