4

I have produced this table in LaTeX:

\begin{table}[hbt]
                    \begin{center}
                        \begin{tabular}{|l|l|l|l|}
                            \hline & \multicolumn{3}{c|}{Examples}\\
                            \cline{2-4}
                            & description & $M$ & \textbf{u}\\
                            \hline translation & through vector $\begin{pmatrix}6\\7\end{pmatrix}$ & $\begin{pmatrix}
                                1 & 0 \\ 0 & 1
                            \end{pmatrix}$ & $\begin{pmatrix}6\\7\end{pmatrix}$\\
                            \hline reflection & in line $x=2$ & $\begin{pmatrix}
                            -1 & 0 \\ 0 & 1
                            \end{pmatrix}$ & $\begin{pmatrix}4\\0\end{pmatrix}$\\
                            \hline rotation & about \textbf{0} through $\pi$ radians & $\begin{pmatrix}
                            -1 & 0 \\ 0 & -1
                            \end{pmatrix}$ & $\begin{pmatrix}0\\0\end{pmatrix}$\\
                            \hline glide reflection & in line $y=x$, then through $\begin{pmatrix}1\\1\end{pmatrix}$ & $\begin{pmatrix}
                            0 & 1 \\ 1 & 0
                            \end{pmatrix}$ & $\begin{pmatrix}1\\1\end{pmatrix}$\\
                            \hline
                            \end{tabular}
                            \caption{Examples of Euclidean Transformations} \label{tab1}
                    \end{center}
                    \end{table}

How do I remove the two external lines from the top left empty corner cell? I want lines only around the other parts.

Also it looks a bit cramped, is there a way I can present it more nicely?

1
  • Welcome. You can modificate directly you table with tablesgenerator.com. It very simple and very fast. Can you add a screenshot? – Sebastiano Dec 9 '16 at 16:25
2

Slightly modified Mico answer:

  • added package setspace for vertical space around cells content in last two columns
  • amsmath changed with mathtools, with its pmatrix* can be pmatrix columns right aligned

enter image description here

\documentclass{article}
\usepackage{mathtools, array, cellspace}% changed package, new package

\begin{document}
\begin{table}[hbt]
\setlength\cellspacetoplimit{3pt}    % add vertical space above cell content
\setlength\cellspacebottomlimit{3pt} % add vertical space below cell content
\renewcommand\arraystretch{1.3} % for a slightly more open look
\setlength\arraycolsep{3pt}     % for smaller distances between pmatrix columns
    \centering
    \begin{tabular}{|l|l|*{2}{>{$}Sc<{$}|}} % changed column types for last two columns
\cline{2-4}
\multicolumn{1}{l|}{} & \multicolumn{3}{c|}{Examples}\\
\cline{2-4}
\multicolumn{1}{l|}{} & Description &  M  &  \mathbf{u} \\
\hline
Translation & through vector $\begin{pmatrix}6\\7\end{pmatrix}$
            &  \displaystyle\begin{pmatrix} 1 & 0 \\ 0 & 1 \end{pmatrix}
            &  \begin{pmatrix}6\\7\end{pmatrix} \\
\hline
Reflection  & in line $x=2$
            &  \begin{pmatrix*}[r] -1 & 0 \\ 0 & 1 \end{pmatrix*}
            &  \begin{pmatrix}4\\0\end{pmatrix} \\
\hline
Rotation    & about $\mathbf{0}$ through $\pi$ radians
            &  \begin{pmatrix*}[r] -1 & 0 \\ 0 & -1 \end{pmatrix*}% right align columns in pmatrix
            &  \begin{pmatrix}0\\0\end{pmatrix} \\
\hline
Glide reflection & in line $y=x$, then through $\begin{pmatrix}1\\1\end{pmatrix}$
            & \begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix}
            & \begin{pmatrix}1\\1\end{pmatrix} \\
\hline
    \end{tabular}
\caption{Examples of Euclidean Transformations}
    \label{tab1}
\end{table}
\end{document}
4

To improve the overall look of the table, you may also be interesred in booktabs package. No need for the vertical rules in this case. As you observe, the table now is less crappy due to the extra vertical space added by the package.

\documentclass{article}
\usepackage{amsmath,booktabs}
\begin{document}
\begin{table}[hbt]
\centering
    \begin{tabular}{*4{l}}
        \toprule
        & \multicolumn{3}{c}{Examples}\\
        \cmidrule{2-4}
        & description & $M$ & \textbf{u}\\
        \midrule translation & through vector $\begin{pmatrix}6\\7\end{pmatrix}$ & $\begin{pmatrix}
        1 & 0 \\ 0 & 1
        \end{pmatrix}$ & $\begin{pmatrix}6\\7\end{pmatrix}$\\
        \midrule reflection & in line $x=2$ & $\begin{pmatrix}
        -1 & 0 \\ 0 & 1
        \end{pmatrix}$ & $\begin{pmatrix}4\\0\end{pmatrix}$\\
        \midrule rotation & about \textbf{0} through $\pi$ radians & $\begin{pmatrix}
        -1 & 0 \\ 0 & -1
        \end{pmatrix}$ & $\begin{pmatrix}0\\0\end{pmatrix}$\\
        \midrule glide reflection & in line $y=x$, then through $\begin{pmatrix}1\\1\end{pmatrix}$ & $\begin{pmatrix}
        0 & 1 \\ 1 & 0
        \end{pmatrix}$ & $\begin{pmatrix}1\\1\end{pmatrix}$\\
        \bottomrule
        \end{tabular}
        \caption{Examples of Euclidean Transformations}
\label{tab1}
\end{table}
\end{document} 

enter image description here

A possibly better version (by removing the inner \midrules and adding a small vertical height to the row by \\[8pt] as proposed by @Mico):

\begin{tabular}{*4{l}}
    \toprule
    & \multicolumn{3}{c}{Examples}\\
    \cmidrule{2-4}
    & description & $M$ &  $\mathbf{u}$\\
    \midrule translation & through vector $\begin{pmatrix}6\\7\end{pmatrix}$ & $\begin{pmatrix}
    1 & 0 \\ 0 & 1
    \end{pmatrix}$ & $\begin{pmatrix}6\\7\end{pmatrix}$\\[8pt]
    reflection & in line $x=2$ & $\begin{pmatrix}
    -1 & 0 \\ 0 & 1
    \end{pmatrix}$ & $\begin{pmatrix}4\\0\end{pmatrix}$\\[8pt]
    rotation & about \textbf{0} through $\pi$ radians & $\begin{pmatrix}
    -1 & 0 \\ 0 & -1
    \end{pmatrix}$ & $\begin{pmatrix}0\\0\end{pmatrix}$\\[8pt]
    glide reflection & in line $y=x$, then through $\begin{pmatrix}1\\1\end{pmatrix}$ & $\begin{pmatrix}
    0 & 1 \\ 1 & 0
    \end{pmatrix}$ & $\begin{pmatrix}1\\1\end{pmatrix}$\\
    \bottomrule
\end{tabular}

enter image description here

1
  • Possible improvements might be centering “description” (with `\multicolumn{1}{c}{description} and columns 3 and 4. – egreg Dec 9 '16 at 18:09
3

You need to replace the header lines

\hline & \multicolumn{3}{c|}{Examples}\\
\cline{2-4}
& description & $M$ & \textbf{u}\\

with

\cline{2-4} 
\multicolumn{1}{l|}{} & \multicolumn{3}{c|}{Examples}\\
\cline{2-4}
\multicolumn{1}{l|}{} & description & $M$ & $\mathbf{u}$\\

A full MWE:

enter image description here

\documentclass{article}
\usepackage{amsmath,array}
\begin{document}
\begin{table}[hbt]
\setlength\extrarowheight{2pt}  % for a slightly more open look
\centering
\begin{tabular}{|l|l|c|c|}
        \cline{2-4}
        \multicolumn{1}{l|}{} & \multicolumn{3}{c|}{Examples}\\
        \cline{2-4}
        \multicolumn{1}{l|}{} & Description & $M$ & $\mathbf{u}$\\
        \hline
        Translation & through vector $\begin{pmatrix}6\\7\end{pmatrix}$
                    & $\begin{pmatrix} 1 & 0 \\ 0 & 1 \end{pmatrix}$
                    & $\begin{pmatrix}6\\7\end{pmatrix}$\\
        \hline
        Reflection  & in line $x=2$
                    & $\begin{pmatrix} -1 & 0 \\ 0 & 1 \end{pmatrix}$
                    & $\begin{pmatrix}4\\0\end{pmatrix}$\\
        \hline
        Rotation    & about $\mathbf{0}$ through $\pi$ radians
                    & $\begin{pmatrix} -1 & 0 \\ 0 & -1 \end{pmatrix}$
                    & $\begin{pmatrix}0\\0\end{pmatrix}$\\
        \hline
        Glide reflection & in line $y=x$, then through $\begin{pmatrix}1\\1\end{pmatrix}$
                    & $\begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix}$
                    & $\begin{pmatrix}1\\1\end{pmatrix}$\\
        \hline
\end{tabular}
\caption{Examples of Euclidean Transformations}
\label{tab1}
\end{table}
\end{document} 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.