Difference between revisions of "Command/ setuplabeltext"

From Wiki
Jump to navigation Jump to search
(Created page with "Documentation for \<i>setuplabeltext</i>")
 
m (In German TOC is named Inhalt not Einhalt... corrected)
 
(3 intermediate revisions by one other user not shown)
Line 1: Line 1:
<?xml version='1.0'?>
 
<!-- this file was generated on 2020-08-20T09:05 -->
 
 
<cd:commandgroup generated="yes" name="setuplabeltext" xmlns:cd="http://wiki.contextgarden.net/commanddoc/20200807">
 
<cd:commandgroup generated="yes" name="setuplabeltext" xmlns:cd="http://wiki.contextgarden.net/commanddoc/20200807">
<cd:shortdesc>
+
<cd:shortdesc>The instances of  <tt>\setup<i>label</i>text</tt> are used to fill in a class of labels
<!-- a short command summary goes here -->
 
The instances of  <tt>\<i>setuplabeltext</i></tt> are used for ...
 
 
</cd:shortdesc>
 
</cd:shortdesc>
 
<cd:sequence>
 
<cd:sequence>
Line 12: Line 8:
 
   </cd:sequence>
 
   </cd:sequence>
 
<cd:instances>
 
<cd:instances>
     <cd:constant value="head"></cd:constant>
+
     <cd:constant value="head">Certain sections, like the table of contents or the list of figures, have a default title head. This title can be altered with {{cmd|setupheadtext|[name=text]}}. See [[#Description]] for the list of defined section head labels.</cd:constant>
     <cd:constant value="label"></cd:constant>
+
     <cd:constant value="label">This class holds most other labels like the '''Figure''' and '''Table''' used in float captions.</cd:constant>
 
     <cd:constant value="mathlabel"></cd:constant>
 
     <cd:constant value="mathlabel"></cd:constant>
 
     <cd:constant value="taglabel"></cd:constant>
 
     <cd:constant value="taglabel"></cd:constant>
Line 39: Line 35:
 
   </cd:command>
 
   </cd:command>
 
</cd:variants>
 
</cd:variants>
<cd:description>
+
<cd:description>In some cases ConTeXt generates text labels automatically; for example,
<!-- the long description of the command goes here -->
+
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}}.
 +
 
 +
'''Note''' Nearly all the labels in the ConTeXt core are actually loaded from a lua table
 +
in <code>lang-txt.lua</code>, instead of via this interface.
 +
 
 +
'''NB''' The ''option parser'' for the command {{gen|setuplabeltext}}
 +
is [http://www.ntg.nl/pipermail/ntg-context/2012/067585.html known] to
 +
behave somewhat differently from most setups, posing minor constraints
 +
on code formatting.
 +
For instance the trailing comma after an assignment, otherwise employed
 +
to delimit the value, will lead to an error here.
 +
The final option in the list needs thus to be terminated by the closing
 +
bracket.
 +
 
 +
<texcode>
 +
\setuplabeltext [
 +
  Nomen=nomen,
 +
  Est=est,
 +
  Omen=est,  %% <= fails!
 +
]
 +
\setuplabeltext [Nomen=nomen, Est=est, Omen=est] %% <= works
 +
\starttext
 +
\labeltext{Nomen}
 +
\labeltext{Est}
 +
\labeltext{Omen}
 +
\stoptext
 +
</texcode>
 +
 
 +
For {{cmd|setupheadtext}}, here is the list of known section heads:
 +
 
 +
{| class="wikitable"
 +
! name || text
 +
|-
 +
| content || Contents
 +
|-
 +
| tables || Tables
 +
|-
 +
| figures || Figures
 +
|-
 +
| graphics || Graphics
 +
|-
 +
| intermezzi || Intermezzos
 +
|-
 +
| index || Index
 +
|-
 +
| abbreviations || Abbreviations
 +
|-
 +
| logos || Logos
 +
|-
 +
| units || Units
 +
|-
 +
| pubs || References
 +
|}
 
</cd:description>
 
</cd:description>
<cd:examples>
+
<cd:examples><cd:example title="Example for \setupheadtext"><context source="yes">
<!--  command example(s)
+
\setuppapersize[A5]
<cd:example title="">
+
\mainlanguage[de]
</cd:example>
+
% default headtext is 'Inhalt'
-->
+
\setupheadtext[de][content=Inhaltsverzeichnis]
</cd:examples>
+
 
<cd:notes>
+
\starttext
<!--  this is for special remarks that do not fit elsewhere, like discovered bugs in specific context versions
+
 
<cd:note author="..." date="...">
+
\completecontent
</cd:note>
+
\chapter{The first chapter}
-->
+
 
</cd:notes>
+
\stoptext
 +
</context></cd:example><cd:example title="Example for \setuplabeltext">Here is an example of changing section and subsection heads.
 +
<context source="yes" text="results in">
 +
% 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
 +
</context></cd:example></cd:examples>
 +
<cd:notes></cd:notes>
 
<cd:seealso>
 
<cd:seealso>
<!-- one or more of these:
 
<cd:commandref name="xx"></cd:commandref>
 
<cd:wikipage  page="xx"></cd:wikipage>
 
<cd:url        url="https://xx"></cd:url>
 
<cd:manual    pdf="xx"></cd:manual>
 
<cd:source    file="xx"></cd:source>
 
-->
 
 
<cd:commandref name="_copylabeltext" originator="system"></cd:commandref>
 
<cd:commandref name="_copylabeltext" originator="system"></cd:commandref>
 
<cd:commandref name="_currentlabel" originator="system"></cd:commandref>
 
<cd:commandref name="_currentlabel" originator="system"></cd:commandref>
Line 73: Line 161:
 
<cd:commandref name="_startlabeltext" originator="system"></cd:commandref>
 
<cd:commandref name="_startlabeltext" originator="system"></cd:commandref>
 
<cd:commandref name="definelabelclass" originator="system"></cd:commandref>
 
<cd:commandref name="definelabelclass" originator="system"></cd:commandref>
<cd:source file="lang-lab.mkiv" originator="system"></cd:source>  
+
<cd:source file="lang-lab.mkiv" originator="system"></cd:source>
<cd:wikipage originator="system" page="Category:Language"></cd:wikipage>  
+
<cd:wikipage originator="system" page="Category:Language"></cd:wikipage>
</cd:seealso>
+
<cd:source file="lang-txt.lua"></cd:source></cd:seealso>
 
</cd:commandgroup>
 
</cd:commandgroup>

Latest revision as of 23:09, 17 March 2022


\setuplabeltext

Summary

The instances of \setuplabeltext are used to fill in a class of labels

Instances

\setupheadtextCertain sections, like the table of contents or the list of figures, have a default title head. This title can be altered with \setupheadtext. See #Description for the list of defined section head labels.
\setuplabeltextThis class holds most other labels like the Figure and Table used in float captions.
\setupmathlabeltext
\setuptaglabeltext
\setupunittext
\setupoperatortext
\setupprefixtext
\setupsuffixtext
\setupbtxlabeltext

Settings instance

\setupLABELtext[...][...=...,...]
[...]language
keyvalue

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.

Note Nearly all the labels in the ConTeXt core are actually loaded from a lua table in lang-txt.lua, instead of via this interface.

NB The option parser for the command setuplabeltext is known to behave somewhat differently from most setups, posing minor constraints on code formatting. For instance the trailing comma after an assignment, otherwise employed to delimit the value, will lead to an error here. The final option in the list needs thus to be terminated by the closing bracket.

\setuplabeltext [
  Nomen=nomen,
  Est=est,
  Omen=est,  %% <= fails!
]
\setuplabeltext [Nomen=nomen, Est=est, Omen=est] %% <= works
\starttext
\labeltext{Nomen}
\labeltext{Est}
\labeltext{Omen}
\stoptext

For \setupheadtext, here is the list of known section heads:

name text
content Contents
tables Tables
figures Figures
graphics Graphics
intermezzi Intermezzos
index Index
abbreviations Abbreviations
logos Logos
units Units
pubs References

Examples

Example for \setupheadtext

\setuppapersize[A5]
\mainlanguage[de]
% default headtext is 'Inhalt'
\setupheadtext[de][content=Inhaltsverzeichnis]

\starttext

\completecontent
\chapter{The first chapter}

\stoptext

Example for \setuplabeltext

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

Notes

See also

Help from ConTeXt-Mailinglist/Forum

All issues with: