Alnumsec 样式:引用时重复“点”

Alnumsec 样式:引用时重复“点”

我不太明白为什么在使用 cleverref 引用时会出现这个重复的“。”。我包含了一个非常简单的 MWE 来复制错误。对于熟悉 alnumsec 包的人来说,这可能很明显。

\documentclass[
12pt,
showtrims,
a4paper,
oneside,
]{memoir}

\usepackage{graphicx}
\usepackage{cleveref}

\maxsecnumdepth{subparagraph}
\maxtocdepth{subparagraph}
\usepackage{alnumsec}
\surroundarabic[(][)]{}{.}
\otherseparators{5}
\alnumsecstyle{LRalda}

\begin{document}
    
    \tableofcontents* % Print the table of contents
    \cleartoverso
    
    \listoffigures % Print the list of figures
    \cleartoverso
    
    \DoubleSpacing
    \mainmatter
    \pagestyle{Ruled}
    
    \chapter{Test Chapter}
    
    \section{Test Section}
    
    \subsection{Test Sub-Section}
    
    \subsubsection{Test Sub-Sub-Section}
    
    \paragraph{Test Paragraph}
    
    \subparagraph{Test Sub-paragraph}
    
    Reference to \cref{fig:Figure}.
    
        \begin{figure}[htbp]
        \centering
        \includegraphics[width=0.2\textwidth]{example-image}
        \caption[Figure Short]{Figure Long}
        \label{fig:Figure}
        \end{figure}
        
\end{document}

在此处输入图片描述

答案1

\mainmatter的命令如下memoir\@memmain@floats

\newcommand\@memmain@floats{%
   \counterwithin{figure}{chapter}
   \counterwithin{table}{chapter}
}

因此,当\mainmatter发出时,您会\thechapter在定义之后得到一个句点,\thefigure该句点会添加到插入的句点中alnumsec

相反,\frontmatter执行时,图形会自行编号,没有前缀。

\thefigure因此,修改序言中的定义以消除盈余期是没有用的。

您如何解决这个问题?修复在文档中间重新定义的命令。

\documentclass[
  12pt,
  showtrims,
  a4paper,
  oneside,
]{memoir}

\usepackage{alnumsec}
\usepackage{graphicx}
\usepackage{cleveref}

\maxsecnumdepth{subparagraph}
\maxtocdepth{subparagraph}
\surroundarabic[(][)]{}{.}
\otherseparators{5}
\alnumsecstyle{LRalda}

\makeatletter
\renewcommand\@memmain@floats{%
   \counterwithin*{figure}{chapter}%
   \counterwithin*{table}{chapter}%
   \renewcommand{\thefigure}{\thechapter\arabic{figure}}%
   \renewcommand{\thetable}{\thechapter\arabic{table}}%
}
\makeatother

\begin{document}

\frontmatter

\tableofcontents* % Print the table of contents
\cleartoverso

\listoffigures % Print the list of figures
\cleartoverso

\mainmatter

\DoubleSpacing
\pagestyle{Ruled}

\chapter{Test Chapter}

\section{Test Section}

\subsection{Test Sub-Section}

\subsubsection{Test Sub-Sub-Section}

\paragraph{Test Paragraph}

\subparagraph{Test Sub-paragraph}

Reference to \cref{fig:Figure}.

\begin{figure}[htbp]
\centering

\includegraphics[width=0.2\textwidth]{example-image}

\caption[Figure Short]{Figure Long}
\label{fig:Figure}

\end{figure}

\end{document}

在此处输入图片描述

我确信你应该加载alnumsec cleveref

为了解决标题中的“双句号”问题,请添加

\makepsmarks{Ruled}{%
  \nouppercaseheads
  \createmark{chapter}{left}{shownumber}{}{ \space}% removed .
  \createmark{section}{right}{shownumber}{}{ \space}% removed .
  \createplainmark{toc}{both}{\contentsname}%
  \createplainmark{lof}{both}{\listfigurename}%
  \createplainmark{lot}{both}{\listtablename}%
  \createplainmark{bib}{both}{\bibname}%
  \createplainmark{index}{both}{\indexname}%
  \createplainmark{glossary}{both}{\glossaryname}%
}

相关内容