In the following MWE, the subsection numbering within a given appendix is to be customized to look like 'Aw nnn: XXX mmmm', where 'Aw' should appear at the start of each header, 'nnn' is a running number (from 1 through 137), 'XXX' and 'mmmm' are identifiers pulled from a script generated LaTeX 'database'. In addition, the label is autogenerated and will be referenced throughout the other chapters.
The code below works fine, as far as the appendix itself is concerned:
However, the TOC shows only the subsection number; I would like it to show 'Aw 1', 'Aw 2', etc.:
(Also due to the cutting of chapter and section number in the TOC, it appears that the whitespace may need to be shrunk a little but that's a secondary concern.)
I have tried to internalize the information in the memoir
documentation, but in vain. Here's the MWE (polyglossia
and hyperref
retained though not directly relevant in the event there are side effects):
% !TEX TS-program = xelatexmk
\documentclass{memoir}
\setsecnumdepth{subsection}
\settocdepth{subsection}
\usepackage{libertine}
\usepackage{polyglossia}
\setdefaultlanguage[variant=british]{english}
\setotherlanguage[]{french}
\setotherlanguage[spelling=old]{german}
\usepackage[%
xetex,bookmarks,
colorlinks=true,linkcolor=blue,citecolor=blue,filecolor=black,urlcolor=blue,breaklinks=true,
pdftitle={Karljürgen G. Feuerherm---Abum--waqar and His Circle},
pdfauthor={Karljürgen G. Feuerherm},
unicode
]{hyperref}
\newcounter{awcounter}
\newcommand{\awset}[3]{% #1 specifies document number, #2 the field, and #3 the value
\setcounter{awcounter}{#1}%
\expandafter\def\csname aw#2\roman{awcounter}\endcsname{#3}%
}
% The following is extracted from a larger script-generated database setup.
\awset{1}{coll}{\textsc{nbc}}
\awset{1}{collno}{4321}
\awset{2}{coll}{\textsc{ybc}}
\awset{2}{collno}{1234}
% In the real application, this counter is cycled through 137 texts.
\newcounter{awednum}
\setcounter{awednum}{1}
\begin{document}
\frontmatter
\tableofcontents
\mainmatter
\chapter{Main Matter Chapter}
\appendix
\chapter{Appendix Chapter}
\section{Editions}\label{A.1}
% From here on, the format of subsection headers should be as follows:
% * normal font, centred
% * subsection headers should show only their own counter, prefixed by 'aw'.
\setsubsecheadstyle{\normalfont\centering}
\counterwithout{subsection}{section}
\setsecnumformat{\textsc{aw~}\csname the#1\endcsname:\quad}
% There will be one subsection for each document, identified by counter
\subsection{%
\expandafter\csname awcoll\roman{awednum}\endcsname~%
\expandafter\csname awcollno\roman{awednum}\endcsname%
}\label{aw:\arabic{awednum}}
Body text for first document with reference to document number \ref{aw:1}.
\stepcounter{awednum}
\subsection{%
\expandafter\csname awcoll\roman{awednum}\endcsname~%
\expandafter\csname awcollno\roman{awednum}\endcsname%
}\label{aw:\arabic{awednum}}
Body text for second document with reference to document number \ref{aw:2}.
\end{document}
Following up on Werner's solution below:
Werner's first solution is precisely what I needed: only this portion of this particular appendix should behave this way (each subsection governs the edition of a particular ancient text), and in this way, each is referenceable.
I omitted to mention, however, that the page headers should also reflect this, which I solved with an alteration to the pagestyle, as follows:
\makepagestyle{olmseditions}
\makeevenhead{olmseditions}{\thepage}{\leftmark}{}
\makeoddhead{olmseditions}{}{\rightmark}{\thepage}
\makeatletter
\makepsmarks{olmseditions}{%
\createmark{chapter}{both}{shownumber}{\@chapapp\ }{:\space}
\makeatother
\createmark{subsection}{right}{shownumber}{\textsc{aw}}{:\ }
\createplainmark{toc}{both}{\contentsname}
\createplainmark{lof}{both}{\listfigurename}
\createplainmark{lot}{both}{\listtablename}
\createplainmark{bib}{both}{\bibname}
\createplainmark{index}{both}{\indexname}
\createplainmark{glossary}{both}{\glossaryname}
}
This works, though I am not sure whether this is the best comprehensive solution....