文档中间开始出现大量错误,但代码没有任何问题

文档中间开始出现大量错误,但代码没有任何问题

我有一份长达 40 页的文档,大部分内容运行良好,但到最后开始在不同的行上出现大量错误。该文档总共有 42 个错误,发生在几行上,一行通常有 10-15 个错误。该文档编译正常,看起来也符合预期,但我仍然对出现错误感到困扰,以及为什么会出现这些错误,因此非常感激您的帮助。

根据评论的要求,我简化了文档以便在此处分享,现在它看起来像这样:

\documentclass[a4paper,11pt,pdftex]{article}

\usepackage[utf8]{inputenc}
\usepackage[magyar]{babel} %needed in Hungarian reports
\usepackage{fancyhdr} %for the nice header
\usepackage{graphicx} %grapics input
\usepackage{tikz} %tikz figures
\usepackage[colorinlistoftodos]{todonotes}
\renewcommand{\baselinestretch}{1.5}

\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{amssymb}
\usepackage{braket}
\usepackage{caption}
\usepackage{subcaption}
\usepackage[colorinlistoftodos]{todonotes} % szövegbeli kommentekhez, szövegdobozokhoz
\usepackage{comment} %többsoros kommentekhez
\usepackage{textgreek} %görög betűk math mode-on kívül
\usepackage{fixltx2e} % felső és alsó indexekhez
\usepackage{siunitx} %szép celsius jelért
\usepackage{t1enc} %mert kéri...
%\usepackage[justification=centering]{caption} %hogy a képaláírások középen legyenek
\usepackage{array} % hogy a táblázat oszlopainak szélességét állítsam
\usepackage{tabu} % ez meg auomatikusan kitölti a táblázatot oldalszélesre

\usepackage[a4paper,left=2.5cm,right=2.5cm,top=2.5cm,bottom=2.5cm,pdftex]{geometry} %margins

\usepackage{color}
\usepackage{xcolor}
\usepackage{url}
\usepackage{hyperref} %links
\hypersetup{
colorlinks=true,
linkcolor=blue,
urlcolor=blue,
citecolor=red,
unicode=true
}

\begin{document}
\pagestyle{fancy}

\section{Results\label{results}}

\clearpage

\end{document}

此版本有 13 个错误,全部位于第 47 行(该\clearpage行)。以下是我收到的错误:

! Undefined control sequence.
\bbl@fixname #1->\begingroup \def \bbl@tempe 
                                             {l@}\edef \bbl@tempd {\noexpand...
l.47 \clearpage

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.47 \clearpage

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.47 \clearpage

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.

! Use of \begingroup doesn't match its definition.
<to be read again> ...MAGYAR{{1}}\begingroup \def 
                                                  {L@}\edef \par 
l.47 \clearpage

If you say, e.g., `\def\a1{...}', then you must always
put `1' after `\a', since control sequence names are
made up of letters only. The macro here has not been
followed by the required stuff, so I'm ignoring it.

! Missing { inserted.
\MakeUppercase  ... {\uppercase {#1}}\reserved@a }

l.47 \clearpage

Where was the left brace? You said something like `\def\a}',
which I'm going to interpret as `\def\a{}'.

! Missing } inserted.
<inserted text> 
                }
l.47 \clearpage

I've inserted something that you may have forgotten.
(See the <inserted text> above.)
With luck, this will get me unwedged. But if you
really didn't forget anything, try typing `2' now; then
my insertion and my current dilemma will both disappear.

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

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$}'.

! Extra }, or forgotten \endgroup.
<argument> ...adwidth }{\raggedleft \f@nch@orh }}}
                                                  \headrule 
l.47 \clearpage

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$}'.

! You can't use `\hrule' here except with leaders.
\headrule ...width \plainheadrulewidth \fi \hrule 
                                                  \@height \headrulewidth \@...
l.47 \clearpage

To put a horizontal rule in an hbox or an alignment,
you should use \leaders or \hrulefill (see The TeXbook).

! Missing number, treated as zero.
<to be read again> 
                   \vskip 
l.47 \clearpage

A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)

! Illegal unit of measure (pt inserted).
<to be read again> 
                   \vskip 
l.47 \clearpage

Dimensions can be in units of em, ex, in, pt, pc,
cm, mm, dd, cc, nd, nc, bp, or sp; but yours is a new one!
I'll assume that you meant to say pt, for printer's points.
To recover gracefully from this error, it's best to
delete the erroneous units; e.g., type `2' to delete
two letters. (See Chapter 27 of The TeXbook.)

! Missing } inserted.
<inserted text> 
                }
l.47 \clearpage

I've inserted something that you may have forgotten.
(See the <inserted text> above.)
With luck, this will get me unwedged. But if you
really didn't forget anything, try typing `2' now; then
my insertion and my current dilemma will both disappear.

! Missing \endgroup inserted.
<inserted text> 
                \endgroup 
l.47 \clearpage

I've inserted something that you may have forgotten.
(See the <inserted text> above.)
With luck, this will get me unwedged. But if you
really didn't forget anything, try typing `2' now; then
my insertion and my current dilemma will both disappear.

! Missing } inserted.
<inserted text> 
                }
l.47 \clearpage

I've inserted something that you may have forgotten.
(See the <inserted text> above.)
With luck, this will get me unwedged. But if you
really didn't forget anything, try typing `2' now; then
my insertion and my current dilemma will both disappear.

! Missing } inserted.
<inserted text> 
                }
l.47 \clearpage

I've inserted something that you may have forgotten.
(See the <inserted text> above.)
With luck, this will get me unwedged. But if you
really didn't forget anything, try typing `2' now; then
my insertion and my current dilemma will both disappear.

! Extra }, or forgotten \endgroup.
\@outputpage ...or \hb@xt@ \textwidth {\@thehead }
                                                  \color@endbox }\dp \@tempb...
l.47 \clearpage

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$}'.

不确定这是否重要,但我正在在线编辑器中写作(overleaf)。

答案1

您应该在使用该选项fancyhdr之前加载(如语言定义文件发出的警告所指示的那样)。然而,这在某种程度上与 相冲突。babelmagyar\MakeUppercase

您可以重新定义\sectionmark以避免这种情况,或者textcase使用该overload选项加载。

\documentclass[a4paper,11pt]{article}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{fancyhdr} %for the nice header
\usepackage[magyar]{babel} %needed in Hungarian reports
\usepackage{graphicx} %grapics input
\usepackage{tikz} %tikz figures
\usepackage[colorinlistoftodos]{todonotes}

\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{amssymb}
\usepackage{braket}
\usepackage{caption}
\usepackage{subcaption}
\usepackage[colorinlistoftodos]{todonotes} % szövegbeli kommentekhez, szövegdobozokhoz
\usepackage{comment} %többsoros kommentekhez
\usepackage{textgreek} %görög betűk math mode-on kívül
%\usepackage{fixltx2e} % felső és alsó indexekhez
\usepackage{siunitx} %szép celsius jelért
%\usepackage{t1enc} %mert kéri...
\usepackage[justification=centering]{caption} %hogy a képaláírások középen legyenek
\usepackage{array} % hogy a táblázat oszlopainak szélességét állítsam
\usepackage{tabu} % ez meg auomatikusan kitölti a táblázatot oldalszélesre
\usepackage[overload]{textcase}

\usepackage[
  a4paper,
  left=2.5cm,
  right=2.5cm,
  top=2.5cm,
  bottom=2.5cm,
  headheight=13.6pt,
]{geometry} %margins

%\usepackage{color}
\usepackage{xcolor}
%\usepackage{url}
\usepackage{hyperref} %links
\hypersetup{
  colorlinks=true,
  linkcolor=blue,
  urlcolor=blue,
  citecolor=red,
  unicode=true
}

\renewcommand{\baselinestretch}{1.5}
\pagestyle{fancy}

\begin{document}

\section{Results\label{results}}

\clearpage

\end{document}

我也做了一些更改:我删除了所有地方的选项pdftex,通常不应该使用它;t1enc最好加载而不是 ;如果使用 ,fontenc加载是无用的;包含在最新版本的 LaTeX 中;由 加载。colorxcolorfixltx2eurlhyperref

headheight最后,我按照 的指示,为 添加了设置fancyhdr

相关内容