[Pmwiki-users] Possibility of image captions

John Rankin john.rankin
Mon Aug 23 18:23:44 CDT 2004


We need a consistent way to provide captions for images. We have come up with 2 options and would appreciate comments or suggestions.

The problem:
============
We use action=publish + pdf2you to typeset a collection of pmwiki pages into pdf using LaTeX, to produce high quality printed layout.

We need a way to keep a figure's caption with the image, avoiding splits across page boundaries.

We tried putting the image into a one-celled table and using the table caption markup, but this has at least 3 problems:
- images occasionally float to the top of the next page, marooning the caption on the previous page
- one really wants table captions above and figure captions below the content
- it prevents the possibility of generating separate lists of figures and tables

As I understand it, XHTML2 proposes to let a <caption> be associated with an <object>, but this is not part of XHTML1.

Solutions:
==========
If pdf2you can detect an image and its caption in the XHTML, it can generate suitable TeX to take care of it.

We see 2 possible solutions using PmWiki 1.x (2.x may offer more):
a. look for [[Attach:xxx.yyy some text]] and if yyy is an image type...
    if the file hasn't been uploaded, use 'some text' as the display string (as it does now)

    if the file has been uploaded, use 'some text' as the text of a title (or alt) attribute on the img tag, and have pdf2you use the title (or alt) text as a caption -- the text is a tool tip on the web, visible in the printed version


b. introduce a special start of line markup, such as (again yyy is an image type)
    =figure Attach:xxx.yyy:some text

that turns into something like:
    <div class='figure'>
        <p>Attach:xxx.yyy</p><p>some text</p>
    </div>

and have pdf2you detect and deal with this special div class

Comment:
========
'Attach:' could of course also be 'http://'.

I think I prefer option a, as it doesn't require a special case and hence could work anywhere that someone puts a title attribute on an img tag. It could also potentially migrate better to xhtml2. OTOH, option (a) hides the caption on the web, whereas it's visible in option (b).

I can see how to do option (b) very easily as a local pmwiki customisation; I *think* I can see how to use a local FmtUrlLink function in option (a). At the moment, pmwiki produces a link to the image, with 'some text' as the text -- what you'd expect it to do. So it *should* be do-able.

I have 4 questions:
1. should pmwiki include figure caption support?
2. if so, what should the markup be?
3. in the mean time, should I go with option (a), (b) or something else?
4. if I use option (a), are there any traps for the unwary?

Thanks in advance for any suggestions. I can provide information and a demo on pdf2you for anyone who is interested.
-- 
JR
--
John Rankin





More information about the pmwiki-users mailing list