I think the "fix" for PDF/EPUB is to include classes for chapters, appendixes, etc (see https://github.com/Connexions/rhaptos.cnxmlutils/blob/master/rhaptos/cnxmlutils/xsl/collxml-to-html5.xsl and search for `class="chapter (preface, appendix, unit)"` ). These classes are already being generated by the migration code but are discarded at some point. Then, the logic in `oer.exports/css/ccap-numbering.less` can be used (refactored and simplified; it also contains logic for numbering other things like figures, exercises inside examples, proofs, etc)