我是 LaTeX 新手,正在为我的项目创建报告,问题是所有 PDF 中的字体并不等效,并且我插入了一个包含图表的 PDF 文件,但它没有出现在我输入 LaTeX 代码的位置,而是出现在另一个地方。
还有一件事,页面的边距太大,因此页面只能容纳少量信息,并且每行之间的换行线是两行而不是一行。
我该如何解决这些问题?
这是我的代码:
% !TEX TS-program = pdflatex
% !TEX encoding = UTF-8 Unicode
% This is a simple template for a LaTeX document using the "article" class.
% See "book", "report", "letter" for other types of document.
\documentclass[11pt,a4paper,oneside]{report}
\usepackage{fullpage}
\renewcommand{\baselinestretch}{2}
\author{Unknown}
\title{test}
\usepackage[utf8]{inputenc} % set input encoding (not needed with XeLaTeX)
\usepackage{graphicx} % support the \includegraphics command and options
% \usepackage[parfill]{parskip} % Activate to begin paragraphs with an empty line rather than an indent
\usepackage{amsmath}
\usepackage{float}
%%% PACKAGES
% \usepackage{booktabs} % for much better looking tables
\usepackage{array} % for better arrays (eg matrices) in maths
% \usepackage{paralist} % very flexible & customisable lists (eg. enumerate/itemize, etc.)
\usepackage{verbatim} % adds environment for commenting out blocks of text & for better verbatim
%\usepackage{subfig} % make it possible to include more than one captioned figure/table in a single float
% These packages are all incorporated in the memoir class to one degree or another...
\begin{document}
\maketitle
%\date{} % Activate to display a given date or no date (if empty),
% otherwise the current date is printed
\DeclareGraphicsExtensions{.pdf,.png,.jpg}
\section{Introduction}
8 lines of text in here
\section{Global Analysis}
here is some text before the image
\begin{figure}
\includegraphics[width=400px , height=300px]{ng.pdf}
\caption{image caption}
\end{figure}
\section{Local Analysis}
Here is some text, maybe 6 lines ...
答案1
图形旨在浮动到适合排版视图的位置。您可以通过添加选项来修复该位置
H
:\begin{figure}[H]
。这需要float
包,您已经在使用它了。不必要的线路扩展是由线路引起的
\renewcommand{\baselinestretch}{2}
,只需将其移除即可。关于边距,您可以使用
geometry
包,例如:\usepackage[a4paper,hmargin={1cm,2cm},vmargin={2cm,3cm}]{geometry}