On 7-8-2012 14:51, Sietse Brouwer wrote:
Hi Robert, Debugged and all, here you go. Cheers, Sietse
\useexternalfigure[img:fig:cow][cow.pdf] \useexternalfigure[img:fig:mill][mill.png]
\starttext
\section{Pictures} % The externalfigure names HAVE TO take the form 'img:FIGURELABEL', % or the automatic image list at the end on won't be able to % guess the image names from the figure labels. \placefigure[here][fig:cow] {cap-cow} {\externalfigure[img:fig:cow]}
\section{More pictures} \placefigure[here][fig:mill] {cap-mill} {\externalfigure[img:fig:mill]}
%%%% Lists start here %%%%%%% \enablemode[draft] \startmode[draft]
% Better list heading --- the captions are what matters \setupheadtext[figures=List of Captions] \completelistoffigures
% Now for printing all the images \section{List of Pictures} \startluacode -- we won't need the keys k, but still. for k,v in pairs(structures.lists.ordered.float.figure) do label_string = v.references.reference -- `..` is Lua for string concatenation image_string = "img:" .. label_string
-- TeX <--> Lua, passing arguments to commands -- [stuff] <--> { 'stuff' } -- [stuff=bother] <--> { stuff = 'bother' } -- {stuff} <--> 'stuff'
-- context.in() seems to have some Lua meaning -- so we print the command string directly, instead context("\\in{Figure}[" .. label_string .. "]") context.page( { 'no' } ) context.externalfigure( { image_string }, { 'here' } ) context.hairline() context.par() -- end paragraph end \stopluacode \stopmode
\stoptext
\starttext \placefigure{}{\externalfigure[mill]} \placefigure{}{\externalfigure[cow]} \page \startluacode context.bTABLE { spit = "yes", offset = "1ex" } for k, v in next, figures.found do inspect(v) context.bTR() context.bTD { width = "4cm", align = "middle" } context.dontleavehmode() context.externalfigure( { v.foundname }, { height = "2cm" } ) context.eTD() context.bTD() context(v.askedname) context.eTD() context.bTD() context(file.basename(v.foundname)) context.eTD() context.eTR() end context.eTABLE() \stopluacode \stoptext ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------