Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have this table

\begin{tabular}{ | p{2cm} | p{4cm} | p{4cm} | p{4cm} | }
\hline
Název & \multicolumn{3}{ l }{vypsatZapojeniResiteluDoProjektu} \vline\\
\hline
Popis & \multicolumn{3}{ l }{Vedouci pracovnik}  \vline \\
\hline
Priorita & 1 = vysoka & \textbf{Frekvence} & nekolikrat denne \\
\hline
Vstupni podminky & \multicolumn{3}{p{12cm}}{sdgsdgsg.} \vline \\
\hline
Vystupni podminky & \multicolumn{3}{p{12cm}}{sdgsdgsga.} \vline \\
\hline
Uzivatele & \multicolumn{3}{p{12cm}}{sdgsdgsdg.} \vline \\
\hline
\multirow{3}{2pt}{Zakladni posloupnost} & \multicolumn{3}{p{12cm}}{sgdsgsdg.} \vline \\
\cline{2-4}
& \multicolumn{3}{p{12cm}}{sdgsdgg.} \vline \\
\cline{2-4}
& \multicolumn{3}{p{12cm}}{sgsdggdsg.} \vline \\
\hline
\end{tabular}

But \cline doesn't work and my LaTeX IDE singalize some error. I need to have hline only by last 3 columns.

share|improve this question

migrated from stackoverflow.com Dec 4 '11 at 2:17

This question came from our site for professional and enthusiast programmers.

    
I couldn't reproduce the problem -- your table seems to compile fine when it's in a simple tex file (with the multirow package). What error is your IDE giving you? What happens when you try to compile your document from the command line? –  Seth Dec 4 '11 at 0:56
    
Welcome to TeX.sx! Your question was migrated here from Stack Overflow. Please register on this site, too, and make sure that both accounts are associated with each other, otherwise you won't be able to comment on or accept answers or edit your question. –  Werner Dec 4 '11 at 2:25
    
It is always best to compose a fully compilable MWE that illustrates the problem including the \documentclass and the appropriate packages, which is probably the issue in this case. Are you including \usepackage{multirow}? Once I add that and put the \documentclass{article} \begin{document}...\end{document} wrapper this compile just fine. –  Peter Grill Dec 4 '11 at 2:42

1 Answer 1

Your table, after suitable completion, will compile with some warnings about over/under full boxes which I solved with the following modifications:

\documentclass{article}
\usepackage[textwidth=17cm]{geometry}% just for the example
\usepackage{multirow}

\begin{document}

\noindent\begin{tabular}{ | p{2cm} | p{4cm} | p{4cm} | p{4cm} | }
\hline
Název & \multicolumn{3}{ l|}{vypsatZapojeniResiteluDoProjektu}\\
\hline
Popis & \multicolumn{3}{ l|}{Vedouci pracovnik}  \vline \\
\hline
Priorita & 1 = vysoka & \textbf{Frekvence} & nekolikrat denne \\
\hline
\parbox[t]{2cm}{Vstupni\\ podminky} & \multicolumn{3}{p{12cm}|}{sdgsdgsg.}\\
\hline
\parbox[t]{2cm}{Vystupni\\ podminky} & \multicolumn{3}{p{12cm}|}{sdgsdgsga.}\\
\hline
Uzivatele & \multicolumn{3}{p{12cm}|}{sdgsdgsdg.}\\
\hline
\multirow{3}{2cm}{Zakladni\\ posloupnost} & \multicolumn{3}{p{12cm}|}{sgdsgsdg.}\\
\cline{2-4}
& \multicolumn{3}{p{12cm}|}{sdgsdgg.}\\
\cline{2-4}
& \multicolumn{3}{p{12cm}}{sgsdggdsg.} \vline \\
\hline
\end{tabular}

\end{document}

And here's the result:

enter image description here

I would like to suggest you, however, some changes to your table, using the features provided by the booktabs package:

\documentclass{article}
\usepackage[textwidth=16cm]{geometry}% just for the example
\usepackage{multirow}
\usepackage{booktabs}

\begin{document}

\noindent\begin{tabular}{@{}p{2cm}p{4cm}@{}p{4cm}@{}p{4cm}@{}}
\toprule
Název & \multicolumn{3}{ l }{vypsatZapojeniResiteluDoProjektu} \\
\midrule
Popis & \multicolumn{3}{ l }{Vedouci pracovnik}  \\
\midrule
Priorita & 1 = vysoka & \textbf{Frekvence} & nekolikrat denne \\
\midrule
\parbox[t]{2cm}{Vstupni\\ podminky} & \multicolumn{3}{p{12cm}}{sdgsdgsg.} \\
\midrule
\parbox[t]{2cm}{Vystupni\\  podminky} & \multicolumn{3}{p{12cm}}{sdgsdgsga.} \\
\midrule
Uzivatele & \multicolumn{3}{p{12cm}}{sdgsdgsdg.} \\
\midrule
\multirow{4}{2cm}{Zakladni\\ posloupnost} & \multicolumn{3}{p{12cm}}{sgdsgsdg.} \\
\cmidrule{2-4}
& \multicolumn{3}{p{12cm}}{sdgsdgg.} \\
\cmidrule{2-4}
& \multicolumn{3}{p{12cm}}{sgsdggdsg.} \\
\bottomrule
\end{tabular}

\end{document}

Now the table has the following aspect:

enter image description here

As you can see, the spacing between the horizontal lines and the cell contents has improved; also, the absence of vertical rules improves the readability (vertical rules are superfluous). Depending on the actual content of the cells, it would even be possible to remove more lines; refer to the package documentation to see additional features provided by booktabs.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.