Difference between revisions of "Command/setuplabeltext"

From ConTeXt wiki
Jump to navigationJump to search
m (Add description, improve example, add See Also)
m (→‎Description: Improve sentence)
Line 21: Line 21:
 
== Description ==  
 
== Description ==  
  
In some cases ConTeXt generates text labels automatically. For example, the word ''Figure'' is generated automatically when a caption is placed under a figure. These kind of words are called textlabels. Labels can be set with the command {{cmd|setuplabeltext}}; they follow the language set with {{cmd|mainlanguage}}, not the local bits of different language that are set with {{cmd|language}}.
+
In some cases ConTeXt generates text labels automatically; for example, the word ''Figure'' is generated automatically when a caption is placed under a figure. These kind of words are called label texts. Labels are set with the command {{cmd|setuplabeltext}}, and retrieved with the command {{cmd|labeltext}}. They follow the language set with {{cmd|mainlanguage}}, not the local bits of different language that are set with {{cmd|language}}.
  
 
== Example ==
 
== Example ==

Revision as of 22:53, 14 May 2012

\setuplabeltext

Syntax

\setuplabeltext[...][...=...]
[...] nl fr en uk de es cz ..
name text

Description

In some cases ConTeXt generates text labels automatically; for example, the word Figure is generated automatically when a caption is placed under a figure. These kind of words are called label texts. Labels are set with the command \setuplabeltext, and retrieved with the command \labeltext. They follow the language set with \mainlanguage, not the local bits of different language that are set with \language.

Example

Here is an example of changing section and subsection heads.

% English labels
\setuplabeltext[en][section=My section ] % We want a space at the end of the label
\setuplabeltext[en][subsection=My subsection ]

% Dutch labels
\setuplabeltext[nl][section=Mijn hoofdstuk ] % We want a space at the end of the label
\setuplabeltext[nl][subsection=Mijn onderdeel ]

\def\setheadnumber#1#2{#1. #2}

\setuphead
 [section,subsection]
 [command=\setheadnumber,
  before={\blank[disable]},
  after={\blank[disable]}]

\starttext

\section{First Thoughts}
\subsection{First Subsection}
\hairline

% Changing the language does not change the labels
\language[nl]
\section{Second Thoughts}
\subsection{Second Subsection}
\hairline

% To change the labels, change the main language.
\mainlanguage[nl]
\section{Third Thoughts}
\subsection{Third Subsection}
\hairline

% Retrieving a label explicity:
This is the Dutch label for sections: \labeltext{section}.

\stoptext

results in

See also

Help from ConTeXt-Mailinglist/Forum

All issues with: