I'm getting a conflict between titlesec and colortbl that I can't seem to fix.
The minimal working example is below. As soon as I put a \section in, pdflatex errors with ! Missing number, treated as zero.
<to be read again>
}
l.9 \section{First Section}
In order to make it work I have to either:
- Not use
sections(obviously not feasible) - Not use my section style (but the journal requires it!)
- Not use coloured tables (but I want to!)
Can you help me make this document with my section heading style included and coloured cells in the table?
Thanks, Sven.
Edited below to include the full set of titlesec and titleformat command I use
\documentclass{article}
\usepackage{colortbl}
\usepackage{textcase}
\usepackage[explicit]{titlesec}
\titleformat{\section}
{\normalfont\bfseries\filcenter}{\thesection}{1em}{\MakeTextUppercase{#1}}
\titlespacing*{\subsection}{0pt}{1em}{0em}
\titlespacing*{\subsubsection}{0pt}{1em}{0em}
\titleformat*{\subsection}{\bfseries}
\titleformat*{\subsubsection}{\bfseries}
\begin{document}
\section{First Section}
\subsection{a sub Sec}
If I define a section (by uncommenting above)... it fails.
\subsubsection{Again}
If I then do one of:
\begin{itemize}
\item{Remove the table (and colortbl package}
\item{Remove my section formatting above}
\end{itemize}
... my doc will compile, but I won't have the style I want.
\begin{table}[!ht]
\begin{tabular}{ |c|l|l } \hline
\rowcolor{red} A & B & C \\ \hline
Hello World & other & \cellcolor{blue}stuff\\ \hline
\end{tabular}
\caption{How can I get colored table cells and keep my section heading format?}
\end{table}
\end{document}
For reference in case of package conflicts, here is the list of other packages I'm using in my complete document (but don't seem to affect this particular bug):
\usepackage[left=18mm,top=20mm,right=18mm,bottom=25mm,includehead,nofoot,headheight=0pt,headsep=5mm]{geometry}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{dcolumn}
\usepackage{hyperref}
\usepackage{tabularx}
\usepackage{subfig}
\usepackage{url}
\usepackage[capitalise,noabbrev]{cleveref}
\usepackage{epstopdf}
\usepackage[absolute]{textpos}



hyperrefas last package ... – Kurt Mar 15 at 2:46\MakeUppercasein\titleformat*. I get no error if I remove it. – Jubobs Mar 15 at 2:48colortblpackage? Because my document would be created without error even with theMakeUppercaseissue you identified, as long as it didn't havecolortbltoo... – sven Mar 15 at 3:39