优化编号段落与顶部标记的同步

优化编号段落与顶部标记的同步

如何使顶部标记的左侧部分与当前诗节同步?例如,在第 2 页中,顶部标记应为B1 3:1 -- B1 5:1'', notB1 3:2 -- B1 5:1''。谢谢

\documentclass[a5paper]{article}
\usepackage[left=1.5cm, right=1.5cm, top=0.5cm, bottom=0.3cm, includeheadfoot] {geometry}
\usepackage[maxfloats=1000]{morefloats}% pour les marginnotes
\usepackage{pgffor}
\usepackage[extramarks]{titleps}
\usepackage[colaction]{multicol}

\makeatletter
\newcommand\curbook{}
\newcommand{\bbook}[1]{
    \setcounter{section}{0}
    \renewcommand\curbook{#1}
}

\newcommand\bchapter{
    \addtocounter{section}{1}
    \textbf{Chapitre \arabic{section}}\\%
}

\newcounter{verse}

\def\bref{}
\newmarkset{bref}
\newextramark{bref}{\bref}

\newcommand\bverse[1]{
    \textbf{(\arabic{section}:#1)}%
    \def\bref{\curbook~\arabic{section}:#1}\extramark{bref}%
}

\newcommand*{\cadr}{\nobreak~\nobreak\mbox{---}\nobreak~\nobreak}

\newpagestyle{Pagestyle}{%
    \setheadrule{0.5pt}\setfootrule{0.0pt}%
    \sethead[][\textsc{\topextramarks{bref}\bref\cadr\botextramarks{bref}\bref}][]{}{\textsc{\topextramarks{bref}\bref\cadr\botextramarks{bref}\bref}}{}%
    \setfoot[][\thepage][]{}{\thepage}{}%
}
\makeatother

\newcommand{\bv}{This is a sample of a text.}
\newcommand{\bvn}[2]{\foreach \n in {#1,...,#2} { \bv }}

\begin{document}
\pagestyle{Pagestyle}
\begin{multicols}{2}
\bbook{B1}
\addcontentsline{toc}{section}{Book-1}

\bchapter
\bverse{1}\bvn{1}{20}\\\bverse{2}\bvn{2}{20}\\\bverse{4}\bvn{2}{20}

\bchapter
\bverse{1}\bvn{1}{20}\\\bverse{2}\bvn{1}{20}

\bchapter
\bverse{1}\bvn{1}{20}\\\bverse{2}\bvn{2}{20}\\\bverse{3}\bvn{2}{20}

\bchapter
\bverse{1}\bvn{1}{20}\\\bverse{2}\bvn{2}{20}\\\bverse{3}\bvn{2}{20}

\addcontentsline{toc}{section}{Book-2}
\bchapter
\bverse{1}\bvn{1}{20}\\\bverse{2}\bvn{2}{20}

\bchapter
\bverse{1}\bvn{1}{20}\\\bverse{2}\bvn{2}{20}

\bchapter
\bverse{1}\bvn{1}{20}\\\bverse{2}\bvn{2}{20}

\bchapter
\bverse{1}\bvn{1}{20}\\\bverse{2}\bvn{2}{20}
\end{multicols}
\end{document}

相关内容