\maketitle 缺失数字视为零。计量单位非法(插入 pt)。未定义控制序列

\maketitle 缺失数字视为零。计量单位非法(插入 pt)。未定义控制序列

我按照您提到的进行了编辑,但是\begin{document}\end{document}从一开始就按照您提到的位置放置,但错误仍然存​​在。


我遇到了以下错误,但找不到解决方案。有人能帮我吗?这是我的代码示例:

\usepackage{blindtext}
\usepackage[colorlinks=true,linkcolor=black]{hyperref}
\usepackage{graphicx}
\usepackage[utf8]{inputenc}
\usepackage[greek,english]{babel}
\usepackage{alphabeta}
\usepackage[document]{ragged2e}
\usepackage{microtype}
\usepackage{fancyhdr}
\usepackage[export]{adjustbox}

\fancypagestyle{plain}{
\fancyhf{}% Clear header/footer
\fancyhead{}
\fancyhead[L,RO]{\nouppercase\leftmark}
\fancyhead[R]{\thepage}
}
\pagestyle{plain}% Set page style to plain.

\graphicspath{ {C:/Users/.../Desktop/Manual/} }
\author{...}
\title{...}
\date{}

\makeatletter
\renewcommand{\maketitle}{
   \begin{titlepage}
    \newcommand{\HRule}{\rule{\linewidth}{0.5mm}} % Defines a new command 
                                                    for the horizontal 
                                                    lines, change thickness 
                                                    here

    \center % Center everything on the page

    \textsc{\LARGE \textwidth ....}\\[1.5cm]
    \textsc{\Large ...}\\[0.5cm] 
    \textsc{\large ...}\\[0.5cm] 

    \HRule \\[0.8cm]
    { \huge \bfseries A guide of .....}\\[0.4cm] % Title of your document
    \HRule \\[1.5cm]

    \begin{flushleft}
    \begin{center}
    \centering
        \includegraphics[width=\textwidth]{logo}
    \end{center}
    \end{flushleft}

    \vfill
    \begin{minipage}{0.4\textwidth}
    \begin{center} \large
    \emph{Author:}\\
    A \texts{P} 
    \end{center}
    \end{minipage}
    \vfill
    %~
\end{titlepage}
}
\makeatother
\date{}

\begin{document}

\maketitle
\newpage
\tableofcontents{}

\chapter{Ε..}
    \vfill
        \begin{center}
            \includegraphics[max size={\textwidth}{\textheight}]{home_page_gr}
        \end{center}
\end{document}

答案1

可编译(无错误)代码:

\documentclass{report}
\usepackage{blindtext}
\usepackage[colorlinks=true,linkcolor=black]{hyperref}
\usepackage{graphicx}
\usepackage[utf8]{inputenc}
\usepackage[greek,english]{babel}
\usepackage{alphabeta}
\usepackage[document]{ragged2e}
\usepackage{microtype}
\usepackage{fancyhdr}
\usepackage[export]{adjustbox}

\fancypagestyle{plain}{
\fancyhf{}% Clear header/footer
\fancyhead{}
\fancyhead[L,RO]{\nouppercase\leftmark}
\fancyhead[R]{\thepage}
}
\pagestyle{plain}% Set page style to plain.

\graphicspath{ {C:/Users/.../Desktop/Manual/} }
\author{...}
\title{...}
\date{}

\begin{document}

\begin{titlepage}
    \newcommand{\HRule}{\rule{\linewidth}{0.5mm}} % Defines a new command 

    \center % Center everything on the page

    \textsc{\LARGE ....}\\[1.5cm]
    \textsc{\Large ...}\\[0.5cm] 
    \textsc{\large ...}\\[0.5cm] 

    \HRule \\[0.8cm]
    { \huge \bfseries A guide of .....}\\[0.4cm] % Title of your document
    \HRule \\[1.5cm]

    \begin{flushleft}
    \begin{center}
    \centering
        \includegraphics[width=\textwidth]{example-image-a}
    \end{center}
    \end{flushleft}

    \vfill
    \begin{minipage}{0.4\textwidth}
    \begin{center} \large
    \emph{Author:}\\
    A \textsc{P} 
    \end{center}
    \end{minipage}
    \vfill
    %~
\end{titlepage}

\newpage
\tableofcontents{}

\chapter{Ε..}
    \vfill
        \begin{center}
            \includegraphics[max size={\textwidth}{\textheight}]{example-image-b}
        \end{center}
\end{document}

我所做出的改变:

  1. 解决主要问题:我明白了问题\textwidth所在\textsc{\LARGE \textwidth ....}\\[1.5cm]。我不太明白为什么会这样。或者您想添加当前边距宽度吗?
  2. 在原始代码中,Defines a new command被 识别为注释%,但for the horizontal lines, change thickness here事实并非如此。我决定删除它们:)
  3. 为了解决错误Undefined control sequence:我将\texts中的 (未定义)更改A \texts{P}\textsc。好吧,P 已经是大写,所以这个命令根本没有必要……
  4. 当然,我无法编译您的文档,因为我没有图像logohome_page_gr,所以我使用example-image-aexample-image-b来代替。

相关内容