0

Although I have tried to do following table, it didn't work. Could someone help me how to do this table in LaTeX?

I followed following code:

\documentclass{article}
\usepackage{slashbox}
\begin{document}

\begin{tabular}{|l||*{5}{c|}}\hline
\backslashbox{Room}{Date}
&\makebox[3em]{5/31}&\makebox[3em]{6/1}&\makebox[3em]{6/2}
&\makebox[3em]{6/3}&\makebox[3em]{6/4}\\\hline\hline
Meeting Room &&&&&\\\hline
Auditorium &&&&&\\\hline
Seminar Room &&&&&\\\hline
\end{tabular}

\end{document} 

ps: I work in the Texworks.

  • Are you open to alternative suggestions? – Werner Aug 12 '15 at 17:08
  • Maybe my problem is: ! LaTeX Error: Can be used only in preamble. See the LaTeX manual or LaTeX Companion for explanation. Type H <return> for immediate help. ... l.162 \documentclass {article} Can you please help me – Odko Aug 12 '15 at 17:12
  • @Odko: l. 162 implies an error around line 162... and that doesn't resemble the minimal example you show. – Werner Aug 12 '15 at 17:22
  • this is line 162: \documentclass{article} – Odko Aug 12 '15 at 17:24
  • You have 161 lines of comments? Nothing else should be in front of the \documentclass. – John Kormylo Aug 12 '15 at 17:51
1

Here is a solution, and some improvements, with diagbox(which supersedes slashbox), eqparbox and hhline for nicely intersecting double rules:

\documentclass{article}
\usepackage{diagbox, eqparbox, hhline}
\setlength{\doublerulesep}{2.5pt}

\begin{document}

\renewcommand{\arraystretch}{1.5}
\begin{tabular}{|l||*{5}{>{\centering\arraybackslash}m{3em}|}}
  \hhline{-||-----}
  \diagbox[width=\dimexpr\eqboxwidth{wd} + 2\tabcolsep\relax, height=0.8cm]{Room}{\raisebox{0.5ex}{Date}}
  & 5/31 & 6/1 & 6/2 & 6/3 & 6/4 \\
  \hhline{=::=====}
  Meeting Room & & & & & \\
  \hhline{-||-----}
  Auditorium & & & & & \\
  \hhline{-||-----}
  \eqmakebox[wd]{Seminar Room} & & & & & \\
  \hhline{-||-----}
\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.