1

Im relatively new to LaTeX and trying to create the table below, but so far I'm unsuccessful. Any help will be appreciated. enter image description here

4
  • 3
    Welcome to TEX.SE! Can you please show us what you have tried until now?
    – Mensch
    Aug 4, 2014 at 13:21
  • Have a look at color-only-a-cell-of-a-table. Btw, you'll usual get help faster, and help that addresses what you're trying to ask, if you include a minimal working example as part of your question.
    – user30471
    Aug 4, 2014 at 13:24
  • 1
    Welcome to TeX.SX! Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}.
    – user31729
    Aug 4, 2014 at 13:27
  • Gonzalo Medina's approach is indeed a good solution. When you are relatively new to LaTeX and want to find out more about how to work with tables: have a look at LaTeX/Tables - Wikibooks. It has some clear examples and descriptions on how to use the \multirow{} and \multicolumn{} commands to create table cells which span multiple rows or colums. It also provides information on colouring table cells.
    – Bart
    Aug 4, 2014 at 14:03

1 Answer 1

1

Two options: the first one produces the table as you posted it. In the second option I suppressed the vertical rules and the colors and used the features from the booktabs package (using siunitx the table could be further improved):

\documentclass{article}
\usepackage{booktabs}
\usepackage[table]{xcolor}

\begin{document}

\begingroup
\renewcommand\arraystretch{1.3}
\noindent\begin{tabular}{|>{\columncolor{gray!30}}l*{4}{|l}|}
\hline
& \multicolumn{4}{l|}{\cellcolor{gray!30}\bfseries Interest rates} \\
\cline{2-5}
\bfseries Stock & &  \bfseries Decline & \bfseries Increase & \bfseries Unit \\
\bfseries Price & & & & \bfseries Frequency \\
\cline{2-5}
& \bfseries Decline & 200 & 950 & 1150 \\
\cline{2-5}
& \bfseries Increase & 800 & 50 & 850 \\
\cline{2-5}
& & 1000 & 1000 & 2000 \\
\hline
\end{tabular}
\endgroup\par\bigskip

\noindent\begin{tabular}{*{5}{l}}
\toprule
& \multicolumn{4}{l}{\bfseries Interest rates} \\
\cmidrule(l){2-2}\cmidrule(lr){3-3}\cmidrule(lr){4-4}\cmidrule(r){5-5}
\bfseries Stock & &  \bfseries Decline & \bfseries Increase & \bfseries Unit \\
\bfseries Price & & & & \bfseries Frequency \\
\cmidrule{2-5}
& \bfseries Decline & 200 & 950 & 1150 \\
& \bfseries Increase & 800 & 50 & 850 \\
& & 1000 & 1000 & 2000 \\
\bottomrule
\end{tabular}

\end{document}

enter image description here

The \noindents and the group for the first table won't be necessary if the tables are inside a table environment.

1
  • \begin{center} \begin{tabular}{c c c c} \hline Stock Price/Interest Rate & Decline & Increase & Unit frequency\\ \hline \hline Decline & 200 & 950 & 1150\\ Increase & 800 & 50 & 850\\ & 1000 & 1000 & 2000\\ \hline \end{tabular} \end{center} This is what I have done so far. It is just the labelling of the rows and columns I a quite unsure of. Thanks for the quick responses, you are all a life saver to me.
    – Peter
    Aug 4, 2014 at 14:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .