1

I'm using document class book to make a series of books that contain translations of Buddhist scripture (suttas). Each sutta heading has three elements:

  • an acronym (MN 1)
  • a translated title (The Root of All Things)
  • a root title (Mūlapariyāyasutta)

We are converting to LaTeX from HTML, where these are expressed as follows:

<h2>
<span class='acronym'>MN 1</span>
<span class='translated-title'>The Root of All Things</span>
<span class='root-title'>Mūlapariyāyasutta</span>
</h2>

I want to preserve a similar structure in LaTeX, so that we can assign three independent parts to each heading, and flexibly use them in the three places that a heading gets used: the section heading, ToC, and page header/footer. In each place we want to be able to style them.

Perhaps the markup might look something like this:

\chapter{MN 1}{The Root of All Things}{Mūlapariyāyasutta}

Or perhaps more explicitly:

\chapter{\acronym MN 1}{\translatedtitle The Root of All Things}{\roottitle Mūlapariyāyasutta}

Then we might create a section heading like this:

MN 1
The Root of All Things
Mūlariyāyasutta

And a ToC entry like this:

  • MN 1: The Root of All Things — Mūlapariyāyasutta

And a page header/footer like this:

The Root of All Things        |        *Mūlapariyāyasutta*
                              |
                              |
MN 1                          |                       MN 1

Here is an MWE (that doesn't actually work) for the header/footer:

\documentclass{book}

\usepackage{fancyhdr}
\fancyhead[LE]{\translatedtitle}
\fancyhead[RO]{\roottitle}
\fancyfoot[LE,RO]{\acronym}

I'm struggling to imagine what an MWE would look like for chapter headings and ToC, so this is all I've got ATM! I've looked in various places such as titlesec and I can't find anything like this. I'm not looking for exact details on how to style these complex headings, but rather an approach that would make them available for styling and reuse.

Is there a package that handles such cases? Any help would be appreciated.

Some added nuances:

  • the headings should be unnumbered, we supply fixed IDs instead.
  • because this will apply in multiple volumes with different hierarchies and structures, it should work on different levels such as \chapter, \section, \subsection.
  • the document will also include "regular" headings (also unnumbered) for Introductions and the like.
2
  • In book class the headers (actually \leftmark and \rightmark) use the chapter and section titles. In article class, they use the section and subsection titles. Aug 8, 2022 at 0:20
  • On the other hand, hearders commands allow a optional argument. E.g:: \chapter[foo]{bar} will show "foo" in ToC, headers, references with nameref, etc., but will print "bar" in the title of tex.
    – Fran
    Aug 8, 2022 at 5:03

1 Answer 1

0

Thanks to John and Fran for putting me on track. Here I'll post the full solution.

One thing I didn’t realize: you can just add styles directly to the sectioning commands. It makes for a complicated heading structure, but since we’re generating the files this is not a problem.

We need to use fancyhdr and extramarks.

A typical sutta heading would be:

\section*{{\small Snp 2.10}\\*Get Up!\\*{\itshape Uṭṭhānasutta}}
\addcontentsline{toc}{section}{Snp 2.10: Get Up! — {\itshape Uṭṭhānasutta}}
\markboth{Get Up!}{Uṭṭhānasutta}
\extramarks{Snp 2.10}{Snp 2.10}

Then define the header/footer:

\pagestyle{fancy}
\fancyhf{}
\fancyfoot[RE,LO]{\thepage}
\fancyfoot[LE,RO]{\lastleftxmark}
\fancyhead[CE]{\firstrightmark}
\fancyhead[CO]{\firstleftmark}

Et voila! It works! Here you can see the sutta headings and page header/footer:

section heading and page head/foot

And here you can see it's added to the ToC:

in ToC

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .