编译后文档不成立

编译后文档不成立

我目前正在写一份报告,但不知何故,在我编译报告后,文本似乎没有对齐。我以为 LaTex 默认就是这样的。

下面是我的代码

\documentclass[12pt,a4paper,oneside]{report}

%%Label Equations According To Chapter
\usepackage{amsmath}
\numberwithin{equation}{chapter}

%% Enables Sub Sub Sections to be Numbered
\setcounter{secnumdepth}{3}

%% Format Header and Footer
\usepackage{fancyhdr}

%% Used to Insert Graphics
\usepackage{graphicx}
\usepackage{setspace}

%% Used to Convert EPS images to PDF
\usepackage{epstopdf}

%% Paragraph Formatting
\usepackage{parskip}

%% Used to Insert Blocks of Code
\usepackage{listings}

%% Used for Tables
\usepackage{tabularx}

% Use Numbers Libary for numbering
\usepackage{enumerate}
%\renewcommand{\labelenumi}{\arabic{enumi}. }

%% Used to Insert SI Units
\usepackage{siunitx}
\raggedright

%% Hyperlinks Formatting
\usepackage{hyperref}
\hypersetup{
    colorlinks,
    citecolor=black,
    filecolor=black,
    linkcolor=black,
    urlcolor=black
}

%% Referencing Library
\usepackage{natbib}

%% Include Graphics from Multiple Folders
\graphicspath{{title_page/img/},{6_state_estimation/img/},{2_cannon_subsystem/img/}}

\newcommand{\HRule}{\rule{\linewidth}{0.5mm}}
%\setlength{\parskip}{10pt}

%New Command: Diagram Scale - % of textwidth
\newcommand{\imgscale}{0.9\textwidth}

\begin{document}
\setkeys{Gin}{draft}

\input{title_page/title_page_prelim}
\pagestyle{fancy}

%% Header and Footer Setup
\fancyhead[L]{\slshape \leftmark}
\fancyhead[R]{\thepage}
\fancyfoot{}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
\setlength{\headheight}{14.5pt}
\setlength{\parindent}{0in}

\pagenumbering{roman}

\input{0_preamble/disclaimer}
\input{0_preamble/acknowledgements}

\onehalfspacing
\setcounter{tocdepth}{2}
\tableofcontents
\addcontentsline{toc}{chapter}{Contents}
\listoffigures
\addcontentsline{toc}{section}{List of Figures}
\listoftables
\addcontentsline{toc}{section}{List of Tables}
\clearpage
\pagenumbering{arabic}

\input{1_introduction/1_project_definition_and_goals}

\input{2_cannon_subsystem/2_literature_review}
\input{2_cannon_subsystem/2_preliminary_design}
\input{2_cannon_subsystem/2_detailed_design}
\input{2_cannon_subsystem/2_literature_review}

\input{6_state_estimation/state_estimation}

\renewcommand\bibname{References}
%\bibliographystyle{plainnat}
\bibliographystyle{custom_harvard}
\bibliography{prelim_ref}
\addcontentsline{toc}{chapter}{References}

\end{document}

生成的 PDF 可以在以下位置找到:报告 PDF 结果

任何帮助都将受到赞赏。

答案1

尝试删除该线\raggedright

(“右边对齐” 是指在 LaTeX 中如何获得左对齐的文本。还有一个\raggedleft用于右对齐的文本。)

编辑:如果您只想让文档的一部分左对齐,请确保\raggedright将其放在一对括号内。否则会毁掉整个文档!例如,要让免责声明页面左对齐,请使用:

{
\raggedright
\input{0_preamble/disclaimer}
\par % This ends the paragraph properly. See egreg's comment below.
}

相关内容