包“xcolor”的“表格”选项显示“@startpbox 的使用与其定义不匹配。”

包“xcolor”的“表格”选项显示“@startpbox 的使用与其定义不匹配。”

我在编译期间收到以下错误:“@startpbox 的使用与其定义不匹配。”

以下是代码:

\documentclass[a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[top=6mm,includehead,left=1.5cm,bottom=2cm,right=1.5cm,headsep=0.5cm]{geometry}
\usepackage[table]{xcolor}
\usepackage{tikz}
\usepackage{multicol} 
\usepackage{fancyhdr} 
\usepackage{graphicx}


\usepackage{csvsimple}

\usepackage{multirow}  

\usepackage{scalerel,amssymb}
\def\msquare{\mathord{\scalerel*{\Box}{gX}}}



\usepackage{tcolorbox}
\tcbuselibrary{many}
\usepackage{fancybox} % for ovalbox + fancybox.sty



%-----------    HEADER  AND  FOOTER      -----------------------------------------


\renewcommand{\footrulewidth}{1.2pt} % linha no footer
\renewcommand{\headrulewidth}{1.2pt}% linha no header 


\pagestyle{fancy} 

\fancypagestyle{firststyle}{%
  \renewcommand{\headrulewidth}{0pt}% Remove header rule
  \lhead{%
    \def\scale{0.6}%
    \def\roundc{\scale*0.1cm}% rc = 10% de sc
    \raisebox{-2\baselineskip}[0pt][0pt]{\begin{tikzpicture}[scale=\scale]
      \definecolor{tempcolor}{RGB}{200,25,30}
      \filldraw[tempcolor][rounded corners=\roundc] (2cm,0cm) rectangle (1.2cm,-0.5cm);
      \filldraw[tempcolor][rounded corners=\roundc] (2cm,-0.6cm) rectangle (1.1cm,-1.1cm);
      \filldraw[tempcolor][rounded corners=\roundc] (2cm,-0.6cm) rectangle (1.5cm,-1.1cm);
      \filldraw[tempcolor][rounded corners=\roundc] (1.7cm,-1.2cm) rectangle (1.2cm,-1.7cm);
      \filldraw[tempcolor][rounded corners=\roundc] (0.6cm,-1.2cm) rectangle (1.1cm,-1.7cm);
      \filldraw[tempcolor][rounded corners=\roundc] (1.6cm,-1.2cm) rectangle (1.8cm,-1.7cm);
      \filldraw[tempcolor][rounded corners=\roundc] (1.7cm,-1.8cm) rectangle (1.2cm,-2.3cm);
      \node[scale=\scale,fill=white] at (5.92,-0.85) {\resizebox{6.7cm}{0.5cm}{\sffamily \textbf{ESCOLA}}};
      \node[scale=\scale,fill=white] at (4.52,-1.55) {\resizebox{5cm}{0.5cm}{\sffamily {Construindo o Futuro}}};
    \end{tikzpicture}}
  }
  \chead{\raisebox{-2\baselineskip}[0pt][0pt]{\rule[-2.5\baselineskip]{\linewidth}{1.2pt}}}
  \rhead{\raisebox{-2\baselineskip}[0pt][0pt]{\begin{tabular}{@{}r@{}}
    \tikz \node at (0,0) {\textbf{Final Exam}};\\ 
    \tikz[baseline]{\node[anchor=base, draw=black, thick, minimum width=8.5cm,
    minimum height=7mm,rounded corners, yshift=-2mm,label={[fill=white,label
    distance=-2mm,inner xsep=2pt]90:{\ttfamily Name}:}] {Teste};}   
    \tikz[baseline]{\node[anchor=base, draw=black, thick, minimum width=2cm, minimum height=7mm,rounded corners, yshift=-2mm,label={[fill=white,label distance=-2mm,inner xsep=2pt]90:{\ttfamily Turma}:}] {\phantom{\ttfamily 15,0}};}   
    \tikz[baseline]{\node[anchor=base, draw=black, thick, minimum width=1.5cm, minimum height=7mm,rounded corners, yshift=-2mm,label={[fill=white,label distance=-2mm,inner xsep=2pt]90:{\ttfamily Valor}:}] {\ttfamily 15,0};} 
    \tikz[baseline]{\node[anchor=base, draw=black, thick, minimum width=1.5cm, minimum height=7mm,rounded corners, yshift=-2mm,label={[fill=white,label distance=-2mm,inner xsep=2pt]90:{\ttfamily Nota}:}] {\phantom{\ttfamily 15,0}};}
    \end{tabular}}
  }
  \lfoot{\ttfamily Prof.\ Marcos}
  \rfoot{\ttfamily \today}
}

\AtBeginDocument{
  \thispagestyle{firststyle}
  \vspace*{2\baselineskip}
}


%-----------    HEADER  AND  FOOTER      -----------------------------------------




\usepackage{filecontents}
\begin{filecontents*}{students.csv}
name
Disco Dingo
Cosmic Cuttlefish
Bionic Beaver
\end{filecontents*}





\begin{document}


\def\obfmat{
\begin{center}
\tcbset{
        enhanced,
        colback=white,%red!5!white,
        boxrule=0.5pt,
        colframe=black!75!white,%red!75!black,
        fonttitle=\bfseries
       }
\begin{tcolorbox}[title={\sffamily\center TITLE BOX}, %
                   width=.95\linewidth, lifted shadow={1mm}{-2mm}{3mm}{0.1mm}%, halign=left,
                  {black!50!white}, boxsep=0mm, arc=3mm]
\vspace{1pt}
{
TEXT 
}
\end{tcolorbox}
\end{center}
}





\obfmat

  \rowcolors{4}{white}{gray!15}
\section*{Class 1}
    {
    \begin{tabular}{c|c|c}%
   {\bfseries Name} & I will do &  When
    \csvreader[head to column names,
    ]{students.csv}{}% use head of csv as column names
    {\\ \hline  \name   & Yes $\msquare$ \quad No $\msquare$ &  }\\
    \hline
    \end{tabular}
    }


\newpage 
\thispagestyle{firststyle}
  \vspace*{2\baselineskip}
  \vspace*{0.15cm} 


\obfmat

\rowcolors{4}{white}{gray!15}

\section*{Class 2}
    {
    \begin{tabular}{c|c|c}%
   {\bfseries Name} & I will do &  When
    \csvreader[head to column names,
    ]{students.csv}{}% use head of csv as column names
    {\\ \hline  \name   & Yes $\msquare$ \quad No $\msquare$ &  }\\
    \hline
    \end{tabular}
    }

\end{document}

任何帮助都将受到赞赏。

答案1

我同意@moewe的评论。它可能会解决你的问题。

不过,我冒昧地提供了一些题外的建议(请参阅下面的 MWE):

  • 在 s 中为节点和路径定义通用样式是明智的tikzpicture
  • \rowcolors{4}{white}{gray!15}最好与表格分组,否则会在文档中产生意外的颜色(例如在页眉中)。
  • 最好def使用 LaTeX 宏\newcommand(它会检查是否存在同名的命令)。
  • 对于每个部分后面的名称,写一个新命令是明智的,例如\newcommand\Names{....}
  • tcolorbox加载tikzxcolor包,因此您无需再次加载它们。要使table选项在中可用xcolor,请将其添加table到文档类选项中。
  • 为了获得更好的firststyle标题样式,我建议重写geometry包设置(参见下面的 MWE)。
  • 为了使tikz代码更短,我会使用两个 TikZ 库:chainspositioning

在此处输入图片描述

在此处输入图片描述

\documentclass[a4paper,table]{article}
\usepackage[utf8]{inputenc}
\usepackage[top=5.5\baselineskip,
            headheight=5\baselineskip,%includehead,
            left=1.5cm,bottom=2cm,right=1.5cm,
            headsep=3mm]{geometry}
%\usepackage[table]{xcolor}
%\usepackage{tikz}
\usepackage{multicol}
\usepackage{fancyhdr}
\usepackage{graphicx}
\usepackage{csvsimple}
\usepackage{multirow}
\usepackage{scalerel,amssymb}
\def\msquare{\mathord{\scalerel*{\Box}{gX}}}

\usepackage{tcolorbox}
\tcbuselibrary{many}
\usetikzlibrary{chains,
                positioning}
\tikzset{baseline,
     node distance = 1mm,
       start chain = going right,
   box/.style args = {#1/#2}{draw, thick, rounded corners,
                      minimum width=#1, minimum height=9mm,
                      outer sep=0pt,
                      label=above:{#2:},
                      on chain, anchor=west},
every label/.style = {label distance=-2mm,
                      fill= white, inner xsep=2pt, font=\ttfamily}
        }
%-------------- HEADER  AND  FOOTER ----------------------------------
\renewcommand{\footrulewidth}{1.2pt} % linha no footer
\renewcommand{\headrulewidth}{1.2pt} % linha no header
\pagestyle{fancy}
\fancypagestyle{firststyle}%
    {\renewcommand{\headrulewidth}{0pt}% Remove header rule
  \lhead{%
    \def\scale{0.6}%
    \def\roundc{\scale*0.1cm}% rc = 10% de sc
    \begin{tikzpicture}[scale=\scale,
    every path/.style = {tempcolor,rounded corners=\roundc},
    every node/.style = {scale=\scale,fill=white,font=\sffamily}
                        ]
      \definecolor{tempcolor}{RGB}{200,25,30}
      \filldraw (2cm,0cm) rectangle (1.2cm,-0.5cm);
      \filldraw (2cm,-0.6cm) rectangle (1.1cm,-1.1cm);
      \filldraw (1.7cm,-1.2cm) rectangle (1.2cm,-1.7cm);
      \filldraw (0.6cm,-1.2cm) rectangle (1.1cm,-1.7cm);
      \filldraw (1.6cm,-1.2cm) rectangle (1.8cm,-1.7cm);
      \filldraw (1.7cm,-1.8cm) rectangle (1.2cm,-2.3cm);
      \node at (5.92,-0.85) {\resizebox{6.7cm}{0.5cm}{\textbf{ESCOLA}}};
      \node at (4.52,-1.55) {\resizebox{5cm}{0.5cm}{Construindo o Futuro}};
    \end{tikzpicture}
        }
  \chead{\rule[-8\baselineskip]{\linewidth}{1.2pt}}
  \rhead{\raisebox{-5.5\baselineskip}{%
    \begin{tabular}{@{} r @{}}
    \textbf{Final Exam}           \\
   \begin{tikzpicture}
    \node[box=8.5cm/Name]   {Teste};
    \node[box=2.0cm/Turma]  {15,0};
    \node[box=1.5cm/Valor]  {15,0};
    \node[box=1.5cm/Nota]  {15,0};
      \end{tikzpicture}%
    \end{tabular}}
        }
  \lfoot{\ttfamily Prof.\ Marcos}
  \rfoot{\ttfamily \today}
}

\AtBeginDocument{
  \thispagestyle{firststyle}
  \vspace*{2\baselineskip}
                }
 %-------------- HEADER  AND  FOOTER ----------------------------------

\newcommand\obfmat{\begin{center}
\tcbset{
        enhanced,
        colback=white,%red!5!white,
        boxrule=0.5pt,
        colframe=black!75!white,%red!75!black,
        fonttitle=\bfseries
       }
\begin{tcolorbox}[title={\sffamily\center TITLE BOX}, %
                  width=.95\linewidth,
                  lifted shadow={1mm}{-2mm}{3mm}{0.1mm}%, halign=left,
                                {black!50!white}, boxsep=1pt, arc=3mm]
{TEXT}
\end{tcolorbox}
            \end{center}
}
\newcommand\Names{{
\rowcolors{4}{white}{gray!15}
    \begin{tabular}{c|c|c}%
   {\bfseries Name} & I will do &  When
    \csvreader[head to column names,
              ]{students.csv}{}% use head of csv as column names
    {\\ \hline
        \name   & Yes $\msquare$ \quad No $\msquare$ &  }\\
        \hline
    \end{tabular}
    }}
\usepackage{filecontents}
\begin{filecontents*}{students.csv}
name
Disco Dingo
Cosmic Cuttlefish
Bionic Beaver
\end{filecontents*}

\begin{document}
%---------------------------------------------------------------%
\obfmat

\section*{Class 1}
\Names

\clearpage
\thispagestyle{firststyle}
\obfmat
`tc
\section*{Class 2}
\Names
%---------------------------------------------------------------%
\end{document}

相关内容