Changes

Jump to navigation Jump to search
1,242 bytes added ,  15:37, 11 February 2018
add postponing
< [[Using–GraphicsUsing Graphics]] >
If you’re using ConTeXt for complex layout tasks, you need to calculate with image sizes. Often it makes sense to use Lua functions.
\stoptabulate
</context>
 
== Calculations in Lua ==
 
<pre>
TEXpt = 65536 -- sp per pt
TEXptpi = 72.27 -- pt per inch
 
function sp2mm(n)
-- convert sp into mm
return math.floor(n * 35.28 / TEXpt)/100
end
 
function glue2num(glue)
-- convert TeX glue (e.g. skips) into dimensions(? or numbers)
return glue.width + (glue.stretch * glue.stretch_order) - (glue.shrink * glue.shrink_order)
end
 
function ImgSize(resolution)
local filename = figures.current().status.fullname -- current image
local pic = img.scan{filename = filename}
local picH = pic.ysize * TEXptpi * TEXpt / resolution -- picture height in sp
local picW = pic.xsize * TEXptpi * TEXpt / resolution -- picture width in sp
context("height=" .. picH .. ",width=" .. picW)
end
</pre>
 
== Postponing ==
 
If you want to place full page images or similar content on distinct pages, try the postponing mechanism:
 
<texcode>
\definemakeup[fullpage][
page=no,
doublesided=no,
% headerstate=empty,
% footerstate=empty,
pagestate=start,
]
 
\startpostponing[pagenumber]
\startfullpagemakeup
% use \setlayer & friends
\stopfullpagemakeup
\stoppostponing
</texcode>
 
The pagenumber argument can be absolute or relative, e.g. 23 or +2. Values like +0 or -1 might fit your usecase.
 
((WORK IN PROGRESS))

Navigation menu