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: Mon, 6 Aug 2012 18:14:53 +0200	[thread overview]
Message-ID: <CAF=dkzyVcW7d5X2mYCW0x_dHNCgVEq4gGF3yRKmUN60AAzZ+iQ@mail.gmail.com> (raw)
In-Reply-To: <501D04F7.7060407@mun.ca>

Hi Roger,

Firstly: drafts are indeed the way to go. \completelistoffigures
places a complete list of figure *captions*, so that takes care of
that.

% No need to define a mode: you can simply enable it with
% \enablemode[draft]
% or
% context --mode=draft
\enablemode[draft]

\startmode[draft]
\completelistoffigures
\stopmode

Figure images, unlike figure captions, are not saved to a list. A
pity, as this makes it difficult to get the associated figure image
given a figure number (or figure label). I would do this:
(1) make it so you can call the figure image with
\externalfigure[img:fig:mylabel]. Use \useexternalfigure for this.
(2) then label the figure with [fig:mylabel]
(3) then simply manually make an entry in the figures section for each
figure label.

Perhaps some ConTeXt user more familiar with lists can provide a
better, list-based, solution?

\useexternalfigure[img:fig:pointy graph][pointy-graph.png]

\placefigure
    [here]
    [fig:pointy graph]
    {caption of the pointy graph}
    {\externalfigure[img:fig:pointy graph][width=4cm]}

\startmode[draft]
\section{Just the figures}

\in{Figure}[fig:pointy graph]
\externalfigure[img:fig:pointy graph]

\stopmode

If you want to automate this, you'll want something like this.
Untested and probably needs debugging first, but the table names are
correct:

\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

  -- arguments to TeX commands:
  -- get [stuff] in TeX with { 'stuff' } in Lua
  -- get [stuff=bother] in TeX with { stuff = 'bother' } in Lua
  -- get {stuff} in TeX with 'stuff' in Lua
  context.in("Figure", { label_string })
  context.externalfigure( { image_string } )
end
\stopluacode

I have made this reply long because I lack the time to make it short.

Cheers,
Sietse
___________________________________________________________________________________
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
___________________________________________________________________________________


  reply	other threads:[~2012-08-06 16:14 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 [this message]
2012-08-07  9:19   ` Roger Mason
2012-08-07 12:51   ` Sietse Brouwer
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=dkzyVcW7d5X2mYCW0x_dHNCgVEq4gGF3yRKmUN60AAzZ+iQ@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).