对于 \bibliography 和 \section,缺失数字将被视为零

对于 \bibliography 和 \section,缺失数字将被视为零

我有以下示例代码。设置文件的代码(设置)如下;

% Included by MAIN.TEX
% Defines the settings for the CAMP report document

\renewcommand{\sectfont}{\normalfont \bfseries}        % Schriftart der Kopfzeile

% manipulate footer
\usepackage{scrpage2}
\pagestyle{scrheadings}
\ifoot[\footertext]{\footertext} % \footertext set in INFO.TEX
%\setkomafont{pagehead}{\normalfont\rmfamily}
\setkomafont{pagenumber}{\normalfont\rmfamily}

%% allow sophisticated control structures
\usepackage{ifthen}

% use Times New Roman as default font
\usepackage{times}
%\usepackage{palatino}
%\usepackage{mathptmx}

%use as default arial font

\usepackage{helvet}
\renewcommand{\familydefault}{\sfdefault}

%% parskip: used for spaces between paragraphs, no indentation
%\usepackage{parskip}

% enable special PostScript fonts
\usepackage{pifont}

% make thumbnails
\usepackage{thumbpdf}

%to use the subfigures
%\usepackage{subfigure}
%\usepackage{subcaption}
%\usepackage{subfigure}

\usepackage{colortbl}

%Page Dimension
    \usepackage[left=1.5in,right=1in,top=1in,bottom=1in]{geometry}
    %\usepackage{setspace}\doublespacing
    \usepackage{setspace}





\usepackage{multirow}

%% use colors
\usepackage{color}

%% make fancy math
%\usepackage{amsmath}
\usepackage[
intlimits,
sumlimits
]{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{textcomp}
\usepackage{yhmath} % fr die adots
%% k text as preliminary
%\usepackage[draft,german,scrtime]{prelim2e}

%% create an index
\usepackage{makeidx}

% for the program environment
\usepackage{float}

%% load german babel package for german abstract
%\usepackage[german,american]{babel}
\usepackage[german,english]{babel}
\selectlanguage{english}
\usepackage{ellipsis}
\usepackage{microtype}
\usepackage{soul}
\usepackage{booktabs}
\usepackage{tabularx}
\usepackage{longtable}
\usepackage{multirow}

% use german characters as well
\usepackage[latin1]{inputenc}       % allow Latin1 characters

% use initals dropped caps - doesn't work with PDF
%\usepackage{dropping}
 %\usepackage[dvips]{dropping}

%\usepackage{styles/shortoverview}
%----------------------------------------------------
%      Graphics and Hyperlinks
%----------------------------------------------------

%% check for pdfTeX
\ifx\pdftexversion\undefined
 %% use PostScript graphics
 \usepackage[dvips]{graphicx}
 \usepackage[sc]{mathpazo}
 \usepackage{listings}
\usepackage[american]{circuitikz}
 \DeclareGraphicsExtensions{.eps,.epsi}
 \graphicspath{{figures/}{figures/review}}
 \usepackage{siunitx}
 %% allow rotations
 \usepackage{rotating}
 %% mark pages as draft copies
 %\usepackage[english,all,light]{draftcopy}
 %% use hypertex version of hyperref
 \usepackage[hypertex,hyperindex=false,colorlinks=false]{hyperref}
\else %% reduce output size \pdfcompresslevel=9
 %% declare pdfinfo
 %\pdfinfo {
 %  /Title (my title)
 %  /Creator (pdfLaTeX)
 %  /Author (my name)
 %  /Subject (my subject    )
 %  /Keywords (my keywords)
 %}
 %% use pdf or jpg graphics
 \usepackage[pdftex]{graphicx}
 \DeclareGraphicsExtensions{.jpg,.JPG,.png,.pdf,.eps}
 \graphicspath{{figures/}}

 %% Load float package, for enabling floating extensions
 \usepackage{float}

 \usepackage{amssymb,
    amsfonts}

 %% allow rotations
 \usepackage{rotating}
 %% use pdftex version of hyperref
 \usepackage[pdftex,colorlinks=true,linkcolor=black,citecolor=black,%
 anchorcolor=black,urlcolor=black,bookmarks=true,%
 bookmarksopen=true,bookmarksopenlevel=0,plainpages=false%
 bookmarksnumbered=true,hyperindex=false,pdfstartview=%
 ]{hyperref}
%
%\usepackage[pdftex,colorlinks=false,linkcolor=red,citecolor=red,%
% anchorcolor=red,urlcolor=red,bookmarks=true,%
% bookmarksopen=true,bookmarksopenlevel=0,plainpages=false%
% bookmarksnumbered=true,hyperindex=false,pdfstartview=%
% ]{hyperref}
\fi

% Spacing reduce
\usepackage[compact]{titlesec}
% \titlespacing{\section}{0pt}{2ex}{-1ex}
%\titlespacing{\subsection}{0pt}{0ex}{-1ex}
%   \titlespacing{\subsubsection}{0pt}{0.5ex}{-0.5ex}
%%

%    \titleformat{\chapter}[display]
%   {\normalfont\huge\bfseries}{\chaptertitlename\ \thechapter}{20pt}{\Huge}

%\titlespacing{\chapter}{0pt}{*4}{*1.5}

\usepackage{apacite}
\bibliographystyle{apacite}

主文件的代码(主文本)如下:

 % The main file for CAMP reports
 % Don't put any content in here.
 % Don't even include content files by using \input or \inlcude.
 % Put your content to TEXT.TEX or include it there using \input.
 % Uses:
 %      SETTINGS.TEX    contains the settings for this document
 %      COMMANDS.TEX    contains commands which can be used while writing
 %      INFO.TEX            contains the author, title and so on for the cover
 %      COVER.TEX           formats the front cover of the document
 %      ABSTRACT.TEX    contains the abstract to be included (if needed)
 %      TEXT.TEX            contains the actual content of the document
 %      BIB.BIB             containt the BibTeX entries for the document


%% Draft document mode
\documentclass[12pt,a4paper,bibtotoc,idxtotoc,headsepline,footsepline,footexclude,BCOR12mm,DIV13,openany]{scrbook}



%\documentclass[11pt,a4paper,bibtotoc,idxtotoc,headsepline,footsepline,footexclude,BCOR20mm,DIV10]{scrbook}

% KOMA-Optionen:
%  bibtotoc: include bibliography in table of contents
%  idxtotoc: include index in table of contents
%  headsepline: use horizontalline under heading
%  BCOR: binding correcion (Bindungskorrektur) (e.g.: BCOR5mm)
%  DIV: Number of sheet sections (used for layout) (e.g.: DIV12)

% include title and author information for the cover
\input{components/info}

% include settings
\input{components/settings}

% include commands
\input{components/commands}


\makeglossary
%\linespread{1.25}

\begin{document}

    \frontmatter
    
    
    \input{components/titlepage}
    
    %line Spacing
          \onehalfspacing

           % no indentation
            \parindent 0pt

    \input{components/disclaimer}
    
    \input{components/acknowledgements}
    
    \input{components/abstract}
     \linespread{1.25}
    \tableofcontents
    \listoffigures
    \listoftables

  %\input{components/outline}

    \mainmatter
    
    
        % ---------------------------------------------------------------------------
        %
        %Introduction
        %
        % ---------------------------------------------------------------------------
       % \doublespacing
           %paragraph spacing
             \parskip 1.5ex
        \linespread{1.5}
    
        \input{chapters/chapter1}
        
        \input{chapters/chapter2}
        
        \input{chapters/chapter3}
        
        \input{chapters/chapter4}
        
        \input{chapters/chapter5}
        
        
        
        % ---------------------------------------------------------------------------
        %
        % Appendix
        %
        % ---------------------------------------------------------------------------
        
        %\part*{Appendix}
    %   \addcontentsline{toc}{part}{Appendix}
        
    %   \appendix %---------------------------------------
        
        %\input{chapters/oneAppendix}
        

  \clearemptydoublepage
  \linespread{1.25}
    %\bibliography{reference/myrefs}

\end{document}

第一章的代码(第1章)如下:

\chapter{Introduction}
\label{chapter1:Introduction}
 According to survey research conducted by Wang\cite{chisholm2005compack} around 1.7MB of data is being generated every day around the world. This survey report expresses the importance of text mining and sentiment analysis in our daily life.

\section{My heading}
text under my heading. 

bib 文件的代码(我的参考文献)如下:

@article{chisholm2005compack,
  title={COMPACK: a program for identifying crystal structure similarity using distances},
  author={Chisholm, James Alexander and Motherwell, Sam},
  journal={Journal of applied crystallography},
  volume={38},
  number={1},
  pages={228--231},
  year={2005},
  publisher={International Union of Crystallography}
}

当我运行代码时发现以下错误:

!缺失数字,视为零。} l.5 \section{我的标题}

删除之后\section{My heading},发现以下错误。

! 缺失数字,视为零。} l.1 \begin{thebibliography}{}

删除后\bibliography{reference/myrefs},代码运行正常。我该怎么办?有人能告诉我吗?

答案1

其中的 Koma-script 类scrbook与该包不兼容titlesec。以下文档由您的文档的几行组成。

\documentclass{scrbook}
\usepackage[compact]{titlesec}
\begin{document}
\section{My heading}
\end{document}

结果是

! Missing number, treated as zero.
<to be read again> 
                   }
l.4 \section{My heading}
                        
? 

我建议删除该\usepackage[compact]{titlesec}settings.tex

相关内容