我想修复以下代码中的错误

我想修复以下代码中的错误
\documentclass[a4,CEJM,PDF]{cej}
\usepackage{layout}
\usepackage{lipsum}
\usepackage{enumerate}
\usepackage{comment}
\usepackage{array}
\usepackage{amsmath, amssymb, amscd}
\begin{document}
\def\Mc[#1]#2#3{\multicolumn{#1}{#2}{#3}}
\def\mc#1#2{\multicolumn{1}{#1}{#2}}
    \begin{table}[!h]
    \centering
    \begin{tabular}{|cc|cc|cc|cc|c}
    \cline{1-8}
              \mc{|c|}{3}  &&             &&                     &&                     & & 3     \\[6pt]\cline{1-1}
            & \mc{c|}{2}  && \mc{c|}{2}  && \mc{c|}{2}          && \mc{c|}{1}          & &       \cline{1-8}
              \mc{|c|}{1}  &&  \mc{c|}{3} && \mc{c|}{3}          &&                     & & 7     \\[6pt]\cline{1-1}\cline{3-3}\cline{5-5}
            & \mc{c|}{10} && \mc{c|}{8}  && \mc{c|}{5}          && \mc{c|}{4}          & &       \cline{1-8}
                          &&             && \mc{c|}{1}          && \mc{c|}{4}          & & 5     \\[6pt]\cline{5-5}\cline{7-7} 
            & \mc{c|}{7}  && \mc{c|}{6}  && \mc{c|}{6}          && \mc{c|}{8}          & &       \cline{1-8}
              \Mc[2]{c}{4} & \Mc[2]{c}{3} & \Mc[2]{c}{4}         & \Mc[2]{c}{4}        & &    
    \end{tabular}
    \end{table}
    \end{document}

我有以下错误

Extra alignment tab has been changed to \cr.
<template> ...ip \tabrightsep \relax \endtemplate 

l.198 ...|}{2}          && \mc{c|}{1}          & &
                                                         \cline{1-8}
? 
! Extra alignment tab has been changed to \cr.
<template> ...ip \tabrightsep \relax \endtemplate 

l.200 ...|}{5}          && \mc{c|}{4}          & &
                                                         \cline{1-8}
? 
! Extra alignment tab has been changed to \cr.
<template> ...ip \tabrightsep \relax \endtemplate 

l.202 ...|}{6}          && \mc{c|}{8}          & &
                                                         \cline{1-8}
? 
! Extra alignment tab has been changed to \cr.
<template> ...ip \tabrightsep \relax \endtemplate 

l.203 ...]{c}{4}         & \Mc[2]{c}{4}        & &

答案1

您的代码有很多错误,下面是更正后的代码:

\begin{tabular}{|cc|cc|cc|cc|c}
\cline{1-8}
          \mc{|c|}{3}  &&             &&                     &&                     & & 3     \\[6pt]\cline{1-1}
        & \mc{c|}{2}  && \mc{c|}{2}  && \mc{c|}{2}          &&
        \mc{c|}{1}          & \\      \cline{1-8}
          \mc{|c|}{1}  &&  \mc{c|}{3} && \mc{c|}{3}          &&                     & & 7     \\[6pt]\cline{1-1}\cline{3-3}\cline{5-5}
        & \mc{c|}{10} && \mc{c|}{8}  && \mc{c|}{5}          && \mc{c|}{4}          & \\       \cline{1-8}
                      &&             && \mc{c|}{1}          && \mc{c|}{4}          & & 5     \\[6pt]\cline{5-5}\cline{7-7} 
        & \mc{c|}{7}  && \mc{c|}{6}  && \mc{c|}{6}          && \mc{c|}{8}          & \\       \cline{1-8}
          \Mc[2]{c}{4} & \Mc[2]{c}{3} & \Mc[2]{c}{4}         & \Mc[2]{c}{4}        & \\    
\end{tabular}

相关内容