考虑以下 MWE:
\documentclass[welsh,british]{article}
\usepackage{babel}
\newcommand{\cymraeg}[1]{{\selectlanguage{welsh}#1}}
\newcommand{\welsh}[1]{\foreignlanguage{welsh}{#1}}
\babelensure[include=\bibname,include=\contentsname,include=\glossaryname,include=\indexname]{welsh}
\newcommand*{\colophonname}{\cymraeg{Coloffon} --- Colophon}
\newenvironment{colophon}{%
\section*{\colophonname}%
\markboth{Coloffon}{Colophon}%
\small
\quote
}{\endquote}
\begin{document}
\begin{colophon}
As any dedicated reader can clearly see, the Ideal of practical reason is a representation of, as far as I know, the things in themselves; as I have shown
\end{colophon}
\renewcommand*{\colophonname}{\welsh{Coloffon} --- Colophon}
\begin{colophon}
As any dedicated reader can clearly see, the Ideal of practical reason is a representation of, as far as I know, the things in themselves; as I have shown
\end{colophon}
\end{document}
我本以为这段代码会产生两个相同的版权页,每个版权页都有一个左对齐的标题。然而,第一个版权页明显向右偏移。
如果我注释掉这行
\babelensure[include=\bibname,include=\contentsname,include=\glossaryname,include=\indexname]{welsh}
那么结果正如我所料。
为什么会发生这种情况?我该如何预防?
答案1
问题不在于它改变了对齐方式本身,而是 的定义中有一个多余的空格(%
在行尾处缺失)\bbl@ensure
。对于确保列表中的每个条目,这会在文本前添加一个空格,使其看起来大致居中。将以下固定定义添加到您的序言中
\makeatletter
\def\bbl@ensure#1#2#3{%
\def\bbl@tempb##1{% elt for \bbl@ensured list
\ifx##1\@empty\else
\in@{##1}{#2}%
\ifin@\else
\toks@\expandafter{##1}%
\edef\bbl@tempa{%
\noexpand\DeclareRobustCommand
\bbl@csarg\noexpand{ensure@\languagename}[1]{%
\noexpand\foreignlanguage{\languagename}%
{\ifx\relax#3\else
\noexpand\fontencoding{#3}\noexpand\selectfont
\fi
########1}}}%
\bbl@tempa
\edef##1{%
\bbl@csarg\noexpand{ensure@\languagename}%
{\the\toks@}}% The unprotected line end was here!
\fi
\expandafter\bbl@tempb
\fi}%
\expandafter\bbl@tempb\bbl@ensured\@empty
\def\bbl@tempa##1{% elt for include list
\ifx##1\@empty\else
\bbl@csarg\in@{ensure@\languagename\expandafter}\expandafter{##1}%
\ifin@\else
\bbl@tempb##1\@empty
\fi
\expandafter\bbl@tempa
\fi}%
}
\makeatother