[NTG-context] caption setup

Wolfgang Schuster schuster.wolfgang at gmail.com
Thu Apr 9 13:59:58 CEST 2015


> Am 09.04.2015 um 13:14 schrieb Csikos Bela <bcsikos425 at freemail.hu>:
> 
> Wolfgang Schuster írta:
>> 
>>> Am 09.04.2015 um 00:13 schrieb Csikos Bela:
>>> 
>>> Hello:
>>> 
>>> I have to setup caption formatting for Hungarian.
>>> In Hungarian I have to write "#. figure." instead of "Figure #:"
>>> The exact word for "figure" is "ábra", so what I want exactly is:
>>> "# ábra.", eg "1. ábra".
>>> How can I do it? (If I set the document language to Hungarian, the
>>> word "ábra" is shown correctly but the order is not correct; I get ,. ábra:#.)
>> 
>> Until the labels for hungarian are fixed you can use the \setuplabeltext command
>> to set the right labels.
>> 
>>> Another question: for caption text I want it to be justified and the last line of the caption
>>> centered. How can I do that?
>> 
>> \useMPlibrary[dum]
>> 
>> \mainlanguage[hu]
>> 
>> \setupcaption[figure][align=last,numberstopper=.]
>> 
>> \setuplabeltext[hu][figure={, ábra}]
>> 
>> \starttext
>> 
>> \startplacefigure[title=\input{ward}]
>> 	\externalfigure[dummy]
>> \stopplacefigure
>> 
>> \stoptext
>> 
>> Wolfgang
> 
> Wolfgang, Otared:
> 
> Thank you both for your suggestions. Unfortunately the caption modification works only partially. I could not make both the caption labels and the references look correct.
> 
> When I use Wolfgang's example, I get the following: attachment file caption-example-2.pdf.
> 
> I also tried different settings for caption label, here is the code:
> 
> ------------------------------------------------
> 
> \starttext
> 
> \setupcaption[figure][numberstopper={. ábra.}]
> \setuplabeltext[figure={}]
> 
> Code:
> 
> \verbatim{\setupcaption[figure][numberstopper={. ábra.}]} \par
> \verbatim{\setuplabeltext[figure={}]}
> 
> Result:
> 
> Reference to figure 1 (\in{figure}[figure-1])
> 
> \placefigure[][figure-1]{This is the caption}{\framed{Some figure}}
> 
> \hairline
> 
> \setupcaption[figure][suffix={. ábra},numberstopper={.}]
> \setuplabeltext[figure={}]
> 
> Code:
> 
> \verbatim{\setupcaption[figure][suffix={. ábra},numberstopper={.}]} \par
> \verbatim{\setuplabeltext[figure={}]}
> 
> Result:
> 
> Reference to figure 2 (\in{figure}[figure-2])
> 
> \placefigure[][figure-2]{This is the caption}{\framed{Another figure}}
> 
> \hairline
> 
> The caption should be: ``1. ábra. This is the caption''
> 
> The reference should be: ``(1. ábra)'' -- NO period after ``ábra'', without the word ``figure''.
> 
> \stoptext
> 
> ------------------------------------------------------------------------
> 
> I attach the generated pdf output: caption-example.pdf
> 
> Unfortunately none of the above code variants gives the correct result.
> Despite of the bad "wording" I don't understand why numberstopper (.)
> doesn't appear after suffix (. ábra) in figure 2.
> 
> Any way to fix these?

Method 1 (set the left and right texts for the reference with the \in command):

%%%% begin example
\useMPlibrary[dum]

\mainlanguage[hu]

\setuplabeltext [hu] [figure={, ábra.}]

\setupcaption[figure][numberstopper=.]

\definereferenceformat[infigure][label=figurereference]

\starttext

\startplacefigure[reference=fig:dummy,title=Dummy figure]
	\externalfigure[dummy]
\stopplacefigure

See figure~1 (\in{}{ ábra}[fig:dummy]).

\stoptext
%%%% end example


Method 2 (create your own reference command which uses a label without the period at the end):

%%%% begin example
\useMPlibrary[dum]

\mainlanguage[hu]

\setuplabeltext [hu]          [figure={, ábra.}]
\setuplabeltext [hu] [figurereference={, ábra}]

\setupcaption[figure][numberstopper=.]

\definereferenceformat[infigure][label=figurereference]

\starttext

\startplacefigure[reference=fig:dummy,title=Dummy figure]
	\externalfigure[dummy]
\stopplacefigure

See figure~1 (\infigure[fig:dummy]).

\stoptext
%%%% end example


BTW: The plain TeX method for quotation marks (``…’’) doesn’t work with MkIV, use correct quotation marks (“…”) or the \quotation command (\quotation{…}).

Wolfgang


More information about the ntg-context mailing list