Text, style, and grammar, fonts, figures, spacing, presentations, and other

Text, style, and grammar

Grammar check

Try Queequeg

Prevent hyphenation at once


Using limit-mode in summation

Force limits to place at above and below (useful for inline equation):


Equal by Definition

i^2 \stackrel{\mathrm{def}}{=} -1

Self-defined function in equation mode

To make foo appears like \sin or \exp, use


or to save space, define the following in preamble:


Modifying counters

Counters available: part, chapter, section, subsection, subsubsection, paragraph, subparagraph, figure, table, equation, enumi, enumii, enumiii, enumiv, footnote, mpfootnote

Setting counter value:


Setting style:


Font size

To adjust font size by “zooming”, use this:


Normal size - \scalefont{2}Linear double - \scalefont{0.5} Normal -
\scalefont{1.414}Double size (area) - \scalefont{0.707} Normal

{\scalefont{2}Double size} - Normal again

If the scaling is in terms of “levels”, use this:


Normal size - \relsize{1}Linear double - \relsize{-1} Normal -
\relsize{2}Double size (area) - \relsize{-2} Normal

{\relsize{1}Double size} - Normal again

Complicated Matrix

For creating matrix (in math mode) but with part of the stuff outside the bracket, there are several ways to do. First one is to use Knuth’s \bordermatrix macro, like this one (copy from Cambridge’s web)

            b_1 & 1.2  & 3.3  & 5.1  & 2.8  \cr
            c_1 & 4.7  & 7.8  & 2.4  & 1.9  \cr
            ... & ...  & ...  & ...  & ...  \cr
            z_1 & 8.0  & 9.9  & 0.9  & 9.99  \cr}

The above will have the matrix with only the number and those letters on the top and left outside the matrix. If you want not the topmost row and leftmost column outside the bracket, you can use \bordermatrix*,

            1.2  & 3.3  & 5.1  & 2.8  & b_1 \cr
            4.7  & 7.8  & 2.4  & 1.9  & c_1 \cr
            ...  & ...  & ...  & ...  & ... \cr
            8.0  & 9.9  & 0.9  & 9.99 & z_1 \cr
            a_1  & a_2  & ...  & a_n  &     \cr}

which, in turn, show the rightmost column and the bottom row outside the bracket.

However, if you want a LaTeX version instead of plain TeX, one may use K. Border’s kbordermatrix package. The documentation is here.

Furthermore, if you want to show the matrix/determinant operations (i.e. the arrows showing which row is multiplied by what and add to which row, etc.), you may found the gauss.sty package useful.

Collection of math mode tricks

See the documentation of mathmode, written by Herbert Voss with 130+ pages. Very detail and contains almost everything you need for typesetting equations.


Beautiful CM Fonts

To use a much better CM font for LaTeX, get cm-super package (optionally for X11: cm-super-x11) in Debian. The add the lines in your LaTeX document preamble:


Then your output would include no bitmap CM fonts.

Times font for everything

The times package can only make you have times font for main text but not for equations. To make everything including equation to use times font, call this:


The second line make the big symbols like summation to use computer modern font instead of times which is bigger and look nicer.

Package bm for Bold Greek

For getting a bold Greek letter, \mathbf{\alpha} doesn’t work. We have to put


in the preamble and use $\bm{\alpha}$ in math mode.

mathcal style

Sometimes, we may use \mathcal or \cal in LaTeX for a calligraphic font. However, what is happening may not be what you expected.

In normal case, the calligraphic font would be the one in cmsy.pfb

If you are using mathptmx package, the font will be a script font.

If you loaded with eucal package, the font will be the “Euler Script” font, which looks like an upright version of cmsy.pfb.

So if you are using mathptmx package, but want to get back the old script font (which is bold and easier to read), then issue the following command in the peamble:



Side-by-side figures

Make two figures side-by-side, use this:

\caption{(a) elastic and (b) inelastic utility vs $\alpha$ with $\rho$=0.95}

Alternative way: using minipage

        \epsfig{file=figure1.eps, scale=0.5}
        \caption{figure 1}
        \epsfig{file=figure2.eps, scale=0.5}
        \caption{figure 2}

Yet another way: using subfigure package

        \subfigure[Honda]{\scalebox{0.3}{\input{prelude.pstex_t}}} \quad
        \subfigure[Toyota]{\scalebox{0.3}{\input{celica.pstex_t}}} \quad
     \caption{I like these!}

Four figures in a square

      \subfigure[Honda]{\scalebox{0.3}{\input{prelude.pstex_t}}} \quad
      \subfigure[Nissan]{\scalebox{0.3}{\input{Fairlady.pstex_t}}} \quad
    \caption{I like these!}


Setting paper margin


Alternative method (specifying paper size and print region only)


Line spacing


Reduce space around captions

Remove the extra space between figure and captions, as well as the space between two adjacent figure blocks:


Removing large margins at print by pstops

If you got a doc with A5 content centered at an A4 paper, use this for two-pages-on-one-sheet:

pstops -pa4 '2:0L@1(25.35cm,-3.075cm)+1L@1(25.35cm,11.775cm)' onepage.ps twopages.ps

If it is in Springer LNCS format, use this:

pstops -pa4 '2:0L@1(26.6cm,-3.075cm)+1L@1(26.6cm,11.775cm)' onepage.ps twopages.ps

But sometimes, it is a bit larger than A5, the following is what I will use (I got this by trial and error):

pstops -pa4 '2:0L@.87(24cm,-1.5cm)+1L@.87(24cm,13.35cm)' onepage.ps twopages.ps



Using BibTeX. Put these at the end of the document:


then run LaTeX by:

$ latex document        # To generate *.aux
$ bibtex document       # Base on *.aux to generate *.bbl
$ latex document        # Learn about the existence of *.bbl
$ latex document        # Regenerate the document

then you will have to dvi file

Presentation using seminar class

Template for “seminar” slides:

        \item Here
       \item There


Fancy headers

Look for the fancy header package


Single column ACM SIG Proceedings

My way to make a double column style template use for single column mode is use the following prologue:

%Remove ACM copyright notice at the lower left corner
%Make the ACM template into single column
\renewcommand{\twocolumn}[1][1]{\onecolumn #1}

Modifying section headers (as well as others)

For example, section numbers should be in romans instead of arab:


also like this:


see http://www.iam.ubc.ca/~newbury/tex/numbering.html for more

Acknowledgment as footnotes

You may want footnotes without numbers or symbols. Here is the way:


Remember to enclose the definition block with \makeatletter and \makeatother. Source: http://help-csli.stanford.edu/tex/latex-footnotes.shtml

Tabular with different justifications

Do in this way:

ROW 1 & left justified   
ROW 2 & \makebox[3cm]{centered}   
ROW 3 & \makebox[3cm][r]{right justified}   

more tablar tricks from http://amath.colorado.edu/documentation/LaTeX/reference/tables/ex3.html and http://www.msu.edu/user/harris41/latex_tablespacing.html and http://www.comp.leeds.ac.uk/andyr/misc/latex/latextutorial4.html


Make a box of text in paragraph mode as a “character” in a line:

\parbox[b]{3cm}{blah blah blah}

where b is for bottom-aligned (choice: c, t) and 3cm is the width. Similar function can be achieved by minipage:

blah blah blah

If you want framed version, enclose them with \fbox{...}

Beautify tables

Use the booktab package by Simon Fear. The way to make tables beautify (and look professional) is to use as little decoration as possible, e.g. don’t use vertical lines. The table elements shall have their own common region and aligned to make it sound like a table. This is what we called the Gestalt Principle: things that are seen as forming a known shape are seen as being together.

Spliting PostScript

Enlarging an A4 document into A3 size, with two sheets of A4 output make up one page of A3:

# psresize -pa3 -Pa4 a4document.ps a3.ps
# pstops -pa4 '1:0@1L(42cm,0)' a3.ps a4-upper.ps
# pstops -pa4 '1:0@1L(21cm,0)' a3.ps a4-lower.ps

In the above, (42cm,0) means to shift the sheet left 42cm and up 0cm. It is required because you rotated the sheet left a right angle (origin is on the lower left corner). Hence I move the pictures to fit it into an A4 sheet.

If your printer cannot create zero-margin, you may need to change the shift amount to cover those lost margin.

Packages to note