1

I'm having an issue with this code

\begin{table}[H]
\begin{longtable}{| p{4cm} | p{2cm} | p{7cm} |}
    \hline
    \multicolumn{3}{| p{14cm} |}{\cellcolor{lightgray} \centering \textbf{Iniciar sesión}}
    \\\hline
    \cellcolor{lightgray} \centering \textbf{Descripción} & \multicolumn{2}{| p{9cm} |}{}
    \\\hline
    \cellcolor{lightgray} \centering \textbf{Actor} & \multicolumn{2}{| p{9cm} |}{}
    \\\hline
    \cellcolor{lightgray} \centering \textbf{Pre-condición} & \multicolumn{2}{| p{9cm} |}{}
    \\\hline
    \cellcolor{lightgray} & \centering \textbf{Paso} & \textbf{}
    \\\cline{2-3}
    \cellcolor{lightgray} \centering \multirow{-2}{*}{\textbf{Secuencia normal}} & \centering \textbf{1.} & 
    \\\hline
    \cellcolor{lightgray} \centering \textbf{Post-condición} & \multicolumn{2}{| p{9cm} |}{}
    \\\hline
    \cellcolor{lightgray} \centering \textbf{Excepciones} & \multicolumn{2}{| p{9cm} |}{}
    \\\hline
\end{longtable}
\end{table}

Table

As shown the vertical line of "Secuencia normal" box is thiner than the other ones that are above and below, does anyone know how to fix this?

3
  • you can not have a longtable inside a table delete the outer environment Commented Jun 24, 2015 at 14:00
  • delete the | on the left pf every column except the first (otherwise you get two touching rules: to the right of one column and l;eft of the next) Commented Jun 24, 2015 at 14:01
  • You may simplify you code, replacing the tabular preamble: {| p{4cm} | p{2cm} | p{7cm} |} with {|>{\columncolor{lightgray}} p{4cm} | p{2cm} | p{7cm} |}, and removing \cellcolor{lightgray} from all rows except the first.
    – Bernard
    Commented Jun 24, 2015 at 16:32

1 Answer 1

2

You were doubling some vertical rules inside the \multicolumns and this was giving you thicker rules:

\documentclass{article}
\usepackage[table]{xcolor}
\usepackage{multirow}
\usepackage{longtable}
\usepackage{array}

\begin{document}

\begin{longtable}{| >{\centering}p{4cm} | p{2cm} | p{7cm} |}
    \hline
    \multicolumn{3}{| >{\centering}p{14cm} |}{\cellcolor{lightgray} \textbf{Iniciar sesión}}
    \\\hline
    \cellcolor{lightgray}  \textbf{Descripción} & \multicolumn{2}{ p{9cm} |}{}
    \\\hline
    \cellcolor{lightgray} \textbf{Actor} & \multicolumn{2}{ p{9cm} |}{}
    \\\hline
    \cellcolor{lightgray} \textbf{Pre-condición} & \multicolumn{2}{ p{9cm} |}{}
    \\\hline
    \cellcolor{lightgray} & \textbf{Paso} & \textbf{}
    \\\cline{2-3}
    \cellcolor{lightgray} \centering \multirow{-2}{*}{\textbf{Secuencia normal}} & \centering \textbf{1.} & 
    \\\hline
    \cellcolor{lightgray}  \textbf{Post-condición} & \multicolumn{2}{ p{9cm} |}{}
    \\\hline
    \cellcolor{lightgray} \textbf{Excepciones} & \multicolumn{2}{ p{9cm} |}{}
    \\\hline
\end{longtable}

\end{document}

enter image description here

Remarks

  • Don't use longtable inside table.

  • I used the >{...} syntax from the array package to add \centering to the first column.

  • The booktabs package can give you better looking tbales (with no vertical rules).

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .