cleveref 定制 + otherlanguage + cref 不能很好地结合在一起

cleveref 定制 + otherlanguage + cref 不能很好地结合在一起

喂食

\documentclass[ngerman]{book}
\usepackage[paperwidth=168mm,paperheight=240mm,height=210mm,width=144mm,includeall=true,showframe,showcrop]{geometry}%%% have visual text and page borders
\usepackage[USenglish,main=ngerman]{babel}
\usepackage[ngerman,noabbrev]{cleveref}%%% no abbreviations in general, but there are a few exceptions, e.g. abbreviating German “Abbildung”
\overfullrule=1mm%%% put a thick vertical bar to take notice of overfulls
\newcommand{\crefpairconjunction}{ und }%%% allow for a line break after “und”
\newcommand{\creflastconjunction}{ und }%%% allow for a line break after “und”
\newcommand{\crefpairgroupconjunction}{ und }%%% allow for a line break after “und”
\newcommand{\creflastgroupconjunction}{ und }%%% allow for a line break after “und”
\newcommand{\crefrangeconjunction}{ bis }%%% allow for a line break after “bis”
\crefname{figure}{Abb.}{Abbn.}
\crefformat{figure}{Abb.\@\penalty9999\ #2#1#3}%%% allow for a line break after "Abb." under a high penalty
\crefrangeformat{figure}{Abbn.\@\penalty9999\ #3#1#4 bis #5#2#6}%%% "Abb.", "Abbn.", or "Abbildgn."; all are correct in German. Allow for a line break after the abbreviation under a high penalty.
\begin{document}
\chapter{Chap}
\begin{figure}Zeichnung\caption{Caption}\end{figure}%
\begin{figure}Zeichnung\caption{Caption}\end{figure}%
\begin{figure}Zeichnung\caption{Caption}\end{figure}%
\begin{figure}Zeichnung\caption{Caption}\end{figure}%
\begin{figure}Zeichnung\caption{Caption}\end{figure}%
\begin{figure}Zeichnung\caption{Caption}\end{figure}%
\part{Teil}
\section{Sect}
\begin{figure}%
  Zeichnung%
  \caption{Caption}%
  \label{fig:OneSeven}%
\end{figure}
\begin{figure}%
  Zeichnung%
  \caption{Caption}%
  \label{fig:OneEight}%
\end{figure}
\begin{figure}%
  Zeichnung%
  \caption{Caption}%
  \label{fig:OneNine}%
\end{figure}
EinLangesWort EinLangesWort LangesWort Wort \cref{fig:OneNine,fig:OneTen,fig:OneSeven,fig:OneEleven}.

\begin{otherlanguage}{USenglish}%%% The starred version otherlanguage* instead of otherlanguage works fine, though.
  Anything between one line and half a page of English text, which may cross a page border.
\end{otherlanguage}%

EinLangesWort EinLangesWort einWort \cref{fig:OneNine,fig:OneTen,fig:OneSeven,fig:OneEleven}.
\begin{figure}%
  Zeichnung%
  \caption{Caption}%
  \label{fig:OneTen}%
\end{figure}
\begin{figure}%
  Zeichnung%
  \caption{Caption}%
  \label{fig:OneEleven}%
\end{figure}%
\end{document}

产量pdflatex

输出非缩写数字,且在我们希望的位置没有换行符

供您参考的德语词汇:=之二=直到画册=数字画报=绘画艾因=A或者朗格斯=长的麦汁=单词

如您所见,有两个问题:

  1. 德语的人物缩写不一致。在otherlanguage环境启动之前,我们得到一个简短的嗯。,这是我们所希望的。然而,在otherlanguage环境结束后,我们得到了一个完整的图片这是我们不希望看到的。

  2. 在连词之后断开是不一致的。在otherlanguage环境启动之前,LaTeX 会在自动创建的;此行为是有意为之。然而,在otherlanguage环境结束后,LaTeX 不会在;这种行为很糟糕。

为什么会发生这种情况?我们是否以某种非预期的方式使用了软件包的接口?否则:谁是罪魁祸首?我们应该针对 babel 或 cleveref 或任何其他软件包提交错误报告吗?

对于一份主要包含几十个美式英语段落的德语文档,哪种解决方法会产生尽可能少的副作用:

  1. 带星号的版本

    \begin{otherlanguage*}
    \end{otherlanguage*}%
    

    而不是无星号版本

    \begin{otherlanguage}
    \end{otherlanguage}
    
  2. 将环境封闭\begin{otherlanguage}…\end{otherlanguage}起来\begingroup…\endgroup,或

  3. 将环境括\begin{otherlanguage}…\end{otherlanguage}在一对括号中{…},或

  4. … 你的选择 … ?

相关内容