[希腊语]babel + cleveref + 罗马页码 + 标签 = ☇

[希腊语]babel + cleveref + 罗马页码 + 标签 = ☇

喂食

\documentclass{article}
\usepackage[greek]{babel}%%% greek should not necessarily be the main language; e.g., [greek, ngerman] would also expose the bug.
\usepackage{cleveref}%%% option [ngerman] would not change the outcome.
\begin{document}
\pagenumbering{Roman}
\label{someLabel}
\end{document}

导致mwe.texpdflatex

! 不完整 \iffalse;第 6 行之后的所有文本均被忽略。\fi <*> mwe

版本:

  • pdfTeX,版本 3.141592653-2.6-1.40.22(TeX Live 2022/dev/Debian)
  • LaTeX2e <2021-06-01> 补丁级别 1
  • cleveref 0.21.4 或 0.21.5 (均暴露了该漏洞)
  • 希腊语.ldf 2020/11/10 v1.10
  • 巴贝尔 2021/07/22 3.63

该错误发生在当前 Debian 测试版“bookworm”中:https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=997024

cleverefgreek.ldf和的维护者babel已收到通知。同时,有什么解决方法吗?

答案1

问题出在\ensureascii宏上。你可以做到这一点\protected

\documentclass{article}
\usepackage[greek]{babel}
\usepackage{etoolbox}
\usepackage{cleveref}

\AtBeginDocument{\robustify\ensureascii}

\begin{document}

\pagenumbering{Roman}
\label{someLabel}

\end{document}

答案2

您可以恢复原始的罗马计数器格式:

\documentclass{article}

\makeatletter
\let\@RomanSaved\@Roman
\usepackage[greek]{babel}%%% greek should not necessarily be the main language; e.g., [greek, ngerman] would also expose the bug.
\usepackage{cleveref}%%% option [ngerman] would not change the outcome.
\let\@Roman\@RomanSaved
\makeatother

\begin{document}
\pagenumbering{Roman}

\setcounter{page}{5}

\label{someLabel}
{\fontencoding{T1}\selectfont\pageref{someLabel}}
\end{document}

在此处输入图片描述

相关内容