From: Hans Hagen <pragma@wxs.nl>
Subject: Re: Automatic typesetting of catalogue entries
Date: Mon, 27 Mar 2006 18:08:04 +0200 [thread overview]
Message-ID: <44280DE4.6080706@wxs.nl> (raw)
In-Reply-To: <20060327131714.GA4710@mnw.art.pl>
Piotr Kopszak wrote:
> Hello list,
>
> This is a more general question so I'm not attaching any specific
> code examples but rather will try to explain what I'm thinking
> about. I'm going to typeset a catalogue of about 200 objects. Each
> entry consists of two main parts: a block of text and a photograph of the
> object. As we have to be economic rather than luxurious I adjust
> manually the size of each figure so that the text fills the rest of the
> page entirely. That means I keep on incrementing the figure width
> until the text spills onto next page, then I go back to the last value
> that was OK. Sometimes I have to squeeze two entries on one page so
> that each occupies half of a page. Perfectly repetitive task at which
> computer would do much better than human. Sorry if it's something
> trivial but I couldn't find any solution on my own.
>
> Thanks for any hints in advance
>
i have no time to explain the details so it's up to you to wikify this ...
\showframe
\newcounter\WhateverCounter
% quick and dirty, each text + figure gets half a page and the
% graphic fills the available area
\long\def\StartWhatever[#1]#2\StopWhatever
{\blank
#2
\blank
\doglobal\increment\WhateverCounter
\startlinecorrection
\ifodd\WhateverCounter\relax
% first on page
\scratchdimen\dimexpr.5\textheight-\pagetotal-\lineheight\relax
\expanded{\externalfigure[#1][frame=on,height=\the\scratchdimen]}
\else
% second on page
\scratchdimen\dimexpr\pagegoal-\pagetotal-\lineheight\relax
\expanded{\externalfigure[#1][frame=on,height=\the\scratchdimen]}
\fi
\stoplinecorrection}
% distribute the graphics over the page
\long\def\StartWhatever[#1]#2\StopWhatever
{\blank
#2
\blank
\doglobal\increment\WhateverCounter
\hpos{b:\WhateverCounter}{\strut}
\vfill
\scratchdimen\dimexpr\MPy{b:\WhateverCounter}-\MPy{e:\WhateverCounter}+\lineheight\relax
\setbox\scratchbox\hbox{\expanded{\externalfigure[#1][frame=on,height=\the\scratchdimen]}}
\ht\scratchbox\strutheight
\hpos{e:\WhateverCounter}{\strut\box\scratchbox}
\ifodd\WhateverCounter\relax
\else
\page
\fi}
\starttext
\dorecurse{20} {
\StartWhatever[cow.pdf]
\getrandomcount\scratchcounter{1}{3}
\input \ifcase\scratchcounter tufte \or davis \or ward \or zapf \else bryson \fi \relax
\StopWhatever
}
\stoptext
implementing solutions is not that hard; it mostly depends on preferences and boundary conditions
Hans
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
| www.pragma-pod.nl
-----------------------------------------------------------------
next prev parent reply other threads:[~2006-03-27 16:08 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-03-27 13:17 Piotr Kopszak
2006-03-27 16:08 ` Hans Hagen [this message]
2006-03-27 17:10 ` Piotr Kopszak
2006-03-28 8:03 ` Taco Hoekwater
2006-03-28 8:16 ` Hans Hagen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=44280DE4.6080706@wxs.nl \
--to=pragma@wxs.nl \
--cc=ntg-context@ntg.nl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).