Background
Looking to emphasize the first letter of the index chapter title.
Code
The following code does not work as expected:
\defineframed[StyleChapterFramed][
frame=off,
]
\define[1]\StyleChapter{%
\StyleChapterFramed{%
\framed[align=right, frame=off]{%
\startoverlay {
\getfirstcharacter{#1}%
\firstcharacter%
}
\stopoverlay
}
}
}
\setuphead[chapter][
deeptextcommand=\StyleChapter,
]
\starttext
\startfrontmatter
\completecontent
\stopfrontmatter
\startbodymatter
\startchapter[
title={Chapter},
reference=sec:chapter,
]
\startsection[
title={Section},
reference=sec:section,
]
\startsubsection[
title={Equipment},
reference=sec:equipment,]
\input knuth
\stopsubsection
\stopsection
\stopchapter
\stopbodymatter
\startbackmatter
\completeindex
%\placeindex
\stopbackmatter
\stoptext
This produces the following compile error:
structure > sectioning > chapter @ level 2 : 0.1 -> \headtext {index}
! Use of \csname\endcsname doesn't match its definition.
system > tex > error on line 51 in file ex.tex: Use of ...
Problem
The problem seems to be the following line:
\completeindex
The document compiles when replaced with:
\chapter{Index}
\placeindex
Update
The code also fails when using:
\setupregister[index][%
alternative=A,%
]
Although it seems to be a different problem.
Output
I have achieved the following for chapter titles (inset to bottom-right, followed by a page break):
Yet what I cannot seem to accomplish is override the chapter style to create a different index style title such as (at the top of a page, without a page break):
This might be related to: Include custom index chapter title in table of contents in ConTeXt
Question
How would you use a deeptextcommand
and a custom register in ConTeXt?
\getfirstcharacter
, which is a wrapper aroundgetfirstcharacter()
insyst-aux.lua
. The label of the index heading is generated dynamically, so it expands to\headtext {index}
. Callinggetfirstcharacter()
on that extracts the backslash which leads to an instant fail. – Philipp Gesang Sep 21 '13 at 19:11