4

How can I create the following table in LaTeX? I created the table below using PowerPoint.

enter image description here

Here is my best attempt at using LaTeX to create the table:

\begin{tabular}{l|l|l|}
  \cline{2-3} 
  & \multicolumn{2}{|c|}{Returning Week} \\ \cline{2-3}
    & 1 & 2 \\ \hline
  \multicolumn{1}{|l|}{1} & 0.3 & 0.2 \\ \hline
  \multicolumn{1}{|l|}{2} & 0.1 & 0.1 \\ \hline
\end{tabular}

and the output

enter image description here

Similar tex.stackexchange posts:

  • From the first linked question, all you need is the rotating package and its sideways environment. Please add your code for the table (without the rotated label, of course). – karlkoeller Aug 22 '13 at 16:53
  • @karlkoeller Done! It does look ugly that the columns 1 and 2 have different widths. How should I fix that? – I Like to Code Aug 22 '13 at 18:41
4
\documentclass{article}
\usepackage{rotating}
\begin{document}
\raisebox{-.2in}{\rotatebox{90}{Arriving Week}}
\renewcommand\arraystretch{1.2}
\begin{tabular}[b]{p{0.8in}|p{0.8in}|p{0.8in}|}
  \cline{2-3} 
  & \multicolumn{2}{|c|}{Returning Week} \\ \cline{2-3}
    & 1 & 2 \\ \hline
  \multicolumn{1}{|l|}{1} & 0.3 & 0.2 \\ \hline
  \multicolumn{1}{|l|}{2} & 0.1 & 0.1 \\ \hline
\end{tabular}
\end{document}

enter image description here

3

Similar to Steven's solution, but reproduces almost exactly the table in your image.

You have to compile it with xelatex.

\documentclass{article}

\usepackage{fontspec}
\defaultfontfeatures{Ligatures=TeX}
\setmainfont{Calibri}

\renewcommand\arraystretch{1.15}

\begin{document}

\raisebox{-1.4cm}{\rotatebox{90}{Arriving Week}}\hspace{3pt}
\begin{tabular}{|p{2.5cm}|p{2.5cm}|p{2.5cm}|}
  \multicolumn{1}{l}{}  & \multicolumn{2}{l}{\hspace{1.1cm}Returning Week} \\ \cline{2-3}
  \multicolumn{1}{l|}{} & 1 & 2 \\ \hline
  1 & 0.3 & 0.2 \\ \hline
  2 & 0.1 & 0.1 \\ \hline
\end{tabular}

\end{document} 

enter image description here

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.