[NTG-context] Hello -- and RFH (Request For Help) for privately typesetting a new travelling book

Hans Hagen pragma at wxs.nl
Mon Mar 9 23:14:17 CET 2015

```On 3/9/2015 10:00 PM, Harald Koenig wrote:
> Hello ConTeXt users!
>
> since I'm new to this list (and the group of context users;) a quick introduction
> to myself and my current project:
>
> I've been using LaTeX since 1986 -- some of you may know me from some TeX meetings
> (and recently also the context users's meetings -- without really using context so far).
>
> in 2009 using LaTeX I typeset a 100 page diary+pictures book about a group tour
> from our parish to Israel and Jordan.  making text flowing around the picutres
> with LaTeX (in the way I'd like to typeset it) was a real nightmare with LaTeX.
>
> so after finishing that project with LaTeX due to severe time constraints,
> I've used that text to convert it to context and learn a bit how this book
> can be typeset (much better?) using context -- mostly whenever I met Hans
> at every tex conference I could et hands on him, and also Willi and other helpers!
> but the "context-way" Isreal book  always remained unfinished or at least unpolished
> as there was no need (and again no time) to really perfectly finish up.
>
>
> now this happend again:
> recently I've been traveling through India, again with a group of our parish.
> and again, there was that idea to make such a nice book like for the Isreal tour.
> so this time, I'd like to use context instead of latex...
>
>
> BUT, there are still quite some issues where I'll need *your* help
> to make this really work and get a nice book.
>
> I'll try to split up my questions into separate mails,
> hopefully with small to minimal examples if possible
> (and if you'd like to get hards on my complete ugly tex code,
> plesae feel free to ask me!... ;-)

Hi Harald,

% In most of our projects we need to do some kind of conversion and
% for that we use some built-in trickery. You can define a converter
% like this:

\startluacode

figures.converters.jpg = figures.converters.jpg or { }

figures.converters.jpg["lowresjpg.pdf"] =
function(oldname,newname,resolution)
figures.programs.run (
[[gm]],
[[convert -geometry %resolution%x%resolution% -compress
JPEG "%oldname%" "%newname%"]],
{
oldname    = oldname,
newname    = newname,
resolution = resolution,
}
)
end

\stopluacode

% This will downsample and make a pdf which loads faster.  As we
% want to use some resolution we specify that here. When a graphic
% is updated or when the resolution changes the process is done
% automatically. You can delete m_k_v_i* files if you want to
% clean up.

\setupexternalfigures
[order={pdf,jpg},
resolution=100, % experiment with a value
method=auto]

% In case it doesn't work this shows some log:

% \enabletrackers[graphics.*]

% Then, in the source you can do this the following.

\starttext

\externalfigure[france-2015.jpg][height=10cm]
\externalfigure[france-2015.jpg][height=10cm,conversion=lowresjpg.pdf]

\stoptext

I'm sure you can figure out the right 'gm' parameters. In grph-inc.lua
you can see some predefined converters, e.g. we use:

\enabledirectives[graphics.conversion.eps.cleanup.ai]
\enabledirectives[graphics.extracheck]

\setupexternalfigures
[order={pdf,eps,png,jpg},
conversion=cmyk.pdf,
method=auto]

(which btw assumes some color profiles to be present but these are in
the latest minimals)

Hans

-----------------------------------------------------------------