ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Sietse Brouwer <sbbrouwer@gmail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: Draft version of document
Date: Tue, 7 Aug 2012 14:51:26 +0200	[thread overview]
Message-ID: <CAF=dkzxa88YnERqyMD_8z=MmgXiE2=9=K9nBQMQ8WN=L1_1PBA@mail.gmail.com> (raw)
In-Reply-To: <CAF=dkzyVcW7d5X2mYCW0x_dHNCgVEq4gGF3yRKmUN60AAzZ+iQ@mail.gmail.com>

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
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


  parent reply	other threads:[~2012-08-07 12:51 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-04 11:18 Roger Mason
2012-08-06 16:14 ` Sietse Brouwer
2012-08-07  9:19   ` Roger Mason
2012-08-07 12:51   ` Sietse Brouwer [this message]
2012-08-07 14:37     ` Hans Hagen
2012-08-07 14:41     ` Hans Hagen
2012-08-08 15:04       ` Sietse Brouwer
2012-08-08 17:48         ` Wolfgang Schuster
2012-08-08 21:36           ` 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='CAF=dkzxa88YnERqyMD_8z=MmgXiE2=9=K9nBQMQ8WN=L1_1PBA@mail.gmail.com' \
    --to=sbbrouwer@gmail.com \
    --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).