I am trying to have different tables in my report. Some of them I need to have the headers one color (black with white text) and different rowcolor (Table 1).

While others I need only the headers to be coloured and that to be centered.

I have added my current code to overleaf and adding an image to what I am trying to achieve.

enter image description here

Could someone help me with this?


Here you are. The cells contents were already centred, so there was nothing to do. Note hyperref should be loaded as the last package, with very few exceptions (cleveref is such an exception).


%** latex setup**%
\usepackage[export]{adjustbox} %for fitting the tables



\usepackage{tikz}            % For drawing stuff
\usepackage{glossaries}      % For abbrevations 
\usepackage{hyperref} %For adding hyperlinks

%** new commands**%

\title{Table Formating}


\section{Table 1}
    \caption{Table variant 1} \label{tb:1}
    \head{\#} & \head{Layer Name }& \head{Cooper Thickness} & \head{Description} \\ 
    1 & Top Solder Mask &  & Solder Resist \\ 
    2 & Top Layer & 1.4 mil &  \\ 

\section{Table Formating}

    \caption{Table 2} \label{tb:2}
    \multicolumn{2}{c}{\cellcolor{black!60}\head{TEMPERATURE SENSOR}} \\
    Sensor & ... \\ 
    Pressure sensor &  \\ 
    Name ... & ... \\ 
    Resolution & ...  \\ 
    Accelometer and Magnometer &  \\ 



enter image description here

  • The code doesn't produce the table you showed as table 2. With your code, table 2 still has striped rows. It will work if you insert the following after \begin{table}[!h]: \rowcolors{1}{white}{white} – jaspast Mar 9 at 21:37
  • @jaspast: Sorry, it was a clipboard accident. I copied the O.p.s code instead of mine. It's fixed (\rowcolors... just before \begin{tabular}. Thanks for pointing it! – Bernard Mar 9 at 21:39
  • Hi, about centering. I would like the TEMPERATURE SENSOR to take the whole row and be centered. That's what I meant. Is this possible ? – user3874252 Mar 9 at 21:41
  • Yes, it is. Please see my updated code. – Bernard Mar 9 at 22:01
  • Thank you very much @Bernard! – user3874252 Mar 9 at 23:20

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.