You are here:

Making LaTeX Figures with Custom Cell Borders

It is possible, and only slightly awkward, to make LaTex tables with borders around some of the cells and no borders or only partial borders around other cells. Below are two snippets of code showing you how. Each is followed by an image of the table it produces. This code uses two LaTex packages, multirow and rotating, so the following needs to be before your \begin{document} line. These packages are part of the MacTeX distribution.

\usepackage{multirow}
\usepackage{rotating}

In the following code, \multicolumn{x}{y}{z} is used to merge {x} columns into one. Notice that the new column resulting from the merge has its own alignment and borders specified by {y} and the text or math equation to be displayed is specified by {z}. Creatively specifying {y} and {z} results in blank white space on the table produced.

Here is a more advanced example. In the code below, \multirow{x}{y}{z} is used to merge {x} rows into one. Notice that this requires leaving space for the merged rows in subsequent lines of code. This is why each subsequent line begins with an ampersand. The * makes the text in the merged row fit best and use of the sideways environment makes the text in the merged row vertical. The extra tilde after “letters” was used to force some spacing to make the text look good.