子节错误

子节错误

我发现这个文档有一个错误:

\documentclass[a4paper , 12pt]{article}

\usepackage{amsmath}
\usepackage{hyphenat}
%\usepackage{indentfirst}
%\usepackage{multicol}
%\usepackage{blindtext}
%\usepackage{mathrsfs}
%\usepackage{amssymb}
%\usepackage{mathtools}
\usepackage{hyperref}
%\DisemulatePackage{setspace}
\usepackage{setspace}
\usepackage{graphicx}
\usepackage{float}
\usepackage{caption}
\usepackage{algorithmicx}
\usepackage{algorithm}
\usepackage{listings}
\usepackage{algcompatible}
\usepackage{algpseudocode}
\usepackage{float}
%\usepackage[compact]{titlesec}
\usepackage{parskip}
\usepackage{subcaption}
%\usepackage[pdf]{pstricks}
\usepackage{titlesec}

\usepackage{comment}
%\usepackage[crop=off]{auto-pst-pdf}
%\usepackage{pst-node,graphicx}
%\SpecialCoor
\usepackage[top=4cm, bottom=3cm, left=4cm, right=3cm]{geometry}

\usepackage{arabtex}
%\titlespacing{\chapter}{0pt}{50pt}{<after-sep>}

\usepackage[space]{grffile}

\makeatletter
\setlength{\@fptop}{0pt}
\makeatother

% untuk meletakkan float di daerah tertentu
\usepackage{float}
%\usepackage{pstrick}
%\usepackage{pst-all}
%\usepackage{pstricks-add}
\setlength{\parindent}{0cm}
%\usepackage[pdflatex]{pstricks}
%\usepackage{pstricks}
%\usepackage{auto-pst-pdf}




%\setlength{\textfloatsep}{10pt plus 1.0pt minus 2.0pt}

\hyphenation{be-be-ra-pa}
\hyphenation{per-hi-tu-ngan}
\hyphenation{su-a-tu}
\hyphenation{se-te-ngah}
\hyphenation{hy-dro-di-na-mics}
%
%\renewcommand{\listalgorithmname}{Liste des }

%\renewcommand{\figurename}{Gambar}
%\renewcommand{\chaptername}{Bab}
%\renewcommand{\tablename}{Tabel}
%\renewcommand{\bibname}{Referensi}

\captionsetup[figure]{labelsep=period}

\setlength{\abovecaptionskip}{0pt}
\setlength{\belowcaptionskip}{0pt}

\setlength{\floatsep}{0pt}

\setlength{\textfloatsep}{0pt}

\setlength{\intextsep}{10pt}


\onehalfspacing



%\setlength{\abovedisplayskip}{10pt}
%\setlength{\belowdisplayskip}{10pt}
\setlength{\belowdisplayskip}{0pt} \setlength{\belowdisplayshortskip}{0pt}
\setlength{\abovedisplayskip}{0pt} \setlength{\abovedisplayshortskip}{0pt}

%\titleformat{\chapter}[hang]
%{\normalfont\Large \bfseries\centering}{\centering \chaptertitlename\ \thechapter}{20pt}{\Large}
%
%\titlespacing*{\chapter}{0pt}{-50pt}{40pt}

\hyphenation{e-ner-gi}
\hyphenation{de-ngan}
\hyphenation{di-nya-ta-kan}
\hyphenation{Newton}
\hyphenation{se-lan-jut-nya}
\hyphenation{di-re-pre-sen-ta-si-kan}
\hyphenation{di-li-hat}
\hyphenation{se-pe-rang-kat}

%\newcommand*{\justifyheading}{\centering}
%\titleformat{\chapter}[display]
%  {\normalfont\bfseries\justifyheading\Large}{\chaptertitlename \  \thechapter}
%  {14pt}{}
\titleformat{\section}[hang]
  {\normalfont \bfseries \raggedright  \normalsize  }{\thesection.}{1em}{}
\titleformat{\subsection}[hang]
  {\normalfont \bfseries\justifyheading \raggedright
%   \setlength\leftskip{0pt} \setlength\parfillskip{-\rightskip}
  }{\thesubsection}{1em}{}

  \titlespacing*{\chapter}{0pt}{0pt}{20pt}
  \titlespacing{\section}{0pt}{0pt}{0pt}
  \titlespacing{\subsection}{0pt}{0pt}{0pt}


 \newcommand{\xxb}{\boldsymbol{x} - \boldsymbol{x}'}
 \newcommand{\xb}{\boldsymbol{x}}
 \newcommand{\xab}{\boldsymbol{x}'}
 \newcommand{\xijb}{\boldsymbol{x}_i - \boldsymbol{x}_j}

% \setlength{\intextsep}{5pt} % Vertical space above & below [h] floats


% untuk spasi antar paragrapah 
% http://www.tomdesair.com/blog/2013/04/latex-paragraph-spacing-and-indentation/
%The first command sets the indentation to 0 and thus cancels paragraph indentation. The second command sets the height of the trailing blank line. This is done using the LaTeX measure ex. One ex corresponds to the height of a lowercase ‘x’ in the current font style. I use 1.3 because I want the height of a capital letter. The “plus 0.5ex minus 0.3ex” part tells LaTeX that it can increase the height with at most 0.5ex and decrease it with maximum 0.3ex to make a decent layout. This means that the minimal height of the blank line is 1ex and the maximum 1.8ex.
%\setlength{\parskip}{1.3ex plus 0.5ex minus 0.3ex}


%\usepackage{pgfplots}


% Untuk menggambar fungsi gaussian
%\pgfmathdeclarefunction{gauss}{2}{%
%  \pgfmathparse{1/(#2*sqrt(2*pi))*exp(-((x-#1)^2)/(2*#2^2))}%
%}


% untuk menempatkan algoritma outside float
%\DeclareCaptionFormat{algor}{%
%  \hrulefill\par\offinterlineskip\vskip1pt%
%    \textbf{#1#2}#3\offinterlineskip\hrulefill}
%\DeclareCaptionStyle{algori}{singlelinecheck=off,format=algor,labelsep=space}
%\captionsetup[algorithm]{style=algori}

\setlength\parskip{10pt}


\hyphenation{meng-im-ple-men-ta-si-kan}
\hyphenation{me-nya-ta-kan}

\setlength{\belowcaptionskip}{0pt}
\setlength{\abovecaptionskip}{0pt}

\setlength{\textfloatsep}{10pt} 
\setlength{\floatsep}{20pt} 
\setlength{\abovecaptionskip}{10pt}
\setlength{\belowcaptionskip}{5pt}



\newcommand{\Scale}[2]{\raisebox{0.ex}{\scalebox{1.0}{$\displaystyle #1_{#2}\;$}}}

\hyphenation{pre-dic-tor}
\hyphenation{me-nyim-pan}
\hyphenation{in-ter-ak-si}

\allowdisplaybreaks

\hyphenation{MATLAB}
\hyphenation{peng-ak-ses-an}
\hyphenation{na-mun}

\hyphenation{predictor-corrector}
\hyphenation{array}
\hyphenation{e-va-lu-a-si}

\hyphenation{re-fe-ren-si}

\hyphenation{prog-ram}

\hyphenation{vo-lu-me}


% Rubah penamaan  daftar gambar dan daftar isi pada table of contents
\renewcommand*\listfigurename{Daftar Gambar}
\renewcommand*\contentsname{Daftar Isi}
\renewcommand*{\listtablename}{Daftar Tabel}
% juga penamaan daftar algorithm
\renewcommand{\listalgorithmname}{Daftar Algoritma}

\hyphenation{eks-ter-nal}

\hyphenation{in-fi-ni-te-si-mal}

\hyphenation{i-ni-sia-li-sa-si}

\hyphenation{di-de-fi-ni-si-kan}

\hyphenation{institut}
%\setcounter{secnumdepth}{2}
%\setsecnumdepth{subsection}

\hyphenation{per-sya-ra-tan}

\hyphenation{program}

\hyphenation{meng-ap-li-ka-si-kan}

\hyphenation{difference}

\hyphenation{si-mu-la-si}

\hyphenation{lag-ra-ngi-an}

% \renewcommand{\rmdefault}{pnc}
%\renewcommand{\sfdefault}{pag}
%\renewcommand{\ttdefault}{pcr}

%\renewcommand{\rmdefault}{pbk}

%\renewcommand{\rmdefault}{pzc}


\hyphenation{di-bang-kit-kan}
\renewcommand{\rmdefault}{bch}

\hyphenation{ber-ka-i-tan}

\hyphenation{programming}
\hyphenation{con-vex}
\hyphenation{hull}

\hyphenation{product}
\usepackage{listing}

\hyphenation{ge-ne-ra-tion}

\hyphenation{pe-nga-tu-ran}

\hyphenation{sa-ling}
\hyphenation{doub-le}

\hyphenation{diffe-ren-si-al}

\hyphenation{ber-a-da}


\hyphenation{pe-nga-ruh}
\hyphenation{se-ba-gai}

\hyphenation{boun-da-ry}

\hyphenation{re-gu-ler}

\hyphenation{i-te-ra-si}

\hyphenation{meng-a-ki-bat-kan}

\hyphenation{ge-ra-kan}

\hyphenation{se-di-kit-pun}

\hyphenation{lag-ra-ngian}


% set roman letter for section and sub-section
%\renewcommand{\thesection}{\Roman{chapter}.\arabic{section}} 
%\renewcommand{\thesubsection}{\Roman{chapter}.\arabic{section}.\arabic{subsection}}
%\renewcommand{\thechapter}{\Roman{chapter}}

% Use "Times News Roman" aka  nestxtext letter because  mathpmtx not very likely with Times News Roman 
\usepackage{newtxtext}


% hilangkan  subsection dari table of content
\setcounter{tocdepth}{1}

% ganti penamaan algorithm
\makeatletter
\renewcommand*{\ALG@name}{Algoritma}
\makeatother

% ubah penomoran algoritma dengan menambah nomor dari bab 
\renewcommand{\thealgorithm}{\Roman{chapter}.\arabic{algorithm}}

\hyphenation{per-ban-di-ngan}

%\usepackage{fancyhdr}
%\pagestyle{fancy}
%\chead{\thepage}
%%\fancyhf{}
%\thispagestyle{fancy}


% menghilangkan header dan membuat nomor halaman pada bawah tengah 
\pagestyle{plain}

\hyphenation{di-sa-ji-kan}

\hyphenation{ke-ting-gi-an}

\usepackage{multirow}


\usepackage{multirow,array,booktabs}

%\tablename{Tabel}


% untuk menebalkan garis dari tabel.. 
\usepackage{makecell}

\usepackage[numbers]{natbib}

% untuk mengatasi masalah Penempatan verbatim dalam footnotes ... 
 \usepackage{fancyvrb}
 \VerbatimFootnotes

 \hyphenation{se-gi-ti-ga}

% \interfootnotelinepenalty=1000

\title{Simulasi Gerak Fluida Dua Fasa Cair-Cair dengan Metode  Smoothed Particle Hydrodynamics}


\date{}
\begin{document}
\section{Pendahuluan}
dsadasdsa
\subsection{sadad}
dasd
\end{document}

有错误输出:

在此处输入图片描述

答案1

错误是由\justifyheading行上未定义的命令引起的

\titleformat{\subsection}[hang]
  {\normalfont \bfseries\justifyheading \raggedright
%   \setlength\leftskip{0pt} \setlength\parfillskip{-\rightskip}
  }{\thesubsection}{1em}{}

因此,您有 2 个选项来修复错误。

  1. \justifyheading从上面一行删除;或
  2. 取消和%\newcommand*{\justifyheading}{\centering}之间的注释\hyphenation{se-pe-rang-kat}%\titleformat{\chapter}[display]

    \hyphenation{di-li-hat}
    \hyphenation{se-pe-rang-kat}
    
    %\newcommand*{\justifyheading}{\centering}
    %\titleformat{\chapter}[display]
    %  {\normalfont\bfseries\justifyheading\Large}{\chaptertitlename \      \thechapter}
    %  {14pt}{}
    \titleformat{\section}[hang]
      {\normalfont \bfseries \raggedright  \normalsize  }{\thesection.}    {1em}{}
    

相关内容