修复 latex 书中的错误

修复 latex 书中的错误

我收到“未定义的控制序列”。如何修复它。这是我的环境。我使用的所有代码,但只显示错误

 \documentclass[a4paper, 12pt, twoside]{book}
    \usepackage{pdfpages}
    \usepackage{pslatex}%
    \usepackage{setspace}
    \setlength{\abovecaptionskip}{1pt}
    \usepackage[paperheight=297mm,paperwidth=215mm,top=3cm,left=4cm,bottom=3cm,right=3cm]{geometry}

    \renewcommand{\thechapter}{\Roman{chapter}}
    \renewcommand{\thesection}{\arabic{chapter}.\arabic{section}}
    \renewcommand{\thesubsubsection}{\arabic{chapter}.\arabic{subsubsection}}
    \renewcommand{\thefigure}{\arabic{chapter}.\arabic{figure}}
    \renewcommand{\thetable}{\arabic{chapter}.\arabic{table}}
    \renewcommand{\theequation}{\arabic{chapter}.\arabic{equation}}
    \renewcommand{\figurename}{Gambar}
    \renewcommand{\tablename}{Tabel}

    %\renewcommand{\refname}{Daftar Pustaka}
    %\renewcommand{\bibliname}{Daftar Pustaka}

    \usepackage{colortbl}
    \usepackage[none]{hyphenat}
    \usepackage{wrapfig}
    \usepackage{textcomp}
    \usepackage{enumerate}
    \usepackage{changepage}
    \usepackage{mdframed} \newmdenv[]{kotak} %membuat kotak
    \newenvironment{subs}
      {\adjustwidth{0.935cm}{0pt}}
      {\endadjustwidth}
      \newenvironment{subs2}
        {\adjustwidth{1.28cm}{0pt}}
        {\endadjustwidth}
        \newenvironment{subs3}
                {\adjustwidth{2cm}{0pt}}
                {\endadjustwidth}
    % Membuat seluruh tulisan menjadi Times New Roman.
    \usepackage{pslatex}
    \usepackage{amsmath} \usepackage{mathtools} \newcommand
    \numberthis{\addtocounter{equation}{1}\tag{\theequation}} %penomoran equation
    \usepackage{amssymb} \usepackage{mathrsfs}
    \hyphenpenalty=10000
    \hbadness=10000
    \tolerance=1
    \emergencystretch=\maxdimen
    \usepackage{graphicx}
    \renewcommand{\chaptername}{BAB}                % mengubah "Chapter" jadi "BAB"
    \makeatletter
    \renewcommand{\@makechapterhead}[1]{            %pengaturan awal

    {\parindent \z@ \raggedright \normalfont
    \ifnum \c@secnumdepth >\m@ne
    \if@mainmatter
    \center \MakeUppercase{\large\bfseries \@chapapp\space \thechapter}
    %\chapapp\space memunculkan kata "Bab"
    \par\nobreak
    \vskip 6\p@ % Mengatur jarak antara "Bab 1" dan "Pendahuluan"
    \fi
    \fi
    \interlinepenalty\@M
    \large \uppercase{\bfseries #1\par\nobreak} %Bagian ini memunculkan judul bab
    \vskip 30\p@ % Mengatur jarak antara "Bab 1" dengan "Teks"
    }}
    %
    \makeatother                            %pengaturan akhir
    \usepackage[pagestyles]{titlesec}

    \titleformat{\section}{\bf\normalsize}{\makebox[1.78em][l]{\thesection}}{1ex}{}{}
    \titleformat*{\subsection}{\bf\normalsize}
    \titleformat*{\subsubsection}{\bf\normalsize}
    % Mengatur spacing section

    \titlespacing*{\section}
    {0pt}{24pt}{6pt}
    \titlespacing*{\subsection}
    {0pt}{24pt}{6pt}
    \titlespacing*{\subsubsection}
    {0pt}{24pt}{6pt}
    % Untuk mengkustomisasi margin

    \newpagestyle{mainps}{%
    \setfoot[\thepage][][]{}{}{\thepage}
}


    \usepackage{scrextend}
    % Digunakan untuk mengatur caption dalam dokumen.
    \usepackage[font=footnotesize,format=plain,up,textfont=up]{caption}
    % Untuk menghapus titik dua (colon)
    \captionsetup[figure]{labelsep=space}
    \captionsetup[table]{labelsep=space}
    \usepackage{tocbasic}

    \renewcommand{\contentsname}{DAFTAR ISI}
    % Redefinition of ToC command to get centered heading
    \makeatletter
    \renewcommand\tableofcontents{%
      \addcontentsline{toc}{chapter}{DAFTAR ISI}\cleardoublepage\null\vspace{-12pt}\hfill\textbf{\large\contentsname}\hfill\null\par
      \@mkboth{\MakeUppercase\contentsname}{\MakeUppercase\contentsname}%
      \vspace{30pt}
      \@starttoc{toc}%
    }
    \makeatother

    \usepackage{eqparbox} %membuat spasi chapter rata

    \usepackage{titletoc}%
    \titlecontents{chapter}% <section-type>
      [0pt]% <left>
      {\vspace{12pt}\bfseries}% <above-code>
      {\eqmakebox[TC][l]{\chaptername~\thecontentslabel }\quad}% <numbered-entry-format>
      {}% <numberless-entry-format>
      {\hfill\contentspage}[\vspace{0pt}]

      \titlecontents{section}[27mm]
        {\vspace{-6pt}\normalsize\normalfont}
        {\contentslabel[\thecontentslabel]{24pt}}{}
        {\titlerule*[.75em]{.}{\contentspage}}

      \titlecontents{subsection}[38mm]
        {\vspace{-6pt}\normalsize\normalfont}
        {\contentslabel[\thecontentslabel]{30pt}}{}
        {\titlerule*[.75em]{.}{\contentspage}}
    %listoffigures
    \renewcommand{\listfigurename}{DAFTAR GAMBAR}
    \cleardoublepage
    \makeatletter
    \renewcommand\listoffigures{{%
      \let\oldnumberline\numberline%
      \renewcommand{\numberline}{\figurename~\oldnumberline}%
      \null\vspace{-24pt}\hfill\textbf{\fontsize{14}{12}\selectfont\listfigurename}\hfill\null\par
      \@mkboth{\MakeUppercase\listfigurename}{\MakeUppercase\listfigurename}%
      \vspace{20pt}

        \@starttoc{lof}%
    }}

    \titlecontents{figure}
      [2.5cm]
      {\addvspace{12pt}}
      {\makebox[0pt][r]{%
          \makebox[2.4cm][l]{Gambar~\thecontentslabel}%
        }%
      }
      {\hspace{-1.7cm}}
      {\titlerule*[6pt]{.}\contentspage}

    % from https://tex.stackexchange.com/a/275577:
    \usepackage{xpatch}
    \makeatletter
    \xpatchcmd{\@chapter}{%
      \addtocontents{lof}{\protect\addvspace{10\p@}}%
      \addtocontents{lot}{\protect\addvspace{10\p@}}%
    }{}{}{}
    \makeatother

    %listoftables
    \renewcommand{\listtablename}{DAFTAR TABEL}
    \cleardoublepage{}
    \makeatletter
    \renewcommand\listoftables{%
      \null\hfill\textbf{\large\listtablename}\hfill\null\par
      \@mkboth{\MakeUppercase\listtablename}{\MakeUppercase\listtablename}%
      \vspace{20pt}

        \@starttoc{lot}%
    }
    \renewcommand{\listtablename}{DAFTAR TABEL}
    \cleardoublepage{}
    \makeatletter
    \renewcommand\listoffigures{{%
      \let\oldnumberline\numberline%
      \renewcommand{\numberline}{\figurename~\oldnumberline}%
      \null\hfill\textbf{\large\listfigurename}\hfill\null\par
      \@mkboth{\MakeUppercase\listfigurename}{\MakeUppercase\listfigurename}%
      \vspace{20pt}

        \@starttoc{lof}%
    }}
    \titlecontents{table}
      [2.5cm]
      {\addvspace{12pt}}
      {\makebox[0pt][r]{%
          \makebox[2.4cm][l]{Tabel~\thecontentslabel}%
        }%
      }
      {\hspace{-1.7cm}}
      {\titlerule*[6pt]{.}\contentspage}
    \usepackage{xpatch}
    \makeatletter
    \xpatchcmd{\@chapter}{%
      \addtocontents{lof}{\protect\addvspace{10\p@}}%
      \addtocontents{lot}{\protect\addvspace{10\p@}}%
    }{}{}{}
    \makeatother

    \newenvironment{abstract}{
      \vspace*{\fill}
      \begin{center}%
        \bfseries\abstractname
      \end{center}}%
      {\vfill}

      \usepackage[style=authoryear,natbib=true]{biblatex}
      \addbibresource{references.bib}

这是错误部分

\begin{document}
 \newgeometry{top=4.5cm, bottom=4.5cm,left=2cm,right=2cm} 
\begin{center}
 \pagestyle{fancy}
 \addcontentsline{toc}{chapter}{HALAMAN SAMPUL}                                                             %Menghilangkan nomor halaman 
 \centering                                                                                 %rata tengah
\includegraphics[width=3.2cm,height=3.5cm]{logo.png}\\                                      %Memanggil gambar, untad.jpg = nama file gambar, width = lebar gambar, height = tinggi gambar
                                                                        %environment akhir gambar
  \vspace{0.5cm}    
                                                                            %memulai rata tengah
\fontsize{14}{12pt} \selectfont {SOLUSI NUMERIK MODEL ALIRAN MASSA\\DALAM SISTEM KULTIVASI \textit{OPEN POND RACEWAYS} PADA SAWAH ALGA}\\
    % \textbf=bold dan \textit=italic 
 \vspace{3.5cm}                                                                             %spasi vertikal sejauh 1.5cm 
 \fontsize{15}{12}\selectfont{\textbf{SKRIPSI}}\\
 \vspace{3.5cm}

 \fontsize{13}{12}\selectfont{\textbf{EDDY ISWARDI\\G 201 16 043}}\\

  \vspace{5cm}
\fontsize{14}{12pt}\selectfont{ \textbf{PROGRAM STUDI MATEMATIKA JURUSAN MATEMATIKA\\
 FAKULTAS MATEMATIKA DAN ILMU PENGETAHUAN ALAM\\
 UNIVERSITAS TADULAKO}}\\\vspace{12pt}
\fontsize{15}{12}\selectfont {\textbf{DESEMBER, 2019}}
 \end{center}

\end{document}

答案1

包裹

\usepackage{fancyhdr}

丢失。你需要它\pagestyle{fancy}

完整的可编译代码:

\documentclass[a4paper, 12pt, twoside]{book}
    \usepackage{pdfpages}
    \usepackage{pslatex}%
    \usepackage{setspace}
    \setlength{\abovecaptionskip}{1pt}
    \usepackage[paperheight=297mm,paperwidth=215mm,top=3cm,left=4cm,bottom=3cm,right=3cm]{geometry}

    \renewcommand{\thechapter}{\Roman{chapter}}
    \renewcommand{\thesection}{\arabic{chapter}.\arabic{section}}
    \renewcommand{\thesubsubsection}{\arabic{chapter}.\arabic{subsubsection}}
    \renewcommand{\thefigure}{\arabic{chapter}.\arabic{figure}}
    \renewcommand{\thetable}{\arabic{chapter}.\arabic{table}}
    \renewcommand{\theequation}{\arabic{chapter}.\arabic{equation}}
    \renewcommand{\figurename}{Gambar}
    \renewcommand{\tablename}{Tabel}

    %\renewcommand{\refname}{Daftar Pustaka}
    %\renewcommand{\bibliname}{Daftar Pustaka}

    \usepackage{colortbl}
    \usepackage[none]{hyphenat}
    \usepackage{wrapfig}
    \usepackage{textcomp}
    \usepackage{enumerate}
    \usepackage{changepage}
    \usepackage{mdframed} \newmdenv[]{kotak} %membuat kotak
    \newenvironment{subs}
      {\adjustwidth{0.935cm}{0pt}}
      {\endadjustwidth}
      \newenvironment{subs2}
        {\adjustwidth{1.28cm}{0pt}}
        {\endadjustwidth}
        \newenvironment{subs3}
                {\adjustwidth{2cm}{0pt}}
                {\endadjustwidth}
    % Membuat seluruh tulisan menjadi Times New Roman.
    \usepackage{pslatex}
    \usepackage{amsmath} \usepackage{mathtools} \newcommand
    \numberthis{\addtocounter{equation}{1}\tag{\theequation}} %penomoran equation
    \usepackage{amssymb} \usepackage{mathrsfs}
    \hyphenpenalty=10000
    \hbadness=10000
    \tolerance=1
    \emergencystretch=\maxdimen
    \usepackage{graphicx}
    \renewcommand{\chaptername}{BAB}                % mengubah "Chapter" jadi "BAB"
    \makeatletter
    \renewcommand{\@makechapterhead}[1]{            %pengaturan awal

    {\parindent \z@ \raggedright \normalfont
    \ifnum \c@secnumdepth >\m@ne
    \if@mainmatter
    \center \MakeUppercase{\large\bfseries \@chapapp\space \thechapter}
    %\chapapp\space memunculkan kata "Bab"
    \par\nobreak
    \vskip 6\p@ % Mengatur jarak antara "Bab 1" dan "Pendahuluan"
    \fi
    \fi
    \interlinepenalty\@M
    \large \uppercase{\bfseries #1\par\nobreak} %Bagian ini memunculkan judul bab
    \vskip 30\p@ % Mengatur jarak antara "Bab 1" dengan "Teks"
    }}
    %
    \makeatother                            %pengaturan akhir
    \usepackage[pagestyles]{titlesec}

    \titleformat{\section}{\bf\normalsize}{\makebox[1.78em][l]{\thesection}}{1ex}{}{}
    \titleformat*{\subsection}{\bf\normalsize}
    \titleformat*{\subsubsection}{\bf\normalsize}
    % Mengatur spacing section

    \titlespacing*{\section}
    {0pt}{24pt}{6pt}
    \titlespacing*{\subsection}
    {0pt}{24pt}{6pt}
    \titlespacing*{\subsubsection}
    {0pt}{24pt}{6pt}
    % Untuk mengkustomisasi margin

    \newpagestyle{mainps}{%
    \setfoot[\thepage][][]{}{}{\thepage}
}


    \usepackage{scrextend}
    % Digunakan untuk mengatur caption dalam dokumen.
    \usepackage[font=footnotesize,format=plain,up,textfont=up]{caption}
    % Untuk menghapus titik dua (colon)
    \captionsetup[figure]{labelsep=space}
    \captionsetup[table]{labelsep=space}
    \usepackage{tocbasic}

    \renewcommand{\contentsname}{DAFTAR ISI}
    % Redefinition of ToC command to get centered heading
    \makeatletter
    \renewcommand\tableofcontents{%
      \addcontentsline{toc}{chapter}{DAFTAR ISI}\cleardoublepage\null\vspace{-12pt}\hfill\textbf{\large\contentsname}\hfill\null\par
      \@mkboth{\MakeUppercase\contentsname}{\MakeUppercase\contentsname}%
      \vspace{30pt}
      \@starttoc{toc}%
    }
    \makeatother

    \usepackage{eqparbox} %membuat spasi chapter rata

    \usepackage{titletoc}%
    \titlecontents{chapter}% <section-type>
      [0pt]% <left>
      {\vspace{12pt}\bfseries}% <above-code>
      {\eqmakebox[TC][l]{\chaptername~\thecontentslabel }\quad}% <numbered-entry-format>
      {}% <numberless-entry-format>
      {\hfill\contentspage}[\vspace{0pt}]

      \titlecontents{section}[27mm]
        {\vspace{-6pt}\normalsize\normalfont}
        {\contentslabel[\thecontentslabel]{24pt}}{}
        {\titlerule*[.75em]{.}{\contentspage}}

      \titlecontents{subsection}[38mm]
        {\vspace{-6pt}\normalsize\normalfont}
        {\contentslabel[\thecontentslabel]{30pt}}{}
        {\titlerule*[.75em]{.}{\contentspage}}
    %listoffigures
    \renewcommand{\listfigurename}{DAFTAR GAMBAR}
    \cleardoublepage
    \makeatletter
    \renewcommand\listoffigures{{%
      \let\oldnumberline\numberline%
      \renewcommand{\numberline}{\figurename~\oldnumberline}%
      \null\vspace{-24pt}\hfill\textbf{\fontsize{14}{12}\selectfont\listfigurename}\hfill\null\par
      \@mkboth{\MakeUppercase\listfigurename}{\MakeUppercase\listfigurename}%
      \vspace{20pt}

        \@starttoc{lof}%
    }}

    \titlecontents{figure}
      [2.5cm]
      {\addvspace{12pt}}
      {\makebox[0pt][r]{%
          \makebox[2.4cm][l]{Gambar~\thecontentslabel}%
        }%
      }
      {\hspace{-1.7cm}}
      {\titlerule*[6pt]{.}\contentspage}

    % from https://tex.stackexchange.com/a/275577:
    \usepackage{xpatch}
    \makeatletter
    \xpatchcmd{\@chapter}{%
      \addtocontents{lof}{\protect\addvspace{10\p@}}%
      \addtocontents{lot}{\protect\addvspace{10\p@}}%
    }{}{}{}
    \makeatother

    %listoftables
    \renewcommand{\listtablename}{DAFTAR TABEL}
    \cleardoublepage{}
    \makeatletter
    \renewcommand\listoftables{%
      \null\hfill\textbf{\large\listtablename}\hfill\null\par
      \@mkboth{\MakeUppercase\listtablename}{\MakeUppercase\listtablename}%
      \vspace{20pt}

        \@starttoc{lot}%
    }
    \renewcommand{\listtablename}{DAFTAR TABEL}
    \cleardoublepage{}
    \makeatletter
    \renewcommand\listoffigures{{%
      \let\oldnumberline\numberline%
      \renewcommand{\numberline}{\figurename~\oldnumberline}%
      \null\hfill\textbf{\large\listfigurename}\hfill\null\par
      \@mkboth{\MakeUppercase\listfigurename}{\MakeUppercase\listfigurename}%
      \vspace{20pt}

        \@starttoc{lof}%
    }}
    \titlecontents{table}
      [2.5cm]
      {\addvspace{12pt}}
      {\makebox[0pt][r]{%
          \makebox[2.4cm][l]{Tabel~\thecontentslabel}%
        }%
      }
      {\hspace{-1.7cm}}
      {\titlerule*[6pt]{.}\contentspage}
    \usepackage{xpatch}
    \makeatletter
    \xpatchcmd{\@chapter}{%
      \addtocontents{lof}{\protect\addvspace{10\p@}}%
      \addtocontents{lot}{\protect\addvspace{10\p@}}%
    }{}{}{}
    \makeatother

    \newenvironment{abstract}{
      \vspace*{\fill}
      \begin{center}%
        \bfseries\abstractname
      \end{center}}%
      {\vfill}

      \usepackage[style=authoryear,natbib=true]{biblatex}
      \addbibresource{references.bib}

\usepackage{fancyhdr}

      \begin{document}
       \newgeometry{top=4.5cm, bottom=4.5cm,left=2cm,right=2cm} 
      \begin{center}
       \pagestyle{fancy}
       \addcontentsline{toc}{chapter}{HALAMAN SAMPUL}                                                             %Menghilangkan nomor halaman 
       \centering                                                                                 %rata tengah
      \includegraphics[width=3.2cm,height=3.5cm]{logo.png}\\                                      %Memanggil gambar, untad.jpg = nama file gambar, width = lebar gambar, height = tinggi gambar
                                                                              %environment akhir gambar
        \vspace{0.5cm}    
                                                                                  %memulai rata tengah
      \fontsize{14}{12pt} \selectfont {SOLUSI NUMERIK MODEL ALIRAN MASSA\\DALAM SISTEM KULTIVASI \textit{OPEN POND RACEWAYS} PADA SAWAH ALGA}\\
          % \textbf=bold dan \textit=italic 
       \vspace{3.5cm}                                                                             %spasi vertikal sejauh 1.5cm 
       \fontsize{15}{12}\selectfont{\textbf{SKRIPSI}}\\
       \vspace{3.5cm}

       \fontsize{13}{12}\selectfont{\textbf{EDDY ISWARDI\\G 201 16 043}}\\

        \vspace{5cm}
      \fontsize{14}{12pt}\selectfont{ \textbf{PROGRAM STUDI MATEMATIKA JURUSAN MATEMATIKA\\
       FAKULTAS MATEMATIKA DAN ILMU PENGETAHUAN ALAM\\
       UNIVERSITAS TADULAKO}}\\\vspace{12pt}
      \fontsize{15}{12}\selectfont {\textbf{DESEMBER, 2019}}
       \end{center}

      \end{document}

相关内容