Difference between revisions of "Command/somenamedheadnumber"
< Command
Jump to navigation
Jump to search
m (expansion hint) |
(example) |
||
Line 23: | Line 23: | ||
<cd:description><!-- the long description of the command goes here --> | <cd:description><!-- the long description of the command goes here --> | ||
</cd:description> | </cd:description> | ||
− | <cd:examples></cd:examples> | + | <cd:examples><cd:example title="chapter color"><context source="yes"> |
+ | \usemodule[visual] | ||
+ | |||
+ | \startsetups[MyChapterSetup] | ||
+ | \definecolor[MyChapterColor][h={\the\numexpr 360*\somenamedheadnumber{chapter}{current}/\somenamedheadnumber{chapter}{last}\relax},s=1,v=.75] | ||
+ | \definecolor[fakerulecolor][MyChapterColor] % for \fakewords | ||
+ | \setuphead[chapter][color=MyChapterColor] | ||
+ | \stopsetups | ||
+ | |||
+ | \unexpanded\def\MyChapter#1{ | ||
+ | \setup{MyChapterSetup} | ||
+ | \color[MyChapterColor]{#1} | ||
+ | } | ||
+ | |||
+ | \setuphead[chapter][page=no,textcommand=\MyChapter] | ||
+ | |||
+ | \starttext | ||
+ | |||
+ | \dorecurse{5}{ | ||
+ | \chapter{\fakewords{1}{5}} | ||
+ | \fakewords{10}{20} | ||
+ | } | ||
+ | |||
+ | \stoptext | ||
+ | </context></cd:example></cd:examples> | ||
<cd:notes></cd:notes> | <cd:notes></cd:notes> | ||
<cd:seealso> | <cd:seealso> |
Latest revision as of 08:02, 20 July 2022
Contents
\somenamedheadnumber
Summary
Use \somenamedheadnumber to access a section number (expandable).
Settings
\somenamedheadnumber{...}{...} | |
{...} | section |
{...} | previous current next first last |
Option | Explanation |
---|---|
name of the section level e.g. “chapter” |
Description
Examples
chapter color
\usemodule[visual] \startsetups[MyChapterSetup] \definecolor[MyChapterColor][h={\the\numexpr 360*\somenamedheadnumber{chapter}{current}/\somenamedheadnumber{chapter}{last}\relax},s=1,v=.75] \definecolor[fakerulecolor][MyChapterColor] % for \fakewords \setuphead[chapter][color=MyChapterColor] \stopsetups \unexpanded\def\MyChapter#1{ \setup{MyChapterSetup} \color[MyChapterColor]{#1} } \setuphead[chapter][page=no,textcommand=\MyChapter] \starttext \dorecurse{5}{ \chapter{\fakewords{1}{5}} \fakewords{10}{20} } \stoptext
Notes
See also
- strc-sec.mkiv
- \someheadnumber (not expandable)