Difference: LaTeX (1 vs. 12)

Revision 122009-12-09 - hkazemi

Line: 1 to 1
 
META TOPICPARENT name="ResearchTips"
The page that used to live here has moved to https://bugs.cs.ubc.ca/cgi-bin/twiki/view/BETA/LaTeX

Revision 112007-09-27 - KevinLeytonBrown

Line: 1 to 1
 
META TOPICPARENT name="ResearchTips"
Changed:
<
<
Tips and Tricks for LaTeX, mostly concerned with squeezing space!

Space squeezing

%% keep figures from going onto a page by themselves 
\renewcommand{\topfraction}{0.85}
\renewcommand{\textfraction}{0.1}
\renewcommand{\floatpagefraction}{0.75}

%% 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}

%% 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}


%% 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
\setlength{\textwidth}{7in}
\setlength{\textheight}{8.75in}
\setlength{\oddsidemargin}{-0.25in}
\setlength{\evensidemargin}{-0.25in}
\setlength{\headsep}{10pt}

%% get an actual tilde (~) in latex without resorting to $\sim$:
\textasciitilde

%% 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.

% compact font that is good for tables; can also use {9pt}{8pt} depending on style file
\fontfamily{cmss}\fontseries{uc}
\fontsize{10pt}{9pt}
\selectfont

% Sometimes the footnotes don't appear at the bottom of the page. Than you have to use 
\usepackage[bottom]{footmisc}

Spacing displays

  • Spacing in displays. Usually it's best to leave the spacing up to TeX. However, if explicit horizontal spacing is needed (for example, to set an expression like (n \to \infty) apart from the rest of the display, or to separate two equations on the same line), \quad in most cases generates the right amount of space. Don't try to create spacing with a bunch of explicit spaces ("\ "); the spacing generated in this way is usually not optimal, and the explicit spaces will likely have to be removed (and possibly replaced by \quad) when the paper is typeset at the publisher's end.
  • Avoid blank lines before or after a display, unless you really want to start a new paragraph: It is tempting to surround displayed math material by blank lines in the source file, to make them stand out and easier to locate. However, this is usually wrong, since blank lines are interpreted as paragraph breaks, may generate some additional vertical spacing and cause the next line of text to be indented - something you usually don't want. If you want to set off displays in your source file, do so by inserting a line with comment symbols, such as %%%%% equation 3.1 %%%%%%%%%%%%%% before and/or after the display.
  • Correcting underful vboxes and bad page breaks. By default, TeX does not break pages inside display environments such as align. If a paper has many multiline formulas, this may cause "underful vboxes", which can look very poor if the badness (reported by tex in the log file) is a few thousand. One way to remedy this is to put the command \allowdisplaybreaks in the preamble. However, this may cause some poor pagebreaks which may have to be fixed. A compromise solution is to use \allowdisplaybreaks locally, on the individual displays that cause problems: {\allowdisplaybreaks \begin{align} ... \end{align} }. The best solution is to prevent this problem by avoiding excessively long displays (say, with five or more lines). It is often not hard to break up a very long display into two, for example by inserting a phrase like "By the Cauchy-Schwarz inequality, the last expression is at most" in the middle of the overlong display, followed by the remaining lines of the display.
  • Multiline subscripts on sums or integrals. Use the \substack{...} command, which works much like the \sb ... \endsb pair in amstex. It is much easier to use, and produces better looking output than an array environment or a construct using \atop (derived from plain tex).

Useful links

>
>
The page that used to live here has moved to https://bugs.cs.ubc.ca/cgi-bin/twiki/view/BETA/LaTeX
  -- Main.kevinlb - 13 Apr 2005

Revision 102007-05-10 - KevinLeytonBrown

Line: 1 to 1
 
META TOPICPARENT name="ResearchTips"
Tips and Tricks for LaTeX, mostly concerned with squeezing space!
Line: 13 to 13
 %% make lists small \newcommand{\denselist}{\itemsep 0pt\topsep-6pt\partopsep-6pt}
Changed:
<
<
%% make section headings take up less space ("medium" can be replaced by "small" or "big")
>
>
%% 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}

%% a trick that makes the title take up less space for many style files (but not article)

Line: 69 to 69
 \fontsize{10pt}{9pt} \selectfont
Added:
>
>
% Sometimes the footnotes don't appear at the bottom of the page. Than you have to use \usepackage[bottom]{footmisc}
 

Spacing displays

Revision 92007-04-22 - KevinLeytonBrown

Line: 1 to 1
 
META TOPICPARENT name="ResearchTips"
Tips and Tricks for LaTeX, mostly concerned with squeezing space!
Line: 64 to 64
 \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.
Added:
>
>
% compact font that is good for tables; can also use {9pt}{8pt} depending on style file \fontfamily{cmss}\fontseries{uc} \fontsize{10pt}{9pt} \selectfont
 

Spacing displays

Revision 82006-11-18 - KevinLeytonBrown

Line: 1 to 1
 
META TOPICPARENT name="ResearchTips"
Changed:
<
<

Tips and Tricks for LaTeX, mostly concerned with squeezing space!

>
>
Tips and Tricks for LaTeX, mostly concerned with squeezing space!

Space squeezing

 
%% keep figures from going onto a page by themselves 

Line: 57 to 59
  %% get an actual tilde (~) in latex without resorting to $\sim$: \textasciitilde
Deleted:
<
<
  %% 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.
Changed:
<
<
Useful links:
>
>

Spacing displays

  • Spacing in displays. Usually it's best to leave the spacing up to TeX. However, if explicit horizontal spacing is needed (for example, to set an expression like (n \to \infty) apart from the rest of the display, or to separate two equations on the same line), \quad in most cases generates the right amount of space. Don't try to create spacing with a bunch of explicit spaces ("\ "); the spacing generated in this way is usually not optimal, and the explicit spaces will likely have to be removed (and possibly replaced by \quad) when the paper is typeset at the publisher's end.
  • Avoid blank lines before or after a display, unless you really want to start a new paragraph: It is tempting to surround displayed math material by blank lines in the source file, to make them stand out and easier to locate. However, this is usually wrong, since blank lines are interpreted as paragraph breaks, may generate some additional vertical spacing and cause the next line of text to be indented - something you usually don't want. If you want to set off displays in your source file, do so by inserting a line with comment symbols, such as %%%%% equation 3.1 %%%%%%%%%%%%%% before and/or after the display.
  • Correcting underful vboxes and bad page breaks. By default, TeX does not break pages inside display environments such as align. If a paper has many multiline formulas, this may cause "underful vboxes", which can look very poor if the badness (reported by tex in the log file) is a few thousand. One way to remedy this is to put the command \allowdisplaybreaks in the preamble. However, this may cause some poor pagebreaks which may have to be fixed. A compromise solution is to use \allowdisplaybreaks locally, on the individual displays that cause problems: {\allowdisplaybreaks \begin{align} ... \end{align} }. The best solution is to prevent this problem by avoiding excessively long displays (say, with five or more lines). It is often not hard to break up a very long display into two, for example by inserting a phrase like "By the Cauchy-Schwarz inequality, the last expression is at most" in the middle of the overlong display, followed by the remaining lines of the display.
  • Multiline subscripts on sums or integrals. Use the \substack{...} command, which works much like the \sb ... \endsb pair in amstex. It is much easier to use, and produces better looking output than an array environment or a construct using \atop (derived from plain tex).

Useful links

 

Revision 72006-10-25 - KevinLeytonBrown

Line: 1 to 1
 
META TOPICPARENT name="ResearchTips"

Tips and Tricks for LaTeX, mostly concerned with squeezing space!

Line: 17 to 17
 %% a trick that makes the title take up less space for many style files (but not article) \addtolength{\titlebox}{-1.8cm}
Added:
>
>
%% 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

Revision 62006-07-03 - KevinLeytonBrown

Line: 1 to 1
 
META TOPICPARENT name="ResearchTips"

Tips and Tricks for LaTeX, mostly concerned with squeezing space!

Line: 53 to 53
 \textasciitilde
Added:
>
>
%% 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.
 Useful links:

Revision 52006-02-22 - KevinLeytonBrown

Line: 1 to 1
 
META TOPICPARENT name="ResearchTips"

Tips and Tricks for LaTeX, mostly concerned with squeezing space!

Line: 24 to 24
 %% make a paragraph one line shorter without deleting any words! Put the following at the beginning, the wrap the paragraph in {} \looseness=-1
Added:
>
>
%% 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}
 %% densify spacing in bibliographies \newcommand{\bibfix}{% PUT \bibfix in file.bbl after first line \setlength{\parsep}{\parskip}%

Revision 42006-02-22 - KevinLeytonBrown

Line: 1 to 1
 
META TOPICPARENT name="ResearchTips"

Tips and Tricks for LaTeX, mostly concerned with squeezing space!

Line: 21 to 21
 \usepackage{layout} \layout
Added:
>
>
%% make a paragraph one line shorter without deleting any words! Put the following at the beginning, the wrap the paragraph in {} \looseness=-1
 %% densify spacing in bibliographies \newcommand{\bibfix}{% PUT \bibfix in file.bbl after first line \setlength{\parsep}{\parskip}%

Revision 32005-09-19 - KevinLeytonBrown

Line: 1 to 1
 
META TOPICPARENT name="ResearchTips"

Tips and Tricks for LaTeX, mostly concerned with squeezing space!

Line: 42 to 42
 \setlength{\evensidemargin}{-0.25in} \setlength{\headsep}{10pt}
Added:
>
>
%% get an actual tilde (~) in latex without resorting to $\sim$: \textasciitilde
 

Useful links:

Revision 22005-05-02 - KevinLeytonBrown

Line: 1 to 1
 
META TOPICPARENT name="ResearchTips"
Changed:
<
<

Tips and Tricks for LaTeX!

>
>

Tips and Tricks for LaTeX, mostly concerned with squeezing space!

 
%% keep figures from going onto a page by themselves 

Line: 17 to 17
 %% a trick that makes the title take up less space for many style files (but not article) \addtolength{\titlebox}{-1.8cm}
Added:
>
>
%% print a diagram showing the names of all constants related to margins etc. \usepackage{layout} \layout
 %% densify spacing in bibliographies \newcommand{\bibfix}{% PUT \bibfix in file.bbl after first line \setlength{\parsep}{\parskip}%

Revision 12005-04-13 - KevinLeytonBrown

Line: 1 to 1
Added:
>
>
META TOPICPARENT name="ResearchTips"

Tips and Tricks for LaTeX!

%% keep figures from going onto a page by themselves 
\renewcommand{\topfraction}{0.85}
\renewcommand{\textfraction}{0.1}
\renewcommand{\floatpagefraction}{0.75}

%% make lists small
\newcommand{\denselist}{\itemsep 0pt\topsep-6pt\partopsep-6pt}

%% make section headings take up less space ("medium" can be replaced by "small" or "big")
\usepackage[medium,compact]{titlesec}

%% a trick that makes the title take up less space for many style files (but not article)
\addtolength{\titlebox}{-1.8cm}

%% 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
\setlength{\textwidth}{7in}
\setlength{\textheight}{8.75in}
\setlength{\oddsidemargin}{-0.25in}
\setlength{\evensidemargin}{-0.25in}
\setlength{\headsep}{10pt}

Useful links:

-- Main.kevinlb - 13 Apr 2005

 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2025 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback