0

I can not get the border of this minimal example to look correct, the \colorcell command is overwriting the lines:

\documentclass[11pt]{article}
\usepackage{xcolor}
\usepackage[margin=.9in]{geometry}
\usepackage{multirow}
\usepackage{colortbl}
\usepackage{hhline}

\pagestyle{plain}
\setlength\parindent{0pt}

\begin{document}
\setlength{\arrayrulewidth}{.8pt}


\begin{tabular}{ | c | c | c | c | } 
\hhline{----}
\cellcolor{red!30!white}\textbf{} & 
\cellcolor{red!30!white}\textbf{} &\multicolumn{1}{|c|}{\cellcolor{red!30!white}\textbf{Text}} & \multicolumn{1}{|c|}{\cellcolor{red!30!white}\textbf{Text}} \\ 
\hhline{|~|~|~|~|}
\multirow{-2}{*}{\cellcolor{red!30!white}\textbf{Text}} & 
\multirow{-2}{*}{\cellcolor{red!30!white}\textbf{Text}} 
&\multicolumn{1}{|c|}{\cellcolor{red!30!white}\textbf{Text}} 
& \multicolumn{1}{|c|}{\cellcolor{red!30!white}\textbf{Text}} \\ 
\hhline{----}
Text & &\begin{minipage}{.6\textwidth}
\begin{itemize} \itemsep-0.4em
\vspace{1mm}
\item Text
\item Text
\vspace{1mm}
\end{itemize}
\end{minipage} &\\
\hhline{----}
Text & &\begin{minipage}{.6\textwidth}
\begin{itemize} \itemsep-0.4em
\vspace{1mm}
\item Text
\item Text
\vspace{1mm}
\end{itemize}
\end{minipage} &\\
\end{tabular}

\end{document}

This outputs:

enter image description here

Advise how to correct.

  • I don't understand your problem. I can see you have two double vertical rules limiting the third column, that' all. Can you explain more? – Bernard Jul 26 '19 at 23:23
  • @Bernard, the problem is achieving uniform thickness in the colorcell areas. – MathScholar Jul 26 '19 at 23:27
1

Here is a solution, using the makecell package, which allows for line breaks in standard cells, and enumitem, which makes it easy to set parameters for lists, and define new list tpypes. So I defined a tabitemize list, with parameters adapted to lists in tabulars. Last change: the 3rd column is now p{0.6\textwidth}, so you have no more to use minipages inside cells. Note that loading xcolor with option table automatically loads colortbl and defines a new command: \rowcolors.

\documentclass[11pt]{article}
\usepackage[table]{xcolor}
\usepackage[margin=.9in]{geometry}
\usepackage{multirow}
\usepackage{hhline}
\usepackage{makecell}
\pagestyle{plain}
\setlength\parindent{0pt}

\makeatletter
\newcommand*{\compress}{\@minipagetrue}
\makeatother
\usepackage{enumitem}
 \newlist{tabitemize}{itemize}{1}
\setlist[tabitemize]{wide=0pt, label=\textbullet, leftmargin=*, nosep, after=\vspace*{-\baselineskip}}

\begin{document}

\setlength{\arrayrulewidth}{.8pt}
\renewcommand{\cellset}{\bfseries}
\setlength{\extrarowheight}{3pt}
\begin{tabular}{ | c | c |>{\arraybackslash\compress}p{0.6\textwidth} | c | }%
\hhline{----}
\rowcolor{red!30!white}\makecell{Text} & \makecell{Text} &\makecell{Text\\Text}& \makecell{Text\\Text} \\
\hhline{----}
Text & &
\begin{tabitemize}
\item Text
\item Text
\end{tabitemize}
 &\\
\hhline{----}
Text & &
\begin{tabitemize}
\item Text
\item Text
\end{tabitemize}
 &\\
\end{tabular}

\end{document} 

enter image description here

| improve this answer | |
  • Of course there other solutions. But I also wanted to simplify your code, avoiding the use of multirow in particular, which I felt unnecessary here. – Bernard Jul 27 '19 at 0:51
  • yes I notice the borders are still temperamental. There are other packages which do tables as well – MathScholar Jul 27 '19 at 13:15
  • With the code I propose, the cells borders have uniform thickness. Your problem with borders was dues to wrong specifications of \multicolumn. I don't use this command any more. – Bernard Jul 27 '19 at 13:43
  • +1! for use of \cellset. in definition of the tabitemize option leftmargin=* overwrite wide=0pt. which wane should be active? – Zarko Dec 24 '19 at 21:57
  • For me wide=0pt and leftmargin=*` are complementary: we have both the bullet at the very beginning of the cell, and the default hanging indent for the text of the item. Did I misunderstand how these parameters work? – Bernard Dec 24 '19 at 22:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.