ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Caption textcommand option
@ 2010-10-19 12:24 Cedric Mauclair
  2010-10-19 12:26 ` Cedric Mauclair
  2010-10-19 12:46 ` Wolfgang Schuster
  0 siblings, 2 replies; 7+ messages in thread
From: Cedric Mauclair @ 2010-10-19 12:24 UTC (permalink / raw)
  To: ConTeXt-mailinglist

Hi Hans and all,

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.

Currently I have changed, rather crudely, the definition of
\putcompletecaption... to take that into account. Here is what I came
up with.

\def\DotAtEnd#1{#1.}
\setupcaptions[\c!textcommand=\DotAtEnd] % ADDED

\long\def\putcompletecaption
 ...
       \begstrut\floatcaptionparameter\c!textcommand{#2}\endstrut\endgraf
% MODIFIED
     \fi
   \endgroup
  %\floatcaptionparameter\c!after % test for side effects first
   \doifsomething{\floatcaptionparameter\c!spaceafter}{\blank[\floatcaptionparameter\c!spaceafter]}}
%% END YUCK!!

I am sure there is a better way though.

Regards.

-- Cédric
___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Caption textcommand option
  2010-10-19 12:24 Caption textcommand option Cedric Mauclair
@ 2010-10-19 12:26 ` Cedric Mauclair
  2010-10-19 12:46 ` Wolfgang Schuster
  1 sibling, 0 replies; 7+ messages in thread
From: Cedric Mauclair @ 2010-10-19 12:26 UTC (permalink / raw)
  To: ConTeXt-mailinglist

Sorry, the message was not over.

I was hilighting the interesting part :

\def\DotAtEnd#1{#1.}
\setupcaptions[\c!textcommand=\DotAtEnd] % ADDED

\long\def\putcompletecaption#1#2%
  ...
  \begstrut\floatcaptionparameter\c!textcommand{#2}\endstrut\endgraf
  ...


-- Cédric



On Tue, Oct 19, 2010 at 14:24, Cedric Mauclair
<cedric.mauclair@gmail.com> wrote:
> Hi Hans and all,
>
> 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.
>
> Currently I have changed, rather crudely, the definition of
> \putcompletecaption... to take that into account. Here is what I came
> up with.
>
> \def\DotAtEnd#1{#1.}
> \setupcaptions[\c!textcommand=\DotAtEnd] % ADDED
>
> \long\def\putcompletecaption
>  ...
>       \begstrut\floatcaptionparameter\c!textcommand{#2}\endstrut\endgraf
> % MODIFIED
>     \fi
>   \endgroup
>  %\floatcaptionparameter\c!after % test for side effects first
>   \doifsomething{\floatcaptionparameter\c!spaceafter}{\blank[\floatcaptionparameter\c!spaceafter]}}
> %% END YUCK!!
>
> I am sure there is a better way though.
>
> Regards.
>
> -- Cédric
>
___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Caption textcommand option
  2010-10-19 12:24 Caption textcommand option Cedric Mauclair
  2010-10-19 12:26 ` Cedric Mauclair
@ 2010-10-19 12:46 ` Wolfgang Schuster
  2010-10-19 14:55   ` Cedric Mauclair
  1 sibling, 1 reply; 7+ messages in thread
From: Wolfgang Schuster @ 2010-10-19 12:46 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 19.10.2010 um 14:24 schrieb Cedric Mauclair:

> Hi Hans and all,
> 
> 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.
> 
> Currently I have changed, rather crudely, the definition of
> \putcompletecaption... to take that into account. Here is what I came
> up with.

Make a complete example to show us what do you want to achieve before you try to modify commands.

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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Caption textcommand option
  2010-10-19 12:46 ` Wolfgang Schuster
@ 2010-10-19 14:55   ` Cedric Mauclair
  2010-10-19 18:15     ` Wolfgang Schuster
  0 siblings, 1 reply; 7+ messages in thread
From: Cedric Mauclair @ 2010-10-19 14:55 UTC (permalink / raw)
  To: mailing list for ConTeXt users

[-- Attachment #1: Type: text/plain, Size: 1365 bytes --]

On Tue, Oct 19, 2010 at 14:46, Wolfgang Schuster
<schuster.wolfgang@googlemail.com> wrote:
>
> Am 19.10.2010 um 14:24 schrieb Cedric Mauclair:
>
>> Hi Hans and all,
>>
>> 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.
>>
>> Currently I have changed, rather crudely, the definition of
>> \putcompletecaption... to take that into account. Here is what I came
>> up with.
>
> 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.

Hope this is clear.

-- Cédric

>
> 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
> ___________________________________________________________________________________
>

[-- Attachment #2: doted-caption.pdf --]
[-- Type: application/pdf, Size: 9276 bytes --]

[-- Attachment #3: doted-caption.tex --]
[-- Type: application/x-tex, Size: 273 bytes --]

[-- Attachment #4: Type: text/plain, Size: 486 bytes --]

___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Caption textcommand option
  2010-10-19 14:55   ` Cedric Mauclair
@ 2010-10-19 18:15     ` Wolfgang Schuster
  2010-10-19 20:46       ` Alan BRASLAU
  0 siblings, 1 reply; 7+ messages in thread
From: Wolfgang Schuster @ 2010-10-19 18:15 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Caption textcommand option
  2010-10-19 18:15     ` Wolfgang Schuster
@ 2010-10-19 20:46       ` Alan BRASLAU
  2010-10-20  6:37         ` Cedric Mauclair
  0 siblings, 1 reply; 7+ messages in thread
From: Alan BRASLAU @ 2010-10-19 20:46 UTC (permalink / raw)
  To: ntg-context

On Tuesday 19 October 2010 20:15:37 Wolfgang Schuster wrote:
> 
> 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>


I sytematically use the selector mechanism for short caption/full caption,
the short caption gets used for the list of figures and list of tables.
 \setupselector [caption] [n=1]
 \placelistoffigures [criterium=all]

Alan
___________________________________________________________________________________
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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Caption textcommand option
  2010-10-19 20:46       ` Alan BRASLAU
@ 2010-10-20  6:37         ` Cedric Mauclair
  0 siblings, 0 replies; 7+ messages in thread
From: Cedric Mauclair @ 2010-10-20  6:37 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Works for me. Thanks.

-- Cédric



On Tue, Oct 19, 2010 at 22:46, Alan BRASLAU <alan.braslau@cea.fr> wrote:
> On Tuesday 19 October 2010 20:15:37 Wolfgang Schuster wrote:
>>
>> 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>
>
>
> I sytematically use the selector mechanism for short caption/full caption,
> the short caption gets used for the list of figures and list of tables.
>  \setupselector [caption] [n=1]
>  \placelistoffigures [criterium=all]
>
> Alan
> ___________________________________________________________________________________
> 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
> ___________________________________________________________________________________
>
___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2010-10-20  6:37 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-19 12:24 Caption textcommand option 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
2010-10-19 20:46       ` Alan BRASLAU
2010-10-20  6:37         ` Cedric Mauclair

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).