0

I have created a file with a running header. Right now, it only captures the last occurrence of each item. I would like for the left hand side to show the first occurrence, and the right hand side to show the last occurrence.

In the cases where the chapter starts midway through a page, how can I cause it show the chapter from the previous page? For instance, if chapter 5 begins midway through the page, and the first part of the page has text from chapter 4, it should show "4:8–5:4" for example.

I have attached a MWE working example.

    \documentclass[12pt]{book}
    
    \usepackage{dblfnote}
    \usepackage[para]{footmisc}
    \usepackage{ragged2e}
    \usepackage{fontspec}
    \usepackage{ifthen}
    \usepackage{lipsum}
    \usepackage{polyglossia}
    \usepackage{fancyhdr}
    
    % \setmainlanguage{syriac}
    % \setmainfont[BoldFont={DejaVu Serif Bold}]{Serto Antioch Bible}
    
    \setmainlanguage{hebrew}
    \setmainfont{SBLBibLit}
    
    % Make Counters for Chapters and Verses
    \newcommand{\hebtitle}
    \newcounter{mychapter}
    \newcounter{bibver}
    \setcounter{mychapter}{0}
    \setcounter{bibver}{0}
    
    % Make Bible Chapter and Verses
    \newcommand{\mychaptermark}{}
    \newcommand{\bibvermark}{}
    
    \newcommand{\mychapter}[1]{%
      \stepcounter{mychapter}% Increment the mychapter counter
      \renewcommand{\mychaptermark}{#1}%
      \chaptermark{#1 : \bibvermark}% Include the verse number in the chaptermark
      {\centering{#1}}% Center the chapter title
    }
    
    \newcommand{\bibver}[1]{%
      \stepcounter{bibver}% Increment the bibver counter
      \textsuperscript{\textbf{#1}}%
      \renewcommand{\bibvermark}{#1}% Set bibvermark
    }
    
    % Make Book Title in English and Syriac
    \newcommand{\englishtitle}[1]{\centering\LR{#1}}
    \newcommand{\Hebrewtitle}[1]{\centering}
    % Define custom commands for English and Syriac titles
    
    % \newcommand{\syriactitle}{Syriac Title}
    
    \let\oldfootnote\footnote
    \renewcommand{\footnote}[1]{\oldfootnote{~#1}}
    
    % Customize header using fancyhdr
    \pagestyle{fancy}
    \fancyhead{} % Clear previous header settings
    \fancyhead[CO]{\englishtitle}
    \fancyhead[CE]{\hebtitle}
    \fancyhead[RO,LE]{\mychaptermark:\bibvermark –– \mychaptermark:\bibvermark} % Right on odd pages, Left on even pages
    %\fancyhead[RE,LO]{\bibvermark} % Right on even pages, Left on odd pages
    
    \begin{document}
    
    \englishtitle{Genesis}
    \Hebrewtitle{ברשׁית}
    \mychapter{1}
    \bibver{1}בְּרֵאשִׁ֖ית בָּרָ֣א אֱלֹהִ֑ים אֵ֥ת הַשָּׁמַ֖יִם וְאֵ֥ת הָאָֽרֶץ׃
    \bibver{2}וְהָאָ֗רֶץ הָיְתָ֥ה תֹ֨הוּ֙ וָבֹ֔הוּ וְחֹ֖שֶׁךְ עַל־פְּנֵ֣י תְהֹ֑ום וְר֣וּחַ אֱלֹהִ֔ים מְרַחֶ֖פֶת עַל־פְּנֵ֥י הַמָּֽיִם׃
    
    \mychapter{2}
    
    \mychapter{3}
    
    \end{document}
1
  • Welcome! I'm glad that you solved your problem but don't write the answer into the question; rather write a separate answer. Note also that your code can't compile as it is, so please edit into something working.
    – campa
    Sep 11, 2023 at 14:09

1 Answer 1

1

EDIT: Solved. It was necessary to use the \extramarks package to capture everything necessary. I used the \leftmark and \rightmark to track the chapter, and the \leftxmark and \rightxmark to track the verse number.

\documentclass[12pt]{book}
\usepackage[paperwidth=6in, paperheight=9in, margin=1in]{geometry}

\usepackage{dblfnote}
\usepackage[para]{footmisc}
\usepackage{ragged2e}
\usepackage{fontspec}
\usepackage{ifthen}
\usepackage{polyglossia}
\usepackage{fancyhdr}
\usepackage{extramarks}

\setmainlanguage{syriac}
\setmainfont[BoldFont={DejaVu Serif Bold}]{Serto Antioch Bible}

% Make Counters for Chapters and Verses
\newcommand{\currbook}{}
\newcounter{mychapter}
\newcounter{bibver}
\setcounter{mychapter}{0}
\setcounter{bibver}{0}

% Make Bible Chapter and Verses
\newcommand{\mychaptermark}{}
\newcommand{\bibvermark}{}

\newcommand{\mychapter}[1]{%
  \stepcounter{mychapter}% Increment the mychapter counter
  \renewcommand{\mychaptermark}{#1}%
  %\chaptermark{#1 : \bibvermark}% Include the verse number in the chaptermark
  \markboth{#1}{#1}
  {\centering{#1}}% Center the chapter title
}

\newcommand{\bibver}[1]{%
  \stepcounter{bibver}% Increment the bibver counter
  \extramarks{#1}{#1}% Set both left and right marks to #1
  \textsuperscript{\textbf{#1 }}~%
}


% Make Book Title in English and Syriac
\newcommand{\englishtitle}[1]{\centering\LR{#1}}
\newcommand{\syriactitle}[1]{\centering{#1}}

% Footnotes

% \let\oldfootnote\footnote
% \renewcommand{\footnote}[1]{\oldfootnote{~#1}}

\newcommand{\mymarks}{%
\ifthenelse{\equal{\leftmark}{\rightmark}}
{\leftmark} % if equal
{\leftmark--\rightmark}} % if not equal 

% Set the headheight and potentially adjust topmargin
\setlength{\headheight}{14.5pt} % Adjust this value as needed
\addtolength{\topmargin}{-2.5pt} % Adjust this value as needed

% Customize header using fancyhdr
\pagestyle{fancy}
\fancyhead{} % Clear previous header settings
\fancyhead[CO]{\englishtitle}
\fancyhead[CE]{ܐܓܪܬܐ ܕܝܘܚܢܢ ܫܠܝܚܐ}
\fancyhead[RO,LE]{\leftmark:\lastleftxmark –– \rightmark:\firstrightxmark} % Right on odd pages, Left on even pages


\begin{document}


\end{document}
1

You must log in to answer this question.

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