0

I try to put the background of the first line in color. I try like the commented line but I have a compiled errors. I try with \tabuphantomline. But I didn't succeeded.

\documentclass[11pt]{report}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{microtype}
\usepackage[frenchb]{babel}
\usepackage{tabu}
\usepackage{colortbl}
\usepackage{tikzsymbols}

\begin{document}
\taburowcolors[2] 2{black!15 .. black!30}
\begin{tabu}{|X[5,l]|X[1,c]|}
  \hline
  % \multicolumn2{|{>\rowcolor{red}}l|}{\textbf{Général}} \\  \hline
  \multicolumn2{|l|}{\textbf{Général}} \\  \hline
  1 & \dSadey[1.5][red] \\ \hline
  \multicolumn2{|l|}{\textbf{Miroir}} \\ \hline
  d0  & \dSmiley[1.5][green] \\ \hline
  d1  & \dSmiley[1.5][green] \\ \hline
  d3  & \dSmiley[1.5][green] \\ \hline
  d7  & \dSmiley[1.5][green] \\ \hline
  d10 & \dSmiley[1.5][green] \\ \hline
  \multicolumn2{|l|}{\textbf{Système de fichier}} \\ \hline
  /            & \dSmiley[1.5][green]    \\ \hline
  /var         & \dSmiley[1.5][green]    \\ \hline
  /var/run     & \dSmiley[1.5][green]    \\ \hline
  /tmp         & \dSmiley[1.5][green]    \\ \hline
\end{tabu}
\end{document}

enter image description here

2

Voici. Unrelated, but frenchb should be loaded with the documentclass, and replaced with the option [french].

\documentclass[11pt, french]{report}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{microtype}
\usepackage{babel}
\usepackage{tabu}
\usepackage[table]{xcolor}
\usepackage{tikzsymbols}

\begin{document}

\taburowcolors[2] 2{black!15 .. black!30}
\begin{tabu}{|X[5,l]|X[1,c]|}
  \hline
 \multicolumn2{|>{\columncolor{red}}l|}{\textbf{Général}} \\ \hline
  1 & \dSadey[1.5][red] \\ \hline
  \multicolumn2{|l|}{\cellcolor{red}\textbf{Miroir}} \\ \hline
  d0 & \dSmiley[1.5][green] \\ \hline
  d1 & \dSmiley[1.5][green] \\ \hline
  d3 & \dSmiley[1.5][green] \\ \hline
  d7 & \dSmiley[1.5][green] \\ \hline
  d10 & \dSmiley[1.5][green] \\ \hline
  \multicolumn2{|l|}{\cellcolor{red}\textbf{Système de fichiers}} \\ \hline
  / & \dSmiley[1.5][green] \\ \hline
  /var & \dSmiley[1.5][green] \\ \hline
  /var/run & \dSmiley[1.5][green] \\ \hline
  /tmp & \dSmiley[1.5][green] \\ \hline
\end{tabu}

\end{document} 

enter image description here

  • But It doesn't work for the second multicolumn line : \multicolumn2{|>{\columncolor{red}}l|}{\textbf{Système de fichier}} \\ \hline – flav Oct 9 '17 at 14:25
  • 1
    You didn't ask it. Use \cellcolor (see the updated answer). – Bernard Oct 9 '17 at 14:32

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.