my code is as follows:
\begin{tabular}{|c |>{\centering}m{1.2 cm}|>{\centering}m{1.2 cm}|>{\centering}m{1.2 cm}|>{\centering}m{1.2 cm}|>{\centering}m{1.2 cm}|>{\centering}m{1.2 cm}|>{\centering}m{1.2 cm}|}
[29-32, 34-36] & & \Checkmark & & & & &\Checkmark \\
\hline
\end{tabular}
the error indicated is "! Misplaced \noalign. \hline -> \noalign"
However, if I change this code to:
\begin{tabular}{|c |>{\centering}m{1.2 cm}|>{\centering}m{1.2 cm}|>{\centering}m{1.2 cm}|>{\centering}m{1.2 cm}|>{\centering}m{1.2 cm}|>{\centering}m{1.2 cm}|>{\centering}m{1.2 cm}|}
[29-32, 34-36] & & \Checkmark & & & & &\\
\hline
\end{tabular}
or
\begin{tabular}{|c |>{\centering}m{1.2 cm}|>{\centering}m{1.2 cm}|>{\centering}m{1.2 cm}|>{\centering}m{1.2 cm}|>{\centering}m{1.2 cm}|>{\centering}m{1.2 cm}|m{1.2 cm}|} %the last column without centering horizontally
[29-32, 34-36] & & \Checkmark & & & & &\Checkmark \\
\hline
\end{tabular}
No error occurs.
Can you help me fix it? Besides, why is there a ">" in this command ">{\centering}" ?
General ⇒ latex table problem --about >{\centering}
-
- Posts: 2
- Joined: Thu Oct 09, 2008 6:28 am
latex table problem --about >{\centering}
Last edited by zhengyiqun08 on Fri Oct 10, 2008 3:55 am, edited 1 time in total.
NEW: TikZ book now 40% off at Amazon.com for a short time.

latex table problem --about >{\centering}
Hi zhengyiqun08,
The array package redefines \\ (the command to change line). To avoid the error that you are getting there are two options:
1) Instead of \\ you can use \tabularnewline, as the following example suggests:
2) Use \arraybackslash just after \centering:
You can find the answer to the question about > in the array package documentation (page 2). There you will also find information about the shortcut that I used in the declaration of the table format.
The array package redefines \\ (the command to change line). To avoid the error that you are getting there are two options:
1) Instead of \\ you can use \tabularnewline, as the following example suggests:
Code: Select all
\documentclass{article}
\usepackage{bbding}
\usepackage{array}
\begin{document}
\begin{tabular}{|c*{7}{|>{\centering}m{1.2 cm}}|}
[29-32, 34-36] & & \Checkmark & & & & & \Checkmark \tabularnewline
\hline
\end{tabular}
\end{document}
Code: Select all
\documentclass{article}
\usepackage{bbding}
\usepackage{array}
\begin{document}
\begin{tabular}{|c*{7}{|>{\centering\arraybackslash}m{1.2 cm}}|}
[29-32, 34-36] & & \Checkmark & & & & & \Checkmark \\
\hline
\end{tabular}
\end{document}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
-
- Posts: 2
- Joined: Thu Oct 09, 2008 6:28 am
Re: latex table problem --about >{\centering}
Thanks a lot, gmedina. Problem solved.