Information and discussion about graphics, figures & tables in LaTeX documents.
eoinkm
Posts: 12 Joined: Tue Jan 20, 2009 4:59 pm
Post
by eoinkm » Tue Jan 20, 2009 10:10 pm
Hey guys,
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.
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. The last column is not appearing correctly with the data jumping down a line to the first column.
Thanks,
eoinkm
NEW: TikZ book now 40% off at Amazon.com for a short time.
marco_d
Posts: 57 Joined: Tue Jan 20, 2009 7:49 pm
Post
by marco_d » Wed Jan 21, 2009 12:20 am
Hello,
you forgot the declaration of the last column.
Code: Select all
\documentclass{scrreprt}
\usepackage[ngerman]{babel}
\usepackage[utf8]{inputenc}
\usepackage{caption,rotating}
\begin{document}
\begin{sidewaystable}
\centering
\begin{tabular}{|c|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&+&+&++&+&-&-&-&+&-&+&-&+&+&+\\ \hline
S.CORD&+&+&+++&+&-&-&-&-&-&-&-&-&+&-\\ \hline
P.NERVES&+&++&++&-&-&+/-&-&+&-&+/-&+&+/-&+&+/-\\ \hline
HEART&+/-&-&-&++&+&-&+&+/-&+&+&+&++&-&++\\ \hline
DIAPHRAGM&+/-&-&-&+++&+&+/-&-&+&+&++&+&++&-&++\\ \hline
LIVER&+&-&-&+++&+&+/-&-&+&+&++&+&++&-&++\\ \hline
SK.MUSCLE&-&+&-&+&++&++&+++&+/-&+&++&+++&+++&+&+++\\ \hline
\end{tabular}
\setlength{\captionmargin}{10pt}\caption{Themis results}
\label{themis}
\end{sidewaystable}
\end{document}
But it is a terrible table. You should read
booktabs
Marco
Last edited by
marco_d on Thu Jan 22, 2009 10:56 am, edited 1 time in total.
i am German. I can not use difficult words.
eoinkm
Posts: 12 Joined: Tue Jan 20, 2009 4:59 pm
Post
by eoinkm » Wed Jan 21, 2009 1:30 am
Hey marco_d,
thanks for your reply. I have tried what you suggested however there were some problems:
1. I can't have a sideways table!!
2. It still didn't come out correct however when I started a new fresh document I pasted what you wrote and it worked perfectly.
Could it be something to do with the packages I'm using shown below:
Code: Select all
\documentclass[a4paper,oneside]{book}
\pagestyle{headings}
\setlength{\parskip}{0.2cm}
\setlength{\parindent}{0cm}
\usepackage{caption,rotating}
\usepackage{graphicx,color,sectsty}
\usepackage[margin=3.75cm]{geometry}
\usepackage{setspace}
\usepackage{textcomp}
\usepackage[small]{caption}
\usepackage{multirow}
\usepackage{sidecap}
\usepackage{fancyhdr}
\usepackage{citesort}
%\usepackage{xtabular}
\usepackage{colortbl}
\onehalfspacing
\renewcommand{\chaptername}{Section}
\setcounter{secnumdepth}{4}
\setcounter{tocdepth}{4}
\begin{document}
etc.etc.
Hope you can help.
eoinkm
P.S. I know it's an awful table but I can't change it since I'm referencing it.
marco_d
Posts: 57 Joined: Tue Jan 20, 2009 7:49 pm
Post
by marco_d » Wed Jan 21, 2009 1:44 am
Hello,
the error message has the following reason. You load the package "caption" two times. An other possibility you can use the resizebox. We see that the width of the table are too large.
Here is an example:
Code: Select all
\documentclass[a4paper,oneside]{book}
\pagestyle{headings}
\setlength{\parskip}{0.2cm}
\setlength{\parindent}{0cm}
\usepackage{rotating}
\usepackage{graphicx,color,sectsty}
\usepackage[margin=3.75cm]{geometry}
\usepackage{setspace}
\usepackage{textcomp}
\usepackage[small]{caption}
\usepackage{multirow}
\usepackage{sidecap}
\usepackage{fancyhdr}
%\usepackage{citesort}
%\usepackage{xtabular}
\usepackage{colortbl}
\onehalfspacing
\renewcommand{\chaptername}{Section}
\setcounter{secnumdepth}{4}
\setcounter{tocdepth}{4}
\begin{document}
\begin{sidewaystable}
\centering
\begin{tabular}{|c|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&+&+&++&+&-&-&-&+&-&+&-&+&+&+\\ \hline
S.CORD&+&+&+++&+&-&-&-&-&-&-&-&-&+&-\\ \hline
P.NERVES&+&++&++&-&-&+/-&-&+&-&+/-&+&+/-&+&+/-\\ \hline
HEART&+/-&-&-&++&+&-&+&+/-&+&+&+&++&-&++\\ \hline
DIAPHRAGM&+/-&-&-&+++&+&+/-&-&+&+&++&+&++&-&++\\ \hline
LIVER&+&-&-&+++&+&+/-&-&+&+&++&+&++&-&++\\ \hline
SK.MUSCLE&-&+&-&+&++&++&+++&+/-&+&++&+++&+++&+&+++\\ \hline
\end{tabular}
\setlength{\captionmargin}{10pt}\caption{Themis results}
\label{themis1}
\end{sidewaystable}
\begin{table}[ht]
\centering
\resizebox{\textwidth}{!}{
\begin{tabular}{|c|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&+&+&++&+&-&-&-&+&-&+&-&+&+&+\\ \hline
S.CORD&+&+&+++&+&-&-&-&-&-&-&-&-&+&-\\ \hline
P.NERVES&+&++&++&-&-&+/-&-&+&-&+/-&+&+/-&+&+/-\\ \hline
HEART&+/-&-&-&++&+&-&+&+/-&+&+&+&++&-&++\\ \hline
DIAPHRAGM&+/-&-&-&+++&+&+/-&-&+&+&++&+&++&-&++\\ \hline
LIVER&+&-&-&+++&+&+/-&-&+&+&++&+&++&-&++\\ \hline
SK.MUSCLE&-&+&-&+&++&++&+++&+/-&+&++&+++&+++&+&+++\\ \hline
\end{tabular}}
\setlength{\captionmargin}{10pt}\caption{Themis results}
\label{themis}
\end{table}
\end{document}
The problem is, that the table is very small. An other alternative you can use the font option small.
Marco
EDIT: Maybe you can split the table in two tabulars. The first one with RABIES and VSVG and the other one with EBOLA and MOKOLA.
i am German. I can not use difficult words.
eoinkm
Posts: 12 Joined: Tue Jan 20, 2009 4:59 pm
Post
by eoinkm » Wed Jan 21, 2009 2:15 am
thank you so much,
it works now with the resize command. I've been trying to do this for days!
Could you help me with one more thing??
How do I color the boxes that are shown in the image on my picasa?
eoinkm
marco_d
Posts: 57 Joined: Tue Jan 20, 2009 7:49 pm
Post
by marco_d » Wed Jan 21, 2009 11:25 am
eoinkm wrote: thank you so much,
How do I color the boxes that are shown in the image on my picasa?
Hello,
I don't know what you mean. Picasa is a program. Or do you want colored rows? Please register my signature
Marco
i am German. I can not use difficult words.
eoinkm
Posts: 12 Joined: Tue Jan 20, 2009 4:59 pm
Post
by eoinkm » Wed Jan 21, 2009 11:36 am
Hi,
In my first post I have added a link to picasa which shows an image of the table I'm producing.
On that image there are a few of the cells that are coloured and I would like to know
how to do this.
Any idea?
eoinkm
P.S. how do i register your signature?
marco_d
Posts: 57 Joined: Tue Jan 20, 2009 7:49 pm
Post
by marco_d » Wed Jan 21, 2009 11:51 am
Hello,
Now I know picase. I thought it is a special word in English.
The command you need is "cellcolor". The code is part of the package xcolor. Here the example:
Code: Select all
\documentclass[a4paper,oneside]{book}
\pagestyle{headings}
\setlength{\parskip}{0.2cm}
\setlength{\parindent}{0cm}
\usepackage{rotating}
\usepackage{graphicx,sectsty}
\usepackage[table]{xcolor}
\usepackage[margin=3.75cm]{geometry}
\usepackage{setspace}
\usepackage{textcomp}
\usepackage[small]{caption}
\usepackage{multirow}
\usepackage{sidecap}
\usepackage{fancyhdr}
%\usepackage{citesort}
%\usepackage{xtabular}
\usepackage{colortbl}
\onehalfspacing
\renewcommand{\chaptername}{Section}
\setcounter{secnumdepth}{4}
\setcounter{tocdepth}{4}
\begin{document}
\begin{table}[ht]
\centering
\resizebox{\textwidth}{!}{
\begin{tabular}{|c|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&+&+&++&+&-&-&-&+&-&+&-&+&+&+\\ \hline
S.CORD&+&+&+++&+&-&-&-&-&-&-&-&-&+&-\\ \hline
P.NERVES&+&++&++&-&-&+/-&-&+&-&+/-&+&+/-&+&+/-\\ \hline
HEART&+/-&-&-&++&+&-&+&+/-&+&+&+&++&-&++\\ \hline
DIAPHRAGM&+/-&-&-&+++&+&+/-&-&+&+&++&+&++&-&++\\ \hline
LIVER&+&-&-&+++&+&+/-&-&+&+&++&+&++&-&++\\ \hline
SK.MUSCLE&-&+&-&\cellcolor{yellow}+&++&++&\cellcolor{yellow}+++&+/-&+&++&+++&+++&+&+++\\ \hline
\end{tabular}}
\setlength{\captionmargin}{10pt}\caption{Themis results}
\label{themis}
\end{table}
\end{document}
The hint to my signature has the reason that I am German. I am registered here to improve my English.
Marco
i am German. I can not use difficult words.
eoinkm
Posts: 12 Joined: Tue Jan 20, 2009 4:59 pm
Post
by eoinkm » Wed Jan 21, 2009 12:21 pm
thanks for that, it worked however some of the lines of the table don't appear now.
Do you know why this is?
eoinkm
marco_d
Posts: 57 Joined: Tue Jan 20, 2009 7:49 pm
Post
by marco_d » Wed Jan 21, 2009 12:58 pm
eoinkm wrote: thanks for that, it worked however some of the lines of the table don't appear now.
Hello,
It looks so. When I zoom in with the adobe (1600%) there is no difference. When you are printing the table, are there any problems?
Another possibility you can use the multicolumn command together with the columncolor. This command has two optional arguments, one for the left and one for the right margin.
Marco
Last edited by
marco_d on Thu Jan 22, 2009 10:59 am, edited 1 time in total.
i am German. I can not use difficult words.