错误:“缺少 \endcsname 插入”和“额外的 \endcsname”显示在同一行

错误:“缺少 \endcsname 插入”和“额外的 \endcsname”显示在同一行

我的代码

\documentclass[%
   draft,     % Entwurfsstadium
   final,      % fertiges Dokument
   paper=a4,
   paper=portrait, 
   fontsize=12pt,%

   version=last, %

 ]{scrbook} 
\usepackage[utf8]{inputenc}
\input{preambel/settings}
\input{preambel/preambel}
\pdfminorversion=6  
\input{macros/newcommands}
\input{macros/TableCommands}
\input{preambel/Hyphenation}
\begin{document}
\pagenumbering{alph}
\input{content/Titel.tex}
\frontmatter
\pagenumbering{Alph}
\begingroup
  \renewcommand*{\chapterpagestyle}{empty}
  \pagestyle{empty}
  \tableofcontents
  \clearpage
\endgroup
\mainmatter
\pagenumbering{arabic}
\input{content/2-TheoreticallBackground}
\appendix
\pagenumbering{Roman}

\end{document}


\immediate\closeout\Imagelist

这是我的 preambel.tex 文件的一部分

\input{preambel/preambel-commands}
\usepackage{calc}
\usepackage[
    german,
    english,
]{babel}
\usepackage[table]{xcolor}
\usepackage[%
    %final,
    %draft % do not include images (faster)
]{graphicx}
\usepackage{eso-pic}
\usepackage{epstopdf}
\usepackage[
   centertags,
   sumlimits, 
   intlimits, 
   namelimits, 
]{amsmath} 
\IfPackageLoaded{pst-pdf}{
   \providecommand\makeindex{}
   \providecommand\makeglossary{}
}{}
\usepackage{marginnote}
\usepackage{relsize}
\usepackage{ragged2e}
\usepackage[T1]{fontenc} 
\usepackage{textcomp}
\input{preambel/Fonts}
\usepackage[fixamsmath,disallowspaces]{mathtools}
\usepackage{fixmath}
\usepackage[
    all,
    warning
]{onlyamsmath}
\usepackage{braket}  % Quantenmechanik Bracket Schreibweise
\usepackage{cancel}  
\usepackage{empheq}  % Hervorheben
\usepackage{icomma}
\let\ORGvarepsilon=\varepsilon
\let\varepsilon=\epsilon
\let\epsilon=\ORGvarepsilon
\usepackage[Symbolsmallscale]{upgreek}
\usepackage[upmu]{gensymb}     
\usepackage{upgreek}
\usepackage{booktabs}
\usepackage{multirow} 
\usepackage{dcolumn}
\LoadPackageLater{ltxtable}
\usepackage[normalem]{ulem} 
\usepackage{soul}
\usepackage{url}
\usepackage[
   bottom,      % Footnotes appear always on bottom. This is necessary
                % especially when floats are used
   stable,      % Make footnotes stable in section titles
   perpage,     % Reset on each page
   %para,       % Place footnotes side by side of in one paragraph.
   %side,       % Place footnotes in the margin
   ragged,      % Use RaggedRight
   %norule,     % suppress rule above footnotes
   multiple,    % rearrange multiple footnotes intelligent in the text.
   %symbol,     % use symbols instead of numbers
]{footmisc}

\renewcommand*{\multfootsep}{,\nobreakspace}

\deffootnote%
   [1em]% width of marker
   {1.5em}% indentation (general)
   {1em}% indentation (par)
   {\textsubscript{\thefootnotemark}}
\usepackage[ngerman]{varioref}
\IfPackageNotLoaded{enumerate}{
    \usepackage{enumitem}
}
\usepackage[%
   autostyle,            % the style of all quotation marks will be adapted
                     % to the document language as chosen by 'babel'
   german=quotes,       % Styles of quotes in each language
   english=british,
   french=guillemets
]{csquotes}
\renewcommand*{\mkcitation}[1]{{\,}#1}
\renewcommand*{\mkccitation}[1]{ #1}
\SetBlockThreshold{2}
\newenvironment{myquote}%
    {\begin{quote}\small}%
    {\end{quote}}%
\SetBlockEnvironment{myquote}
\RequirePackage[fixlanguage]{babelbib}
\bibliographystyle{bib/aps}
\usepackage{scrhack}
\ifpdf
\usepackage[%
    expansion=true, % better typography, but with much larger PDF file.
    protrusion=true
]{microtype}
\fi
\usepackage[
   % Farben fuer die Links
   colorlinks=true,         % Links erhalten Farben statt Kaeten
   urlcolor=pdfurlcolor,    % \href{...}{...} external (URL)
   filecolor=pdffilecolor,  % \href(...} local file
   linkcolor=pdflinkcolor,  % \ref{...} and \pageref{...}
   citecolor=pdfcitecolor,  % \cite(...)
   % Links
   raiselinks=true,          % calculate real height of the link
   breaklinks,              % Links berstehen Zeilenumbruch
   backref=page,            % Backlinks im Literaturverzeichnis (section, slide, page, none)
   pagebackref=true,        % Backlinks im Literaturverzeichnis mit Seitenangabe
   verbose,
   hyperindex=true,         % backlinkex index
   linktocpage=true,        % Inhaltsverzeichnis verlinkt Seiten
   hyperfootnotes=false,     % Keine Links auf Fussnoten
   % Bookmarks
   bookmarks=true,          % Erzeugung von Bookmarks fuer PDF-Viewer
   bookmarksopenlevel=1,    % Gliederungstiefe der Bookmarks
   bookmarksopen=true,      % Expandierte Untermenues in Bookmarks
   bookmarksnumbered=true,  % Nummerierung der Bookmarks
   bookmarkstype=toc,       % Art der Verzeichnisses
   % Anchors
   plainpages=false,        % Anchors even on plain pages ?
   pageanchor=true,         % Pages are linkable
   % PDF Informationen
   pdftitle={Titel der Arbeit},             % Titel
   pdfauthor={Vorname Name},            % Autor
   pdfcreator={MiKTeX, Texify, hyperref, KOMA-Script}, % Ersteller
   %pdfproducer={pdfeTeX 1.10b-2.1} %Produzent
   pdfstartview=FitH,       % Dokument wird Fit Width geaefnet
   pdfpagemode=UseOutlines, % Bookmarks im Viewer anzeigen
   pdfpagelabels,      % set PDF page labels
]{hyperref}
\usepackage[numbers,sort&compress]{natbib}
\usepackage{hypernat}
\IfPackageLoaded{backref}{
   % % Change Layout of Backref
   \renewcommand*{\backref}[1]{%
    }%
   \renewcommand*{\backrefalt}[4]{
    \mbox{(Zitiert auf %
    \ifnum#1=1 %
           Seite~%
       \else
        den Seiten~%
    \fi
    #2)}%
   }
}
\IfPackageLoaded{hyperref}{%
    \usepackage[figure]{hypcap}
}
\providecommand*{\abbvrefname}{Abbildung}
\newcommand*{\abbvref}[1]{%
  \hyperref[#1]{\abbvrefname}\vref{#1}%
}
\usepackage{pdfpages}
\LoadPackagesNow
\usepackage{float}  
\usepackage{flafter}
\usepackage[
    section     % "\section" command will be redefined with "\FloatBarrier"
]{placeins}
\usepackage{subfig}
\usepackage{wrapfig}
\setlength{\intextsep}{0.5\baselineskip}

\usepackage{picins}          % LaTeX 2.09 Paket von 1992. aber Layout kombatibel

\usepackage{wallpaper}          % für die Titelseite

\usepackage{color}
\makeatletter
    \def\gnuplottexextension@tikz{\string tex}
\makeatother
\usepackage{tikz}
\usepackage{gnuplot-lua-tikz}
\usepackage[miktex]{gnuplottex}
\usepackage{pgfkeys}
\renewcommand{\floatpagefraction}{.75} % vorher: .5
\renewcommand{\textfraction}{.1}       % vorher: .2
\renewcommand{\topfraction}{.8}        % vorher: .7
\renewcommand{\bottomfraction}{.5}     % vorher: .3
\setcounter{topnumber}{3}              % vorher: 2
\setcounter{bottomnumber}{2}           % vorher: 1
\setcounter{totalnumber}{5} 
\usepackage[%

    rightcaption,% caption placed on the right side
    ragged,
]{sidecap}
\renewcommand\sidecaptionsep{2em}
\sidecaptionvpos{table}{c}
\sidecaptionvpos{figure}{c}
\usepackage{makeidx}        % Index
\IfDraft{
  \usepackage{showidx}   
}
\usepackage[%
    german,
    %english
]{nomencl}[2005/09/22]

\usepackage[
    nohyperlinks,
    printonlyused,
    ]{acronym}
\usepackage{upquote}
\usepackage{listings}
 \lstset{
         basicstyle=\small\ttfamily, % Standardschrift
         numbers=left,               % Ort der Zeilennummern
         numberstyle=\tiny,          % Stil der Zeilennummern
         stepnumber=1,               % Abstand zwischen den Zeilennummern
         numbersep=5pt,              % Abstand der Nummern zum Text
         extendedchars=true,         % glaub für ä,ö,ü und ß
         breaklines=true,                        % Zeilen werden Umgebrochen
         breakautoindent=false,
         stringstyle=\color{stringcolor}, % Farbe der String
         showspaces=false,           % Leerzeichen anzeigen ?
         showtabs=false,             % Tabs anzeigen ?
         showstringspaces=false,      % Leerzeichen in Strings anzeigen ?
         language=C++                                   % Programmiersprache
 }
\usepackage{units}
\makeatletter
\IfPackageLoaded{framed}{%
   \IfPackageLoaded{marginnote}{%
      \begingroup
         \g@addto@macro\framed{%
            \let\marginnoteleftadjust\FrameSep
               \let\marginnoterightadjust\FrameSep
         }
      \makeatother
  }
}
\makeatother
\usepackage{multicol}
\usepackage{ellipsis} 
\usepackage[version=3]{mhchem}
\usepackage{setspace}
\usepackage{geometry} 
\IfPackageLoaded{geometry}{%
\geometry{
          a4paper,
          portrait,
          hscale=0.75,
          vscale=0.75
          ignoreall,   
          heightrounded,
          top=0.12\paperheight,
          twoside,  
          bindingoffset=5mm,
          footskip=0.03\paperheight,
           marginparwidth=0pt,
}
}
\IfPackageLoaded{geometry}{%
   %\geometry{showframe}
}
\IfPackageLoaded{typearea}{% nur laden, wenn geometry nicht benutzt wird
   \IfPackageNotLoaded{geometry}{%
      \typearea[current]{last}
      \typearea[current]{calc}
   }
}
\raggedbottom 
\IfDefined{urlstyle}{
    \urlstyle{tt} %sf
}
\usepackage[
   automark, 
   komastyle,
   nouppercase,
]{scrpage2}
\IfElseChapterDefined{%
   \pagestyle{scrheadings} % Seite mit Headern
}{
   \pagestyle{scrplain} % Seiten ohne Header
}
\clearscrheadings
\clearscrplain
\IfElseChapterDefined{
   \ohead{\pagemark}
   \ihead{\headmark}
   \ofoot[\pagemark]{} 
}{
   \cfoot[\pagemark]{\pagemark} % Mitte unten: Seitenzahlen bei plain
}
\IfElseChapterDefined{
   \automark[section]{chapter} %[rechts]{links}
}{
   \automark[subsection]{section} %[rechts]{links}
}
\IfChapterDefined{\setheadsepline{.4pt}[\color{black}]}
\setheadwidth[0pt]{text}
\setfootwidth[0pt]{text}
\deffootnote{1.5em}{1em}{\makebox[1.5em][l]{\thefootnotemark}}
\addtolength{\skip\footins}{\baselineskip} 
\setlength{\dimen\footins}{10\baselineskip} 
\interfootnotelinepenalty=10000
\IfElsePackageLoaded{fourier}{
   \newcommand\SectionFontStyle{\rmfamily}
}{
   \newcommand\SectionFontStyle{\sffamily}
}
\IfChapterDefined{%
   \setkomafont{chapter}{\huge\SectionFontStyle}    % Chapter
}
\setkomafont{sectioning}{\SectionFontStyle}
\setkomafont{subsection}{\usekomafont{sectioning}}
\setkomafont{descriptionlabel}{\itshape}
\setkomafont{pageheadfoot}{\normalfont\normalcolor\small\sffamily}
\setkomafont{pagenumber}{\bfseries\usekomafont{sectioning}}

\addtokomafont{sectioning}{\color{sectioncolor}} 
\IfChapterDefined{%
    \addtokomafont{chapter}{\color{sectioncolor}} 
}
\renewcommand*{\raggedsection}{\raggedright} 
\usepackage{titlesec}
\titleformat{\section}
   [hang]%[frame]display
   {\usekomafont{sectioning}\Large}
  {\thesection}
   {6pt}
   {}
   [\titlerule \vspace{0.5\baselineskip}]
\titleformat{\subsection}
    [hang]
    {\usekomafont{sectioning\small}}
    {\thesubsection}
    {4pt}
    {}
\titleformat{\chapter}[display] % {command}[shape]
  {\usekomafont{chapter}\Large \color{black}}   % format
  {                                         % label
  \LARGE\MakeUppercase{\chaptertitlename} \Huge \thechapter \filright%
  }%}
  {1pt}                                     % sep (from chapternumber)
  {\titlerule \vspace{0.9pc} \filright \color{sectioncolor}}   % {before}[after] (before chaptertitle and after)
  [\color{black} \vspace{0.9pc} \filright {\titlerule}]
\usepackage{caption}

\captionsetup{
   margin = 10pt,
   font = {small,rm},
   labelfont = {small,bf},
   format = plain, % oder 'hang'
   indention = 0em,  % Einruecken der Beschriftung
   labelsep = colon, %period, space, quad, newline
   justification = justified, % RaggedRight,justified, centering
   singlelinecheck = true, % false (true=bei einer Zeile immer zentrieren)
   position = bottom %top
}
\DeclareCaptionOption{parskip}[]{}
\DeclareCaptionOption{parindent}[]{}
\IfPackageLoaded{subfig}{
 \captionsetup[subfloat]{
   margin = 10pt,
   font = {small,rm},
   labelfont = {small,bf},
   format = plain, % oder 'hang'
   indention = 0em,  % Einruecken der Beschriftung
   labelsep = space, %period, space, quad, newline
   justification = RaggedRight, % justified, centering
   singlelinecheck = true, % false (true=bei einer Zeile immer zentrieren)
   position = bottom, %top
   labelformat = parens % simple, empty % Wie die Bezeichnung gesetzt wird
 }
}
\captionsetup[subfloat]{labelformat=empty}
\IfPackageNotLoaded{caption}{
    \usepackage{capt-of}    
}
\setcounter{secnumdepth}{3}  
\setcounter{tocdepth}{2}
\IfPackageLoaded{subfig}{
    \setcounter{lofdepth}{1}  %1 = nur figures, 2 = figures + subfigures
}
\IfDefined{makeindex}{\makeindex}
\IfDefined{makenomenclature}{\makenomenclature}
\IfPackageLoaded{minitoc}{\IfElseUnDefined{chapter}{\dosecttoc}{\dominitoc}}
\listfiles
\usepackage{ifthen} 
\usepackage[absolute]{textpos} 
\usepackage{floatflt}
\usepackage{enumitem}

我在其中一个输入中使用了 subsection 命令,例如在 2-TheoreticallBackground 中

\section{section name}
contents... ...
\subsection{name}
contents again

第 3 行 \subsection{} 出现 4 个错误:1。

Missing \endcsname inserted.
<to be read again>

            \relax

l.4,,,tion{Three Dimensional Quantum Confinement}

The control sequence marked <to be read again> should not appear between \csname and \encsname.
Extra \endcsname.

\@ifundefined#1->\ifcsname#1\endcsname

               \@ifundefined@d@i\else\\@ifundefined@d...

 l.4,,,tion{Three Dimensional Quantum Confinement}

I'm ignoring this, since I wasn't doing a \csname.

Extra \endcsname.   

<argument>...ct\add@extra@list{sml}\endcsname

l.4,,,tion{Three Dimensional Quantum Confinement}

I'm ignoring this, since I wasn't doing a \csname.
Extra \endcsname.  

\@nameuse#1->\csname#1\endcsname

l.4,,,tion{Three Dimensional Quantum Confinement}

I'm ignoring this, since I wasn't doing a \csname.

我不知道为什么会同时出现这么多错误。而且每当我使用 \subsection{} 时,这些错误都会出现。请告诉我该怎么办。

感谢您的时间和帮助!

答案1

问题归结为以下显示相同错误的相当简单的例子。

\documentclass{scrbook}
% From preambel/preambel.tex
\usepackage{titlesec}
\titleformat{\section}
   [hang]%[frame]display
   {\usekomafont{sectioning}\Large}
  {\thesection}
   {6pt}
   {}
   [\titlerule \vspace{0.5\baselineskip}]
\titleformat{\subsection}
    [hang]
    {\usekomafont{sectioning\small}} % <<<<<<<<<<<<<<<
    {\thesubsection}
    {4pt}
    {}
\begin{document}
\subsection{Some heading}
\end{document}

注意标记的行。该命令\small应跟在花括号后面,即该行应为

    {\usekomafont{sectioning}\small} % <<<<<<<<<<<<<<<

此行出现在文件中preambel/preambel.tex

相关内容