将 \toptitlemarks 和 \bottitlemarks 与计数器和多列一起使用

将 \toptitlemarks 和 \bottitlemarks 与计数器和多列一起使用

在多列环境中,end/begin{multicols} 命令会破坏 mycounter 的上限值(请参阅我的 MWE)。请问如何避免这种情况?非常感谢。

\documentclass[paper=a4,pagesize=pdftex,twoside]{scrbook}
\usepackage[extramarks]{titleps}
\usepackage{multicol}
\setlength{\columnseprule}{0.1mm}
\usepackage{lipsum}

\newcounter{mycounter}
\newmarkset{mycounter}
\newextramark*{mycounter}{mycounter}

\newpagestyle{mystyle}{%
    \setheadrule{.009pt}
    \sethead%
        [pg(\thepage)][][\topextramarks{mycounter}{\arabic{mycounter}}---\botextramarks{mycounter}{\arabic{mycounter}}]%
        {\topextramarks{mycounter}{\arabic{mycounter}}---\botextramarks{mycounter}{\arabic{mycounter}}}{}{pg(\thepage)}%
}
\pagestyle{mystyle}

\newcommand\updatemark{%
    \stepcounter{mycounter}%
    \extramark{mycounter}%
}
\begin{document}

\begin{multicols}{2}
\updatemark\Huge{\textbf{\themycounter}} --- \lipsum[2][1-2]

\updatemark\Huge{\textbf{\themycounter}} --- \lipsum[2][1-2]

\updatemark\Huge{\textbf{\themycounter}} --- \lipsum[2][1-2]
\end{multicols}

\Huge{\textit{some text}}

\begin{multicols}{2}
\updatemark\Huge{\textbf{\themycounter}} --- \lipsum[2][1-2]

\updatemark\Huge{\textbf{\themycounter}} --- \lipsum[2][1-2]

\updatemark\Huge{\textbf{\themycounter}} --- \lipsum[2][1-2]
\end{multicols}
\end{document}

在此处输入图片描述

相关内容