I have to make a table that is quite long so I use the longtable
package. The following code gives me the Something's wrong--perhaps a missing \item
error for the \begin{center}
line.
\documentclass[a4paper, 12pt]{article}
\usepackage[frenchb]{babel}
\usepackage[T1]{fontenc}
\usepackage{float}
\usepackage{caption}
\usepackage{xltabular}
\usepackage{longtable}
\usepackage{hyperref}
\begin{longtable}[H]{c|c|c|c|c|c}
\begin{center}
\hline
\textbf{ID projet} & \textbf{Nom du projet} & \textbf{Complexité} & \textbf{Disponibilité des données} & \textbf{Coût} & \textbf{Impact} \\
\hline
cell & cell & cell & cell & cell & cell \\
\hline
cell & cell & cell & cell & cell &cell \\
\hline
cell & cell & cell & cell & cell \\
\hline
cell & cell & cell & cell & cell & cell \\
\hline
cell & cell & cell& cell & cell & cell \\
\hline
cell & cell & cell & cell & cell & cell \\
\hline
cell & cell & cell & cell & cell & cell \\
\hline
\end{center}
\end{longtable}
I don't know if it's related but the first \hline
gives me the Misplaced \noalign
error and the \textbf
line gives me the Misplaced \omit
error.
You must not hide the content of your longtable inside a center
environment. If you want the table to be centred, you can use the optional [c]
argument. However this won't make a visual difference because your table does not fit within the available text width.
\documentclass[a4paper, 12pt]{article}
\usepackage[french]{babel}
\usepackage[T1]{fontenc}
\usepackage{float}
\usepackage{caption}
\usepackage{xltabular}
\usepackage{longtable}
\usepackage{hyperref}
\begin{document}
\begin{longtable}[c]{c|c|c|c|c|c}
\hline
\textbf{ID projet} & \textbf{Nom du projet} & \textbf{Complexité} & \textbf{Disponibilité des données} & \textbf{Coût} & \textbf{Impact} \\
\hline
cell & cell & cell & cell & cell & cell \\
\hline
cell & cell & cell & cell & cell &cell \\
\hline
cell & cell & cell & cell & cell \\
\hline
cell & cell & cell & cell & cell & cell \\
\hline
cell & cell & cell& cell & cell & cell \\
\hline
cell & cell & cell & cell & cell & cell \\
\hline
cell & cell & cell & cell & cell & cell \\
\hline
\end{longtable}
\end{document}