Graphics, Figures & TablesDissapearing verticle lines in PDF

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
teXbeginnerM
Posts: 4
Joined: Wed Oct 20, 2010 11:22 am

Dissapearing verticle lines in PDF

Post by teXbeginnerM »

Hi! I have made a table using both multirow and multicoloumn, using examples on the internet. My code looks okay to me, but when I look at the PDF some of the vertical lines are missing, and there is a couple of horizontal lines that shouldn't be there. My code is as follows

Code: Select all

\documentclass[a4paper,12pt]{article}
\usepackage{multicol}
\usepackage{multirow}
\usepackage{array}
\usepackage[margin=2cm,bottom=2cm]{geometry}
\begin{document}
\begin{footnotesize} \setlength{\extrarowheight}{2mm}
\begin{tabular}{| l | l | l | l | l | l | l | l | l |}
\hline
 & & & \multicolumn{3}{c}{Total colony} & & &  \\
 & & & \multicolumn{3}{c}{forming units per} & & & \\
Site & Site name & Transect & \multicolumn{3}{c}{100 mL} & Mean & Variance & Standard \\
\cline{4-6}
number & & & Depth & Depth & Depth & & & Deviation \\
 & & & 0 m & 1,5 m & 3 m & & & \\ \hline
2 & Møhlenpris & Inner & 20 & 20 & 10 & \multirow{4}{*}{11,25}& \multirow{4}{*}{155,11} & \multirow{4}{*}{12,46} \\ \hline
3 & Marineholmen & Inner & $<10$ & $<10$ & 10 &  \\ \cline{1-6}
4 & Damsgård & Inner & 10 & 10 & 10 &  \\ \cline{1-6}
5 & Solheimsviken & Inner & $<10$ & 50 & 10 &  \\ \hline
1 & Nordnes & Outer & 10 & $<10$ & $<10$ & \multirow{2}{*}{10,83} & \multirow{2}{*}{54,17} & \multirow{2}{*}{3,36} \\ \cline{1-6}
6 & Laksevåg & Outer & $<10$ & $<10$ & $<10$ & \\ 
\hline
\end{tabular}
\end{footnotesize}
\end{document}
Hope someone can help me!

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Dissapearing verticle lines in PDF

Post by gmedina »

Hi,

some ampersands were missing and some \hline and \cline commands had to be interchanged. Perhaps this is what you were trying to achieve:

Code: Select all

\documentclass[a4paper,12pt]{article}
\usepackage{multicol}
\usepackage{multirow}
\usepackage{array}
\usepackage[margin=2cm,bottom=2cm]{geometry}

\begin{document}

\begin{footnotesize} 
\setlength{\extrarowheight}{2mm}
\begin{tabular}{| l | l | l | l | l | l | l | l | l |}
  \hline
  & & & \multicolumn{3}{c}{Total colony} & & &  \\
  & & & \multicolumn{3}{c}{forming units per} & & & \\
  Site & Site name & Transect & \multicolumn{3}{c}{100 mL} & Mean & Variance & 
    Standard \\ \cline{4-6}
  number & & & Depth & Depth & Depth & & & Deviation \\
  & & & 0 m & 1,5 m & 3 m & & & \\ \hline
  2 & Møhlenpris & Inner & 20 & 20 & 10 & \multirow{4}{*}{11,25} & 
    \multirow{4}{*}{155,11} & \multirow{4}{*}{12,46}  \\ \cline{1-6}
  3 & Marineholmen & Inner & $<10$ & $<10$ & 10 & & & \\ \cline{1-6}
  4 & Damsgård & Inner & 10 & 10 & 10 & & & \\ \cline{1-6}
  5 & Solheimsviken & Inner & $<10$ & 50 & 10 & & & \\ \hline
  1 & Nordnes & Outer & 10 & $<10$ & $<10$ & \multirow{2}{*}{10,83} & 
    \multirow{2}{*}{54,17} & \multirow{2}{*}{3,36} \\ \cline{1-6}
  6 & Laksevåg & Outer & $<10$ & $<10$ & $<10$ & & & \\ \hline
\end{tabular}
\end{footnotesize}
\end{document}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
teXbeginnerM
Posts: 4
Joined: Wed Oct 20, 2010 11:22 am

Re: Dissapearing verticle lines in PDF

Post by teXbeginnerM »

This was much better,thank you very much! But there is still one vertical line missing in the pdf, on the right side of total colony forming units...
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Dissapearing verticle lines in PDF

Post by gmedina »

The second argument of \multicolumn overrides the format specification of columns; in particular, vertical lines must be declared in this argument:

Code: Select all

\documentclass[a4paper,12pt]{article}
\usepackage{multicol}
\usepackage{multirow}
\usepackage{array}
\usepackage[margin=2cm,bottom=2cm]{geometry}

\begin{document}

\begin{footnotesize} 
\setlength{\extrarowheight}{2mm}
\begin{tabular}{| l | l | l | l | l | l | l | l | l |}
  \hline
  & & & \multicolumn{3}{c|}{Total colony} & & &  \\
  & & & \multicolumn{3}{c|}{forming units per} & & & \\
  Site & Site name & Transect & \multicolumn{3}{c|}{100 mL} & Mean & Variance & 
    Standard \\ \cline{4-6}
  number & & & Depth & Depth & Depth & & & Deviation \\
  & & & 0 m & 1,5 m & 3 m & & & \\ \hline
  2 & Møhlenpris & Inner & 20 & 20 & 10 & \multirow{4}{*}{11,25} & 
    \multirow{4}{*}{155,11} & \multirow{4}{*}{12,46}  \\ \cline{1-6}
  3 & Marineholmen & Inner & $<10$ & $<10$ & 10 & & & \\ \cline{1-6}
  4 & Damsgård & Inner & 10 & 10 & 10 & & & \\ \cline{1-6}
  5 & Solheimsviken & Inner & $<10$ & 50 & 10 & & & \\ \hline
  1 & Nordnes & Outer & 10 & $<10$ & $<10$ & \multirow{2}{*}{10,83} & 
    \multirow{2}{*}{54,17} & \multirow{2}{*}{3,36} \\ \cline{1-6}
  6 & Laksevåg & Outer & $<10$ & $<10$ & $<10$ & & & \\ \hline
\end{tabular}
\end{footnotesize}

\end{document}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
teXbeginnerM
Posts: 4
Joined: Wed Oct 20, 2010 11:22 am

Re: Dissapearing verticle lines in PDF

Post by teXbeginnerM »

Thank you, that is perfect!
Post Reply