2

Could some one guide me in making this table in Latex? I am new to programming and I couldn't go through to this because of my poor programming skills.

enter image description here

Edited: Could someone fix the last column in last row which shows "Cancelled"?

enter image description here

Here is my coding,

\begin{tabular}{|l|c|l|c|l|c|l|} \hline

&\multicolumn{2}{||c|}{6.15-7.15 pm}
&\multicolumn{2}{|c|}{7.20-8.20 pm}
&\multicolumn{2}{|c||}{8.30-9.30 pm}\\ \hline \hline

\multirow{3}{*}{Day} &\multirow{3}{*}{Subj.} &Teacher & &Teacher &\multirow{3}{*}{Subj.}&Teacher\\ \cline{3-3} \cline{5-5} \cline{7-7}& &Room
&\multirow{1}{*}{Subj.} &Room &  &Room \\ \hline

\multirow{3}{*}{Mon} &\multirow{3}{*}{UNIX} &Dr. Smith & &Ms. Clarke  &\multirow{3}{*}{Math.}&Mr.Mills\\ \cline{3-3} \cline{5-5} \cline{7-7} & &Comp. Ctr
&\multirow{1}{*}{Fortran} &Hall A &  &Hall A \\ \hline

\multirow{3}{*}{Tues} &\multirow{3}{*}{LaTex} &Miss Baker & &Ms. Clarke  &\multirow{3}{*}{Math.}&Mr.Mills\\ \cline{3-3} \cline{5-5} \cline{7-7} & &Conf. Room
&\multirow{1}{*}{Fortran} &Conf.Room &  &Hall A \\ \hline

\multirow{3}{*}{Wed} &\multirow{3}{*}{UNIX} &Dr. Smith & &Dr. Jones &\multirow{3}{*}{ComSci}&Dr.Jones\\ \cline{3-3} \cline{5-5} \cline{7-7} & &Comp. Ctr
&\multirow{1}{*}{C} &Hall B &  &Hall B \\ \hline

\multirow{3}{*}{Fri} &\multirow{3}{*}{LaTex} &Miss Baker & &Ms. Clarke  &\multirow{3}{*}{Cancelled } & \\ \cline{3-3} \cline{5-5} & &Conf. Room &\multirow{1}{*}{C++} &Conf.Room &  &  \\ \hline

\end{tabular}
  • 1
    Hello, welcome to TeX.SX. Not really sure typesetting this table counts as 'programming', but whatever. Yes, this is possible (though not the world's prettiest table as it is). But you should help us to help you by including your best efforts so far (i.e. an MWE meta.tex.stackexchange.com/questions/228/…). Even if it's just a skeleton of a document, with a preamble, a \begin{document} and \end{document} and maybe the environment for your table set up that would help. – Au101 Aug 12 '15 at 16:48
  • You're gonna wanna look at the multirow package and its \multirow command, as well as the \multicolumn command – Au101 Aug 12 '15 at 16:50
  • I have edited the post and have included my work whatever i have done up till now. I have only included the tabular environment. – Jack Aug 12 '15 at 17:04
  • Au101, Thanks for your suggestion. It worked. Much better than before. Can you help me fix the last column and last row which shows "Cancelled"? Also, Could you check if there is any error or better coding suggestion? – Jack Aug 12 '15 at 18:08
  • 4
    @Jack: Don't include code as images. Insert them as text in your post so we can copy-and-paste them into an editor... – Werner Aug 12 '15 at 18:09
3

Is it something like that you want?

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{array, multirow}

\newlength{\lA}\settowidth{\lA}{ComSci}
%\setlength{\lA}{2cm}
\newlength{\lB}\settowidth{\lB}{Conf. Room}

\usepackage{cellspace}
\setlength\cellspacetoplimit{6pt}
\setlength\cellspacebottomlimit{4pt}

\begin{document}

\begin{center}
  \begin{tabular}{|l|>{\centering}m{\lA}|m{\lB}|>{\centering}m{\lA}|S{m{\lB}}|>{\centering}m{\lA}|m{\lB}|}%
    \cline{2-7}
    \multicolumn{1}{c|}{} & \multicolumn{2}{@{\,}|Sc|}{6.15-7.15 pm}
    & \multicolumn{2}{c|}{7.20-8.20 pm}
    & \multicolumn{2}{c||}{8.30-9.30 pm}\\
    \cline{2-7} \hline
    \multirow{2}{*}[-0.7ex]{Day} & \multirow{2}{*}[-0.7ex]{Subj.} & Teacher & \multirow{2}{*}[-0.7ex]{Subj.} & Teacher & \multirow{2}{*}[-0.7ex]{Subj.} & Teacher \\%
    \cline{3-3} \cline{5-5} \cline{7-7}
                                  & & Room & & Room & & Room \\
    \hline
    \multirow{2}{*}[-0.7ex]{Mon} & \multirow{2}{*}[-0.7ex]{UNIX} & Dr. Smith & \multirow{2}{*}[-0.7ex]{Fortran} & Ms. Clarke & \multirow{2}{*}[-0.7ex]{Math.} & Mr.Mills \\ %
    \cline{3-3} \cline{5-5} \cline{7-7} & & Comp. Ctr
    & & Hall A & & Hall A \\
    \hline
    \multirow{2}{*}[-0.7ex]{Tues} & \multirow{2}{*}[-0.7ex]{LaTeX} & Miss Baker & \multirow{2}{*}[-0.7ex]{Fortran} & Ms. Clarke & \multirow{2}{*}[-0.7ex]{Math.} & Mr.Mills \\ %
    \cline{3-3} \cline{5-5} \cline{7-7}
                                  & & Conf. Room & & Conf.Room & & Hall A \\
    \hline
    \multirow{2}{*}[-0.7ex]{Wed} & \multirow{2}{*}[-0.7ex]{UNIX} & Dr. Smith & \multirow{2}{*}[-0.7ex]{C} & Dr. Jones & \multirow{2}{*}[-0.7ex]{ComSci} & Dr.Jones \\%
    \cline{3-3} \cline{5-5} \cline{7-7}
                                  & & Comp. Ctr & & Hall B & & Hall B \\
    \hline
    \multirow{2}{*}[-0.7ex]{Fri} & \multirow{2}{*}[-0.7ex]{LaTeX} & Miss Baker & \multirow{2}{*}[-0.7ex]{C++} & Ms. Clarke & \multicolumn{2}{c|}{\multirow{2}{*}[-0.7ex]{Cancelled }} \\ %
    \cline{3-3} \cline{5-5}
    & & Conf. Room & & Conf.Room & \multicolumn{2}{c|}{} \\
    \hline
  \end{tabular}
\end{center}

\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.