Graphics, Figures & Tablesproblem using tabu package and hhline

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
mslider
Posts: 5
Joined: Sun Sep 08, 2024 7:09 pm

problem using tabu package and hhline

Post by mslider »

--
Hi all,

i try to make a table like i send you here in attachement but my code failed, it seems to be an incompatibility
between tabu package and hhline.
My code:

Code: Select all

\definecolor{SGblue}{RGB}{0, 164, 196}
\definecolor{SGblue}{RGB}{0, 164, 196}
{
\setlength\arrayrulewidth{0.8pt}
\renewcommand{\arraystretch}{1.5} % Default value: 1
\begin{table}[htbp]
\centering
\begin{tabu} to \textwidth {|X[3,c,m]|X[1,c,m]|X[1,c,m]|X[1,c,m]|X[1,c,m]|X[1,c,m]|X[1,c,m]|X[1,c,m]|X[1,c,m]|X[1,c,m]|X[1,c,m]|X[1,c,m]|X[1,c,m]|}
\rowcolor{SGblue}
\arrayrulecolor{white}
{} & \multicolumn{12}{c}{\large\bf\textcolor{white}{DIFFERENCIATED STAGE}} \\
\hhline{ ------------}
\rowcolor{SGblue}
%{} & \multicolumn{4}{|c!{\color{white}\vline}}{\large\bf\textcolor{white}{ECTODERM}} & \multicolumn{4}{|c!{\color{white}\vline}}{\large\bf\textcolor{white}{MESODERM}} & \multicolumn{4}{|c|}{\large\bf\textcolor{white}{ENDODERM}}\\
{} & \multicolumn{4}{c|}{\large\bf\textcolor{white}{ECTODERM}} & \multicolumn{4}{c|}{\large\bf\textcolor{white}{MESODERM}} & \multicolumn{4}{c}{\large\bf\textcolor{white}{ENDODERM}} \\
\rowcolor{SGblue}
\hhline{ ------------}
\multirow{-2}{*}{\textcolor{white}{\bf\textcolor{white}{\rule{0pt}{1em}Samples name\rule[-1em]{0pt}{1em}}}} & \bf\textcolor{white}{EN1} & \bf\textcolor{white}{MAP2} &  \bf\textcolor{white}{NEFL} & \bf\textcolor{white}{PAX6} & \bf\textcolor{white}{AFP} &
\bf\textcolor{white}{FOXA2} & \bf\textcolor{white}{SOX17} & \bf\textcolor{white}{SST} & \bf\textcolor{white}{CDH5} & \bf\textcolor{white}{HAND1} & \bf\textcolor{white}{MYOG} & \bf\textcolor{white}{TBXT} \\
\arrayrulecolor{SGblue}
\textbf{EB14} & \large\textbf{+} & \large\textbf{NS} & \large\textbf{+} & \large\textbf{+} & \large\textbf{+} & \large\textbf{NS} & \large\textbf{+} & \large\textbf{+} & \large\textbf{+} & \large\textbf{NS} & \large\textbf{+} & \large\textbf{+} \\
\hline
\textbf{HF11} & \large\textbf{+} & \large\textbf{NS} & \large\textbf{+} & \large\textbf{+} & \large\textbf{+} & \large\textbf{NS} & \large\textbf{+} & \large\textbf{+} & \large\textbf{+} & \large\textbf{NS} & \large\textbf{+} & \large\textbf{+} \\
\hline
\multicolumn{13}{|c|}{\textbf{\large{(NS)}} indicates non-significant expression, \textbf{\large{(+)}} represents overexpression, and \textbf{\large{(-)}} denotes underexpression.}  \\
\hline
\end{tabu}
\end{table}
}
table.png
table.png (14.51 KiB) Viewed 7451 times
If someone can help me ....
Thank you --

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX books
User avatar
Stefan Kottwitz
Site Admin
Posts: 10308
Joined: Mon Mar 10, 2008 9:44 pm

problem using tabu package and hhline

Post by Stefan Kottwitz »

Hi,

welcome to the forum!

Put the \rowcolor command after the \hhline command instead of before it.

Stefan
LaTeX.org admin
mslider
Posts: 5
Joined: Sun Sep 08, 2024 7:09 pm

problem using tabu package and hhline

Post by mslider »

--
no change (see attachment),
i need to have first column of table not underlined.
table.png
table.png (39.85 KiB) Viewed 7425 times
User avatar
Stefan Kottwitz
Site Admin
Posts: 10308
Joined: Mon Mar 10, 2008 9:44 pm

problem using tabu package and hhline

Post by Stefan Kottwitz »

Use a tilde to skip a column with \hhline:

Code: Select all

\hhline{~------------}
Stefan
LaTeX.org admin
mslider
Posts: 5
Joined: Sun Sep 08, 2024 7:09 pm

problem using tabu package and hhline

Post by mslider »

it seems to work with \hhline{~----}
but some vertical white lines are added at the beginnig and end of row (see attachement)
table.png
table.png (37.04 KiB) Viewed 7405 times
User avatar
Stefan Kottwitz
Site Admin
Posts: 10308
Joined: Mon Mar 10, 2008 9:44 pm

problem using tabu package and hhline

Post by Stefan Kottwitz »

I may verify this if you post a fully compilable example (Infominimal working example). I tried the code snippet in the first post, added missing packages etc. but it didn't show it like your screenshots, for example no row color when I tested it.

Stefan
LaTeX.org admin
mslider
Posts: 5
Joined: Sun Sep 08, 2024 7:09 pm

problem using tabu package and hhline

Post by mslider »

below my entire code. It compiles fine with xelatex on windows.

Code: Select all

\documentclass[6pt]{article}
\usepackage[left=0.5in,right=0.5in,top=0.15in,bottom=2cm]{geometry}
\usepackage[utf8]{inputenc}

\usepackage{multicol}
\usepackage{multirow}
\usepackage{graphicx}
\usepackage{adjustbox}

\usepackage{float}
\usepackage{hhline}
\usepackage[table]{xcolor}
\usepackage{colortbl}

\usepackage{wallpaper}

\usepackage{background}
\usepackage{fontspec}
\setmainfont{Calibri}

\usepackage{arydshln} % for dotted vertical lines

\definecolor{Gray}{gray}{0.85}
\definecolor{Black}{gray}{0}
\definecolor{SGblue}{HTML}{00A4C4}
\definecolor{GrayTxt}{HTML}{5A5A5A}

\usepackage{pifont}

\usepackage{tabularx}
\usepackage{tabu}

  \newcolumntype{L}{>{\raggedright\arraybackslash}X}
	\newcolumntype{C}{>{\columncolor{white}\centering\let\newline\\\arraybackslash}X}
  \newcolumntype{T}{>{\columncolor{white}\centering\let\newline\\\arraybackslash}p{1.5cm}}
  \renewcommand\tabularxcolumn[1]{m{#1}}% for vertical centering text in X column
  \newcommand{\bigcell}[2]{\setlength\arrayrulewidth{0.8pt}\arrayrulecolor{SGblue}\begin{tabular}{@{}#1@{}}#2\end{tabular}}

  \newcommand\indentcode{\hspace*{-2cm}}

\usepackage{ragged2e}

\title{REPORT EXAMPLE}

\newcolumntype{b}{X}
\newcolumntype{s}{>{\hsize=.2\hsize}X}
\newcommand{\localtextbulletone}{\textcolor{gray}{\raisebox{.45ex}{\rule{.6ex}{.6ex}}}}
\renewcommand{\labelitemi}{\localtextbulletone}

\begin{document}

\vspace{0.5em}


{
\setlength\arrayrulewidth{0.8pt}\arrayrulecolor{SGblue}
\renewcommand{\arraystretch}{1.5} % Default value: 1
\begin{table}[htbp]
    \centering
    %\begin{tabu} to \textwidth {|C[2]|C|C|C|C|C| }
        \begin{tabu} to \textwidth {|X[2,c,m]|X[1,c,m]|X[1,c,m]|X[1,c,m]|X[1,c,m]|}
        \rowcolor{SGblue}
        \arrayrulecolor{white}
   {} & \multicolumn{4}{c}{\indentcode{\large\bf\textcolor{white}{UNDIFFERENCIATED STAGE}}} \\
   \hhline{~----}
              \rowcolor{SGblue}
       \multirow{-2}{*}{\textcolor{white}{\bf\textcolor{white}{\rule{0pt}{2em}Samples name\rule[-1em]{0pt}{2em}}}} & \bf\textcolor{white}{NANOG} & \bf\textcolor{white}{POU5F1} &  \bf\textcolor{white}{SOX2} & \bf\textcolor{white}{DNMT3B} \\
        \arrayrulecolor{SGblue}
    \hline
   \textbf{P19} & \large\textbf{+} & \large\textbf{+} & \large\textbf{+} & \large\textbf{+} \\
  \hline
  \textbf{P25} & \large\textbf{+} & \large\textbf{+} & \large\textbf{+} & \large\textbf{+} \\
  \hline
  \textbf{P28} & \large\textbf{+} & \large\textbf{+} & \large\textbf{+} & \large\textbf{+} \\
  \hline
  \multicolumn{5}{|c|}{\textbf{\large{(NS)}} indicates non-significant expression, \textbf{\large{(+)}} represents overexpression, and \textbf{\large{(-)}} denotes underexpression.}  \\
  \hline
 \end{tabu}
\end{table}
}

\end{document}
User avatar
Stefan Kottwitz
Site Admin
Posts: 10308
Joined: Mon Mar 10, 2008 9:44 pm

problem using tabu package and hhline

Post by Stefan Kottwitz »

mslider wrote:it seems to work with \hhline{~----}
While ~ means no line, that "line" can be seen because it's the background color then... it may then be done with forcing to draw it in the cell color, like this:

Code: Select all

\hhline{>{\arrayrulecolor{SGblue}}->{\arrayrulecolor{white}}----}
mslider wrote:but some vertical white lines are added at the beginning and end of row (see attachement)table.png
These are the normal cell borders, it's just because of \arrayrulecolor{white} before.

That becomes very complicated with such design ideas that are very different from the algorithmic table layout by LaTeX. I would choose a simpler design because content matters, though also a good style is important, but a solid one. If needed, I would draw such complicated tables in TikZ, use a matrix for positioning, colored matrix nodes, and draw the lines between rows and columns manually with regular TikZ commands.

Stefan
LaTeX.org admin
mslider
Posts: 5
Joined: Sun Sep 08, 2024 7:09 pm

problem using tabu package and hhline

Post by mslider »

i don't know TikZ, do you think it would be possible to do this simply using tabularx ?
Post Reply