![为什么几何包弄乱了我的边距?](https://linux22.com/image/420717/%E4%B8%BA%E4%BB%80%E4%B9%88%E5%87%A0%E4%BD%95%E5%8C%85%E5%BC%84%E4%B9%B1%E4%BA%86%E6%88%91%E7%9A%84%E8%BE%B9%E8%B7%9D%EF%BC%9F.png)
我想编写一份尽可能利用页面空间的文档。我使用的代码如下(免责声明:我取自这里):
\documentclass[12pt, oneside, a4paper]{memoir}
\usepackage{layout}
\usepackage{showframe}
%\usepackage[a4paper]{geometry}
\usepackage{amssymb, amsfonts, amsthm}
\newtheorem{problem}{Problem}
\begin{document}
\title{Sample Document}
\author{John Doe}
\maketitle
\layout{}
Here is some sample text to show you what LaTeX does.
To start a new paragraph, you need to leave a line of white space in your tex file.
To include math, you have two options. The first is called ``in line,'' and you do this by putting your math between two dollar signs (\$). For example, Fermat's Little Theorem tells us that if $p$ is a prime and $a$ is an integer such that $p \nmid a$, then $a^{p-1} \equiv 1 \pmod{p}$. Note that the exponent on $a$ has to go in braces (in the tex file).
But if you really want an equation (or congruence) to stand out, then you ``display'' the math. It looks like this:
\[
a^{p-1} \equiv 1 \pmod{p}.
\]
Nice, right?
Finally, we can make things look really nice for homeworks as follows:
\begin{problem}
Let $X$ and $Y$ be blah blah blah \ldots
\end{problem}
\begin{problem}
Let $X$ and $Y$ be as in the previous problem. What is $Z$?
\end{problem}
Notice that LaTeX automatically numbers the problems for us.
\end{document}
然而,一旦我取消注释调用几何包的行,边距就会变得混乱,尽管我甚至没有发出任何命令来改变它们。
我尝试查看一些资料,但他们没有提到发生这样的事情,所以我想了解为什么几何形状会如此表现。
此外,如果可能的话,请帮助正确获取代码,以尽可能减少未使用的纸张空间。
答案1
memoir
有自己的定义页面布局的方法,最好不要使用geometry
它。下面的 MWE 通过减少边距来增加文本块的大小。
% memgeomprob.tex SE 562072
\documentclass[12pt, oneside, a4paper]{memoir}
\setlrmarginsandblock{0.8in}{*}{1.0} % set left/right margins to 0.8in
\setulmarginsandblock{1in}{*}{1.0} % set upper/lower margins to 1in
\checkandfixthelayout
\usepackage{layout}
\usepackage{showframe}
%\usepackage[a4paper]{geometry}
%\usepackage{geometry}
\usepackage{amssymb, amsfonts, amsthm}
\newtheorem{problem}{Problem}
\begin{document}
\title{Sample Document}
\author{John Doe}
\maketitle
\layout{}
Here is some sample text to show you what LaTeX does.
To start a new paragraph, you need to leave a line of white space in your tex file.
To include math, you have two options. The first is called ``in line,'' and you do this by putting your math between two dollar signs (\$). For example, Fermat's Little Theorem tells us that if $p$ is a prime and $a$ is an integer such that $p \nmid a$, then $a^{p-1} \equiv 1 \pmod{p}$. Note that the exponent on $a$ has to go in braces (in the tex file).
But if you really want an equation (or congruence) to stand out, then you ``display'' the math. It looks like this:
\[
a^{p-1} \equiv 1 \pmod{p}.
\]
Nice, right?
Finally, we can make things look really nice for homeworks as follows:
\begin{problem}
Let $X$ and $Y$ be blah blah blah \ldots
\end{problem}
\begin{problem}
Let $X$ and $Y$ be as in the previous problem. What is $Z$?
\end{problem}
Notice that LaTeX automatically numbers the problems for us.
\end{document}
阅读手册(> texdoc memoir
)以了解更多信息。