Information and discussion about graphics, figures & tables in LaTeX documents.
pban92
Posts: 54 Joined: Sat Aug 09, 2008 9:34 am
Post
by pban92 » Sun Jan 18, 2009 8:27 am
Hi guys,
I just gave up exploring any further to recreate this table
http://picasaweb.google.com/pban92/Time ... 3898227570 in latex.
The best I could came up with found the following code and this is even after a whole day try,
Code: Select all
\documentclass[12pt]{amsart}
\usepackage{geometry} % see geometry.pdf on how to lay out the page. There's lots.
\usepackage{lscape}
\geometry{a4paper} % or letter or a5paper or ... etc
\begin{document}
\clearpage
\begin{landscape}
\begin{tabular}{|p{5cm}l*{27}{c}r}
Tasks & J &F&M&A&M&J&J&A&S&O&N&D& J &F&M&A&M&J&J&A&S&O&N&D&J&F&M \\
\hline
Literature Review &&&&&&&&&&&&&&&&&&&&&&&&&&& \\
Confirmation Exam &&&&&&&&&&&&&&&&&&&&&&&&&&& \\
Hotwire &&&&&&&&&&&&&&&&&&&&&&&&&&& \\
Hotwire &&&&&&&&&&&&&&&&&&&&&&&&&&& \\
\end{tabular}
\end{landscape}
\end{document}
Any help would be beyond my appreciation.
Regards,
SMMM
NEW: TikZ book now 40% off at Amazon.com for a short time.
phi
Posts: 577 Joined: Tue Oct 21, 2008 8:10 pm
Post
by phi » Sun Jan 18, 2009 1:39 pm
Hi,
here is an example that you can use as a starting point:
Code: Select all
\documentclass{article}
\usepackage{xcolor}
\usepackage{colortbl}
\usepackage{multirow}
\setlength\tabcolsep{1pt}
\newcommand*\MonthLetters{JFMAMJJASOND}
\newcommand*\NumMonths{27}
\newcommand*\YearMonths{12,12,3,}
\newcommand*\FirstYear{2009}
\makeatletter
\newcommand*\YearHeadRow{%
\expandafter\TL@year@head\number\numexpr\FirstYear\expandafter\relax\expandafter\@nil\YearMonths\@nil
}
\def\TL@year@head#1\@nil#2,#3\@nil{%
&\multicolumn{#2}{c|}{#1}%
\ifx\\#3\\\else
\TL@after@fi\TL@year@head\number\numexpr#1+1\relax\@nil#3\@nil
\fi
}
\newcommand*\YearMonthSep[1]{%
\cline{\numexpr#1+1\relax-\numexpr#1+\NumMonths\relax}%
}
\newcommand*\MonthHeadRow{%
\expandafter\TL@month@head\expandafter\@ne\expandafter\@nil\MonthLetters\@nil
}
\def\TL@month@head#1\@nil#2#3\@nil{%
%
\ifnum\NumMonths>#1 %
\TL@after@fi\TL@month@head\number\numexpr#1+1\relax\@nil#3#2\@nil
\fi
}
\newcount\TL@block@first
\newcount\TL@block@last
\newcommand*\NewBlock[3]{%
\xglobal\colorlet{TL@block}{#1}%
\global\TL@block@first\numexpr#2-1\relax
\global\TL@block@last\numexpr#3+1\relax
\ignorespaces
}
\newcount\TL@row
\newcommand*\Row[1]{%
\global\advance\TL@row\@ne
\number\TL@row%
\TL@cell\@ne
\\\hline
}
\def\TL@cell#1{%
&%
\ifnum#1>\TL@block@first
\ifnum#1<\TL@block@last
\cellcolor{TL@block}%
\fi
\fi
\ifnum\NumMonths>#1 %
\expandafter\TL@cell\expandafter{\number\numexpr#1+1\expandafter}%
\fi
}
\def\TL@after@fi#1\fi{\fi#1}
\makeatother
\begin{document}
\begin{tabular}{|c|p{80pt}|*{\NumMonths}{c|}}
\hline
\multirow{2}{*}{\#} & \multirow{2}{*}{Tasks} \YearHeadRow \\
\YearMonthSep{2}
& \MonthHeadRow \\
\hline
\NewBlock{blue}{1}{\NumMonths}
\Row{Literature Review}
\NewBlock{yellow}{1}{2}
\Row{Confirmation Exam}
\NewBlock{gray}{3}{10}
\Row{Hotwire construction of ``c/t vs St'' increased by integer}
% ...
\Row{Publication 01}
\NewBlock{blue}{11}{18}
\Row{Pressure measurement with splitter plate}
% ...
\NewBlock{green}{25}{\NumMonths}
\Row{Thesis writing}
\end{tabular}
\end{document}
pban92
Posts: 54 Joined: Sat Aug 09, 2008 9:34 am
Post
by pban92 » Sun Jan 18, 2009 2:59 pm
dude thanks beyond anything! U must hv been doing this latex thing for eternity! *hats off*
pban92
Posts: 54 Joined: Sat Aug 09, 2008 9:34 am
Post
by pban92 » Sun Jan 18, 2009 3:02 pm
dude! came back again to thank you! just wondering how long you took to write all these long codes??? I love you man!
eoinkm
Posts: 12 Joined: Tue Jan 20, 2009 4:59 pm
Post
by eoinkm » Tue Jan 20, 2009 5:13 pm
Dear phi,
I saw this post and was hoping that you could solve my problem.
I am writing my thesis at the moment and am getting extremely frustrated over this table:
http://picasaweb.google.co.uk/lh/photo/ ... directlink
that i'm trying to produce on LaTeX.
The majority of it is working however I'm receiving errors saying that there are too many
&s.
Can you please help me and as soon as possible as my deadline is coming up next week.
Cheers,
eoinkm
phi
Posts: 577 Joined: Tue Oct 21, 2008 8:10 pm
Post
by phi » Tue Jan 20, 2009 5:38 pm
Hello,
please create a new thread (so that other will read it, too) and post what you have got so far. As far as I can see, this is a pretty standard table without anything special, so you only need the standard tabular environment, \multicolumn and \cellcolor from the colortbl package.
eoinkm
Posts: 12 Joined: Tue Jan 20, 2009 4:59 pm
Post
by eoinkm » Tue Jan 20, 2009 9:29 pm
so far I have come up with this:
Code: Select all
\begin{table}[!h]
\begin{center}
\begin{tabular}{|c|c|c|c|c|c|c|c|c|c|c|c|c|c|} \hline
\textbf{Virus}& \multicolumn{3}{|c|}{RABIES}& \multicolumn{4}{|c|}{VSVG}& \multicolumn{2}{|c|}{EBOLA}& \multicolumn{5}{|c|}{MOKOLA} \\ \hline
\textbf{Administration}&i.v.&i.m.&i.s.&i.v.&i.m.&i.p.&i.t.&i.v.&i.m.&i.v.&i.m.&i.p.&i.s.&i.t.\\ \hline
BRAIN&+&+&++&+&-&-&-&+&-&+&-&+&+&+\\ \cline{1-14}
S.CORD&+&+&+++&+&-&-&-&-&-&-&-&-&+&-\\ \cline{1-14}
P.NERVES&+&++&++&-&-&+/-&-&+&-&+/-&+&+/-&+&+/-\\ \cline{1-14}
HEART&+/-&-&-&++&+&-&+&+/-&+&+&+&++&-&++\\ \cline{1-14}
DIAPHRAGM&+/-&-&-&+++&+&+/-&-&+&+&++&+&++&-&++\\ \cline{1-14}
LIVER&+&-&-&+++&+&+/-&-&+&+&++&+&++&-&++\\ \cline{1-14}
SK.MUSCLE&-&+&-&+&++&++&+++&+/-&+&++&+++&+++&+&+++\\ \cline{1-14}
\end{tabular}
\end{center}
\setlength{\captionmargin}{10pt}\caption{Themis results}
\label{themis}
\end{table}
[/color]
If you build this yourself though you will see the problem that I'm having.
Thanks,
eoinkm
P.S. this may sound stupid but I'm not very used to using forums and I'm not sure what you mean by posting a new thread
localghost
Site Moderator
Posts: 9202 Joined: Fri Feb 02, 2007 12:06 pm
Post
by localghost » Tue Jan 20, 2009 9:53 pm
eoinkm wrote: [...] P.S. this may sound stupid but I'm not very used to using forums and I'm not sure what you mean by posting a new thread
Just enter a forum and click on the "New Topic" button to open a new topic (thread) and with that a discussion to your request.
Best regards
Thorsten¹