博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Squeezing space in Latex
阅读量:2442 次
发布时间:2019-05-10

本文共 5588 字,大约阅读时间需要 18 分钟。

Here are some tips on how to squeeze a little more onto LaTeX pages. Note that these methods may adversely affect the appearance of the document, so use them with caution. Rephrasing and editing your text often leads to better results.

The  package executes many of these methods, packing as much text as possible onto each page.

Page Layout

The a4 package will give you narrower margins. To have more control use the  package. If you use the layout package then \layout will produce a test page showing the values of the variables that control page layout.

\newcommand{
\CLASSINPUTtoptextmargin}{
2cm}
\newcommand{\CLASSINPUTbottomtextmargin}{2cm}

Changing lengths

There are many variables in LaTeX determining lengths. Two commands to change them are 
\addtolength
 and 
\setlength
. The dimensions understood by LaTeX include 
cm
mm
in
 and 
pt
. Variables can be set to a negative value.

Example: \addtolength{\parindent}{-5mm}

Some useful variables are

  • Page Layout
    • \columnsep: gap between columns
    • \topmargin: gap above header
    • \topskip: between header and text
    • \textheight: height of main text
    • \textwidth: width of text
    • \oddsidemargin: odd page left margin
    • \evensidemargin : even page left margin
  • Paragraphs
    • \parindent: indentation of paragraphs
    • \parskip: gap between paragraphs
  • Floats (tables and figures)
    • \floatsep: space left between floats.
    • \textfloatsep: space between last top float or first bottom float and the text.
    • \intextsep : space left on top and bottom of an in-text float.
    • \dbltextfloatsep is \textfloatsep for 2 column output.
    • \dblfloatsep is \floatsep for 2 column output.
    • \abovecaptionskip: space above caption
    • \belowcaptionskip: space below caption
  • Maths
    • \abovedisplayskip: space before maths
    • \belowdisplayskip: space after maths
    • \arraycolsep: gap between columns of an array
  • Lists
    • \topsep: space between first item and preceding paragraph.
    • \partopsep: extra space added to \topsep when environment starts a new paragraph.
    • \itemsep: space between successive items.

Environments

The 
 package provides 
\BeforeBegin{environment}{code-to-execute}
\AfterEnd ...
 etc. These commands can be used to remove space around and within environments. This can be useful in situations where the environment resets values that over-ride those you've created. For example, 
\AfterBegin{itemize}{\addtolength{\itemsep}{-\baselineskip}}
 in a LaTeX file squeezes items together by resetting 
\itemsep
 inside the environment.

The mdwlist package has a itemize* environment.

The  package offers a compactitem environment (that puts less space between items) and an inparaenum environment (that doesn't create new paragraphs for each item).

Figures and Tables

To save space, you can put more than one graphic inside a figure environment by using the 
subfigure
 package. It's also possible to wrap text around a figure using the 
 package.

Using "\begin{figure} ... \centering ..." rather than "\begin{figure} ... \begin{center} ..." saves space. Sometimes excessive white space around a figure isn't LaTeX's fault. It may be that a postscript figure contains a big white border. ps2epsi can be used to produce a minimal bounding box, or you can use the clipping feature of the \includegraphics command of the graphicx package.

By default, LaTeX doesn't like to fill more than 0.7 of a text page with tables and graphics, nor does it like too many figures per page. This behaviour can be changed by placing lines like the following before \begin{document}

\renewcommand\floatpagefraction{.9}\renewcommand\topfraction{.9}\renewcommand\bottomfraction{.9}\renewcommand\textfraction{.1}   \setcounter{totalnumber}{50}\setcounter{topnumber}{50}\setcounter{bottomnumber}{50}
To reduce the size of captions use the 
 package.

If you have a big table you might wish to bracket it by \begin{small} ... \end{small}.

You can reduce the gap between table columns by using \setlength{\tabcolsep}{1pt}. It may also be possible to scale a whole table as you can a piece of graphics, using \resizebox{!}{5cm}{\begin{tabular} ... \end{tabular}} though you need to view the output as postscript.

Headings

Vertical space around a heading depends on 
\parskip
\baselineskip
 and other parameters that LaTeX sends to the 
@startsection
 routine. Remember also that LaTeX doesn't like putting a heading right at the bottom of a page - it would rather leave space.

Unless you want to redefine the sectioning commands yourself, it's worth looking at the  package, which offers space-saving alternatives to the standard sectioning commands (especially \chapter). Even just \usepackage[small,compact]{titlesec}might save you quite a lot.

Contents and bibliography

The 
 package lets you have a two column table of contents in a single column document.

To reduce the linespacing in a bibliography (the same idea works for contents pages) use the setspace package

\begin{spacing}{0.9}\tableofcontents\end{spacing}...\begin{spacing}{0.9}\bibliographystyle{plain}\bibliography{refs}\end{spacing}
If you're using the 
natbib
 package (recommended) then you can change the value of 
\bibsep
 to control the gap between items. Otherwise put the following (suggested by Axel Reichert) in the preamble
\let\oldthebibliography=\thebibliography  \let\endoldthebibliography=\endthebibliography  \renewenvironment{thebibliography}[1]{%    \begin{oldthebibliography}{#1}%      \setlength{\parskip}{0ex}%      \setlength{\itemsep}{0ex}%  }%  {%    \end{oldthebibliography}%  }

You can use the same idea to modify other environments - theglossary, etc.

A dirty trick

\hspace*{-4cm} before anything. But it seems not work well with two-column format.

转载地址:http://kxiqb.baihongyu.com/

你可能感兴趣的文章
angular4前后端分离_如何在Angular 4+中使用Apollo客户端GraphQL
查看>>
如何在Ubuntu 18.04上安装Apache Kafka
查看>>
如何在Ubuntu 20.04上安装R [快速入门]
查看>>
debian tomcat_如何在Debian 10上安装Apache Tomcat 9
查看>>
如何为Python 3设置Jupyter Notebook
查看>>
docker 容器共享数据_如何在Docker容器之间共享数据
查看>>
express中间件_创建自己的Express.js中间件
查看>>
如何在Ubuntu 18.04上使用Docker和Caddy远程访问GUI应用程序
查看>>
Apache配置错误AH00558:无法可靠地确定服务器的标准域名
查看>>
apache 证书配置_Apache配置错误AH02572:无法配置至少一个证书和密钥
查看>>
web设置字体粗细css_Web上使用CSS的可变字体
查看>>
css 垂直对齐_CSS垂直对齐属性
查看>>
为您的网站提供动力的100种Jamstack工具,API和服务
查看>>
api restful_构建RESTful API的13种最佳实践
查看>>
wordpress用途_8个热门WordPress多用途主题及其炫酷功能
查看>>
用于Angular,React和Vue.js的Bootstrap UI库
查看>>
使用MongoDB Stitch在10分钟内构建一个Slack应用
查看>>
struts2 css失效_CSS体系结构和可维护CSS的三大Struts
查看>>
php使用nginx建网站_如何使用预建网站来刷新网站的外观
查看>>
使用React和PHP开发游戏:它们的兼容性如何?
查看>>