ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Wolfgang Schuster <schuster.wolfgang@googlemail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: Caption textcommand option
Date: Tue, 19 Oct 2010 20:15:37 +0200	[thread overview]
Message-ID: <23F5E984-3AA9-4175-ABBA-B93278FBC034@gmail.com> (raw)
In-Reply-To: <AANLkTinuPvqpgC89i-LR4C9DsTuv1t51rZRauXdnmS0h@mail.gmail.com>


Am 19.10.2010 um 16:55 schrieb Cedric Mauclair:

>>> Would it be possible to add an options to the captions with name
>>> textcommand to typeset the caption text only. In French, we use a
>>> point at the end of the captions, but if I want to use \about...
>>> somewhere, I end up with the dot too, which I don't want.
>>> 
>>> [...]
>> 
>> Make a complete example to show us what do you want to achieve before you try to modify commands.
> 
> Here is a minimal example. I would like the first caption and the second reference.


Indeed, there is no simple way to achieve what you want and textcommand
is the easiest solution (but i would include the strut in the command), e.g.


<example id="1">
\unprotected\long\def\putcompletecaption#1#2%
  {\doifsomething{\floatcaptionparameter\c!spacebefore}{\blank[\floatcaptionparameter\c!spacebefore]}%
% \floatcaptionparameter\c!before % test for side effects first
   \noindent
   \xdef\lastcaptiontag{\strut#1}%
   \dostartattributes{\??kj\currentfloat}\c!style\c!color\empty
     \ifnofloatnumber
     \else
       \hbox{\doattributes{\??kj\currentfloat}\c!headstyle\c!headcolor{\strut#1}}%
       \ifnofloatcaption \else \ifemptyfloatcaption \else
         \doifelsenothing{\floatcaptionparameter\c!spaceinbetween}
           {\scratchskip\floatcaptionparameter\c!distance\relax
            \dotfskip\scratchskip\emergencystretch.5\scratchskip}
           {\blank[\floatcaptionparameter\c!spaceinbetween]}%
       \fi \fi
     \fi
     \ifnofloatcaption
       \globallet\lastcaptionht\!!zeropoint
       \globallet\lastcaptiondp\!!zeropoint
     \else
       \doattributes{\??kj\currentfloat}\c!textstyle\c!textcolor
         {\xdef\lastcaptionht{\strutheight}%
          \xdef\lastcaptiondp{\strutdepth}%
%        \begstrut#2\endstrut\endgraf}%
         \floatcaptionparameter\c!textcommand{\begstrut#2\endstrut}%
         \endgraf}%
     \fi
   \dostopattributes
% \floatcaptionparameter\c!after % test for side effects first
   \doifsomething{\floatcaptionparameter\c!spaceafter}{\blank[\floatcaptionparameter\c!spaceafter]}}

\starttext

This is some text with a reference to a table named \about[tab:table].

\placetable[here][tab:table]{My caption.}{...}

\setupcaptions[textcommand=\groupedcommand{}{.}]

This is some text with a reference to a table named \about[tab:other-table].

\placetable[here][tab:other-table]{My caption}{...}

\stoptext
</example>


but it’s possible to get the desired result also with a selector, e.g.


<example id="2">
\defineselector[caption][max=2,n=2]

\startsetups select:caption
\setupselector[caption][n=1]
\stopsetups

\setupcaptions[setups=select:caption]

\starttext

This is some text with a reference to a table named \about[tab:table].

\placetable[here][tab:table]{\select{caption}{My caption.}{My caption}}{...}

\stoptext
</example>


Wolfgang

___________________________________________________________________________________
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:[~2010-10-19 18:15 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-19 12:24 Cedric Mauclair
2010-10-19 12:26 ` Cedric Mauclair
2010-10-19 12:46 ` Wolfgang Schuster
2010-10-19 14:55   ` Cedric Mauclair
2010-10-19 18:15     ` Wolfgang Schuster [this message]
2010-10-19 20:46       ` Alan BRASLAU
2010-10-20  6:37         ` Cedric Mauclair

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=23F5E984-3AA9-4175-ABBA-B93278FBC034@gmail.com \
    --to=schuster.wolfgang@googlemail.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).