META TOPICPARENT |
name="EmpiricalAlgorithmics" |
LaTeX tips and tricks
This page is part of the EmpiricalAlgorithmics web.
Space squeezing
%% add a line to a page
\enlargethispage{\baselineskip}
%% keep figures from going onto a page by themselves
\renewcommand{\topfraction}{0.9}
\renewcommand{\textfraction}{0.07}
\renewcommand{\floatpagefraction}{0.9}
\renewcommand{\dbltopfraction}{0.9} % for double-column styles
\renewcommand{\dblfloatpagefraction}{0.7} % for double-column styles
% other figure trickery
\floatsep: space left between floats (12.0pt plus 2.0pt minus 2.0pt)
\textfloatsep: space between last top float or first bottom float and the text (20.0pt plus 2.0pt minus 4.0pt)
\intextsep : space left on top and bottom of an in-text float (12.0pt plus 2.0pt minus 2.0pt)
\dbltextfloatsep is \textfloatsep for 2 column output (20.0pt plus 2.0pt minus 4.0pt).
\dblfloatsep is \floatsep for 2 column output (12.0pt plus 2.0pt minus 2.0pt).
\abovecaptionskip: space above caption (10.0pt).
\belowcaptionskip: space below caption (0.0pt).
%% make lists small
\newcommand{\denselist}{\itemsep 0pt\topsep-6pt\partopsep-6pt}
%% make section headings take up less space ("medium" can be replaced by "tiny", "small" or "big"--tiny is the normal font)
\usepackage[medium,compact]{titlesec}
%% an alternative, which might look better and is more adjustable
%% the negative number in beforeskip means that the indent in the following paragraph is suppressed
%% a negative afterskip means that there's no linebreak after the heading
\makeatletter
\renewcommand\section{\@startsection
{section}{1}{0mm}%name, level, indent
{-2.5ex \@plus -1ex \@minus -.2ex}% beforeskip
{1ex \@plus.2ex}% afterskip
{\normalfont\large\bfseries}}% style
\renewcommand\subsection{\@startsection
{subsection}{2}{0mm}%name, level, indent
{-2.25ex\@plus -1ex \@minus -.2ex}%beforeskip
{.8ex \@plus .2ex}%afterskip
{\normalfont\normalsize\bfseries}}% style
\makeatother
%% a trick that makes the title take up less space for many style files (but not article)
\addtolength{\titlebox}{-1.8cm}
%% for article, and maybe other styles, to make the title take up less space you can add negative
%% vspace directly to the title, author and date commands. Here's one configuration that worked for me:
\title{\vspace{-2.5em} title...}
\author{\vspace{-.5em} author...}
\date{\vspace{-1.25em}}
%% print a diagram showing the names of all constants related to margins etc.
\usepackage{layout}
\layout
%% make a paragraph one line shorter without deleting any words! Put the following at the beginning, the wrap the paragraph in {}
\looseness=-1
%% make the whole document shorter--this one is very powerful. Experiment with the number; 0.97 will do a lot and looks OK
\renewcommand{\baselinestretch}{0.97}
% To densify sections
\let\oldsection=\section
\renewcommand{\section}[1]{%
\vspace{-.5em}\oldsection{#1}\vspace{-.25em}%
}%
\let\oldsubsection=\subsection
\renewcommand{\subsection}[1]{%
\vspace{-.5em}\oldsubsection{#1}\vspace{-.25em}%
}%
% To squeeze space in the bibliography:
\let\oldthebibliography=\thebibliography
\let\endoldthebibliography=\endthebibliography
\renewenvironment{thebibliography}[1]{%
\begin{oldthebibliography}{#1}%
\setlength{\parskip}{0ex}%
\setlength{\itemsep}{0ex}%
}%
{%
\end{oldthebibliography}%
}
%% densify spacing in bibliographies
\newcommand{\bibfix}{% PUT \bibfix in file.bbl after first line
\setlength{\parsep}{\parskip}%
\setlength{\itemsep}{0cm}%
\setlength{\topsep}{\parskip}%
\setlength{\parskip}{0cm}%
\setlength{\partopsep}{0cm}%
\setlength{\listparindent}{\parindent}%
\setlength{\labelwidth}{10pt}%
\setlength{\labelsep}{0pt}%
\setlength{\leftskip}{0pt}%
\setlength{\leftmargin}{0pt}%
}
%% change margins
% the best way:
\usepackage[margin=1in]{geometry}
%old-school:
\setlength{\textwidth}{7in}
\setlength{\textheight}{8.75in}
\setlength{\oddsidemargin}{-0.25in}
\setlength{\evensidemargin}{-0.25in}
\setlength{\headsep}{10pt}
%% make vertical rubber space
\vfill % this makes a pre-defined amount of rubber space. It's equivalent to \vspace\fill
\vskip 10pt % this makes a fixed amount. It's a TeX command, so no curly braces.
Fonts and symbols
Find that latex symbol by drawing it.
% compact font that is good for tables; can also use {9pt}{8pt} depending on style file
\fontfamily{cmss}\fontseries{uc}
\fontsize{10pt}{9pt}
\selectfont
% relative font sizes
\usepackage{relsize}
{\smaller ... }
% another option, allows nonstandard sizes
\usepackage{scalefont}
{\scalefont{1.2} ... }
%% get an actual tilde (~) in latex without resorting to $\sim$:
\textasciitilde
%% lowercase script letters
\DeclareFontFamily{OT1}{pzc}{}
\DeclareFontShape{OT1}{pzc}{m}{it}{<-> s * [1.200] pzcmi7t}{}
\DeclareMathAlphabet{\mathscr}{OT1}{pzc}{m}{it}
%% superimpose one symbol on another to make a new symbol
%% the arguments are x and y alignment, in em (pos or neg)
%% here I superimpose a square with a capital V and a small v
%% largesquare comes from the mnsymbol package; boxempty comes from stmaryrd
\usepackage{slashed}
\usepackage{mnsymbol}
\usepackage{stmaryrd}
\declareslashed{}{\largesquare}{-.01}{0.005}{V}
\declareslashed{}{\boxempty}{.06}{-.04}{\mathscr{v}}
\newcommand{\boxV}{\slashed{V}}
\newcommand{\boxv}{\slashed{\mathscr{v}}}
% get an inline equation to be displayed like an {equation} (e.g., subscripts under \sum)
$\displaystyle \sum_i x^i$
% the alternative, to get a displaymath equation to display like an inline one (perhaps to save space):
\[\textstyle \sum_i x^i\]
Footnotes
% repeat the same footnote multiple times
one\footnotemark[\arabic{footnote}]
two\footnotemark[\arabic{footnote}]
\footnotetext{Whatever}
% another way of doing the same thing, which creates different-numbered footnotes if there's a page break
\usepackage{fixfoot}
\DeclareFixedFootnote{\whatever}{Whatever.}
one\whatever
two\whatever
% Make footnotes one-per-page
\usepackage{perpage}
\MakePerPage{footnote}
% number footnotes with symbols
\makeatletter
\def\@makefnmark{\@textsuperscript{\normalfont\fnsymbol{footnote}}}%
\makeatother
% symbol footnotes with a special command that can be interspersed with other footnotes
% use: \symbolfootnote[1]{footnote} to get an *, 2 = dagger, 3=ddag; etc. 0 is unnumbered footnote.
\long\def\symbolfootnote[#1]#2{\begingroup\def\thefootnote{\fnsymbol{footnote}}\footnote[#1]{#2}\endgroup}
Tables |