为什么使用sections和parts会产生bbl错误?

为什么使用sections和parts会产生bbl错误?

简单介绍一下背景:我已经很久没有用过 LaTeX 了,现在又开始用了。我可能忽略了一些显而易见的事情……感谢您的理解 :-)

一旦我使用\part\addsec命令,编译器就会产生错误。删除这些命令后,编译器运行正常。有人知道原因是什么以及如何修复它吗?这是一个 MWE:

\documentclass[paper=a5,fontsize=10pt,twoside,twocolumn,pagesize,DIV=15,headsepline,titlepage,openright]{scrbook}
\usepackage{scrlayer-scrpage}
\usepackage{cmap}
\usepackage[utf8x]{inputenc}
\usepackage[vietnamese=nohyphenation]{hyphsubst}
\usepackage[vietnamese,english,ngerman,polish]{babel}
\usepackage[T5,T1]{fontenc}
\usepackage{longtable}
\usepackage{lmodern}

\newcommand{\languagechange}[3]{%
  %\wlog{Lang: #3}%
  \newcommand{#1}{%
    \fontencoding{#2}\selectfont
    \csname otherlanguage*\endcsname{#3}%
  }%
}
\languagechange{\de}{T1}{ngerman}
\languagechange{\en}{T1}{english}
\languagechange{\pl}{T1}{polish}
\languagechange{\vn}{T5}{vietnamese}

\newcommand{\textfsf}{\sffamily\bfseries\selectfont}
\newcommand{\textksf}{\sffamily\itshape\small\selectfont}

%\makeatletter
%\renewcommand{\l@section}{\@dottedtocline{1}{1.5em}{2.8em}}
%\makeatother

\makeatletter
\g@addto@macro\description{\raggedright}
\makeatother

\setlength{\parindent}{0pt}
\setlength{\parskip}{0.8ex plus 0.4ex minus 0.2ex}
\flushbottom

\clearscrheadings
\ihead{}
\chead{}
\ohead{\rightmark}
\ifoot{}
\cfoot{}
\ofoot{\pagemark}
\pagestyle{scrheadings}

\begin{document}
\frontmatter
\title{\pl KSIĄŻKA\\ \vn SÁCH}
\subtitle{\pl DO CZYTANIA\\ \vn ĐỌC}
\author{\pl Johnny\\ \vn Giăng}
\date{}
\publishers{\pl wydawcy\\ \copyright{} 2020}
\maketitle
%\tableofcontents
\mainmatter


\begin{description}
\item[\pl first item] \vn còn, mà
\item[\pl second item] \vn mua dài hạn
\end{description}
\addsec{\pl A}


%\include{plvn}
%\include{vnpl}
\backmatter
\end{document}

尝试注释掉\addsec{\pl A}底部的 quite,它就可以正常编译了。这是我的错误日志:

! Undefined control sequence.
\bbl@fixname #1->\begingroup \def \bbl@tempe 
                                             {l@}\edef \bbl@tempd {\noexpand...
l.63 \addsec{\pl A}

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Argument of \bbl@tempd has an extra }.
<inserted text> 
                \par 
l.63 \addsec{\pl A}

I've run across a `}' that doesn't seem to match anything.
For example, `\def\a#1{...}' and `\a}' would produce
this error. If you simply proceed now, the `\par' that
I've just inserted will cause me to report a runaway
argument that might be the root of the problem. But if
your `}' was spurious, just type `2' and it will go away.

Runaway argument?
{\noexpand \@ifundefined {\noexpand \bbl@tempe \languagename }}\bbl@tempd \ETC.
! Paragraph ended before \bbl@tempd was complete.
<to be read again> 
                   \par 
l.63 \addsec{\pl A}

I suspect you've forgotten a `}', causing me to apply this
control sequence to too much text. How can we recover?
My plan is to forget the whole thing and hope for the best.

! Undefined control sequence.
\bbl@fixname #1->\begingroup \def \bbl@tempe 
                                             {l@}\edef \bbl@tempd {\noexpand...
l.63 \addsec{\pl A}

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Argument of \bbl@tempd has an extra }.
<inserted text> 
                \par 
l.63 \addsec{\pl A}

I've run across a `}' that doesn't seem to match anything.
For example, `\def\a#1{...}' and `\a}' would produce
this error. If you simply proceed now, the `\par' that
I've just inserted will cause me to report a runaway
argument that might be the root of the problem. But if
your `}' was spurious, just type `2' and it will go away.

Runaway argument?
{\noexpand \@ifundefined {\noexpand \bbl@tempe \languagename }}\bbl@tempd \ETC.
! Paragraph ended before \bbl@tempd was complete.
<to be read again> 
                   \par 
l.63 \addsec{\pl A}

I suspect you've forgotten a `}', causing me to apply this
control sequence to too much text. How can we recover?
My plan is to forget the whole thing and hope for the best.

LaTeX Font Info:    External font `lmex10' loaded for size
(Font)              <5> on input line 68.
Runaway argument?
{\protect \bbl@restore@actives \protect \fontencoding  {T1}\protect \selectfont  \ETC.
! Paragraph ended before \bbl@foreign@x was complete.
<to be read again> 
                   \par 
l.68 \backmatter

I suspect you've forgotten a `}', causing me to apply this
control sequence to too much text. How can we recover?
My plan is to forget the whole thing and hope for the best.

! Extra }, or forgotten \endgroup.
\@begin@tempboxa ...begingroup #2\color@endgroup }
                                                  \def \width {\wd \@tempbox...
l.68 \backmatter

I've deleted a group-closing symbol because it seems to be
spurious, as in `$x}$'. But perhaps the } is legitimate and
you forgot something else, as in `\hbox{$x}'. In such cases
the way to recover is to insert both the forgotten and the
deleted material, e.g., by typing `I$}'.

有人能重现这些错误吗?

答案1

您的语言命令不够强大。您应该使用\addsec{\protect\pl ...}它们或将它们定义为强大的:

\newcommand{\languagechange}[3]{%
  %\wlog{Lang: #3}%
  \newcommand{#1}{}% to check that we don't overwrite an existing command
  \DeclareRobustCommand{#1}{%
    \fontencoding{#2}\selectfont
    \csname otherlanguage*\endcsname{#3}%
  }%
}

如果可能的话,不要使用 utf8x,而要使用 utf8。在当前的 LaTeX 中甚至不需要加载 inputenc,utf8 是默认编码。

相关内容