如何解决彩色乳胶表中的问题?

如何解决彩色乳胶表中的问题?

我使用表格生成器程序生成了学术计划表。程序本身已向我指出,我应该\usepackage[table,xcdraw,usenames]{xcolor}在初始序言中添加该包,但它仍然给出错误,并且不为表格着色,有人能解释一下吗?

\begin{table}[H]
\begin{tabular}{c|c|c|c|c|cc}
\cline{2-5} \cline{7-7}
                                           & \textbf{LUNES}                                                                     & \textbf{MARTES}                                                                    & \textbf{MIÉRCOLES}                                                                 & \textbf{JUEVES}                                                                    & \multicolumn{1}{c|}{}            & \multicolumn{1}{c|}{\textbf{VIERNES}}                                                                   \\ \hline
\multicolumn{1}{|c|}{\textbf{8:30-9:25}}   & \cellcolor[HTML]{9AFF99}2º ESO B                                                   &                                                                                    & \cellcolor[HTML]{9AFF99}2º ESO B                                                   & \cellcolor[HTML]{FFCCC9}\begin{tabular}[c]{@{}c@{}}FÍSICA\\ 2º BACH A\end{tabular} & \multicolumn{1}{c|}{8:30-9:25}   & \multicolumn{1}{c|}{}                                                                                   \\ \hline
\multicolumn{1}{|c|}{\textbf{9:25-10:20}}  & \cellcolor[HTML]{6665CD}4º ESO A                                                   &                                                                                    &                                                                                    & \cellcolor[HTML]{6665CD}4º ESO A                                                   & \multicolumn{1}{c|}{9:25-10:20}  & \multicolumn{1}{c|}{}                                                                                   \\ \hline
\multicolumn{1}{|c|}{\textbf{10:20-11:15}} & \cellcolor[HTML]{FFCCC9}\begin{tabular}[c]{@{}c@{}}FÍSICA\\ 2º BACH A\end{tabular} & \cellcolor[HTML]{FFCCC9}\begin{tabular}[c]{@{}c@{}}FÍSICA\\ 2º BACH A\end{tabular} & \cellcolor[HTML]{FFCCC9}\begin{tabular}[c]{@{}c@{}}FÍSICA\\ 2º BACH A\end{tabular} &                                                                                    & \multicolumn{1}{c|}{10:20-11:15} & \multicolumn{1}{c|}{\cellcolor[HTML]{68CBD0}\begin{tabular}[c]{@{}c@{}}FyQ\\ 1º BACH B\end{tabular}}    \\ \hline
\multicolumn{1}{|c|}{\textbf{11:15-11:45}} & \multicolumn{4}{c|}{\cellcolor[HTML]{C0C0C0}RECREO}                                                                                                                                                                                                                                                                                               & \multicolumn{1}{c|}{11:15-11:30} & \multicolumn{1}{c|}{\cellcolor[HTML]{C0C0C0}RECREO}                                                     \\ \hline
\multicolumn{1}{|c|}{\textbf{11:45-12:40}} &                                                                                    & \cellcolor[HTML]{FFCB2F}\begin{tabular}[c]{@{}c@{}}FyQ\\ 1º BACH A\end{tabular}    & \cellcolor[HTML]{6665CD}4º ESO A                                                   &                                                                                    & \multicolumn{1}{c|}{11:30-12:25} & \multicolumn{1}{c|}{\cellcolor[HTML]{9AFF99}2º ESO B}                                                   \\ \hline
\multicolumn{1}{|c|}{\textbf{12:40-13:35}} & \cellcolor[HTML]{FFFC9E}\begin{tabular}[c]{@{}c@{}}FÍSICA\\ 2º BACH B\end{tabular} &                                                                                    & \cellcolor[HTML]{68CBD0}\begin{tabular}[c]{@{}c@{}}FyQ\\ 1º BACH B\end{tabular}    & \cellcolor[HTML]{FFCB2F}\begin{tabular}[c]{@{}c@{}}FyQ\\ 1º BACH A\end{tabular}    & \multicolumn{1}{c|}{12:25-13:20} & \multicolumn{1}{c|}{}                                                                                   \\ \hline
\multicolumn{1}{|c|}{\textbf{13:35-15:00}} & \multicolumn{4}{c|}{\cellcolor[HTML]{C0C0C0}COMIDA}                                                                                                                                                                                                                                                                                               & \multicolumn{1}{c|}{13:20-14:15} & \multicolumn{1}{c|}{\cellcolor[HTML]{FFFC9E}\begin{tabular}[c]{@{}c@{}}FÍSICA\\ 2º BACH B\end{tabular}} \\ \hline
\multicolumn{1}{|c|}{\textbf{15:00-15:55}} & \cellcolor[HTML]{68CBD0}\begin{tabular}[c]{@{}c@{}}FyQ\\ 1º BACH B\end{tabular}    & \cellcolor[HTML]{FFFC9E}\begin{tabular}[c]{@{}c@{}}FÍSICA\\ 2º BACH B\end{tabular} & \cellcolor[HTML]{FFCB2F}\begin{tabular}[c]{@{}c@{}}FyQ\\ 1º BACH A\end{tabular}    & \cellcolor[HTML]{68CBD0}\begin{tabular}[c]{@{}c@{}}FyQ\\ 1º BACH B\end{tabular}    &                                  &                                                                                                         \\ \cline{1-5}
\multicolumn{1}{|c|}{\textbf{15:55-16:50}} & \cellcolor[HTML]{FFCB2F}\begin{tabular}[c]{@{}c@{}}FyQ\\ 1º BACH A\end{tabular}    &                                                                                    & \cellcolor[HTML]{FFFC9E}\begin{tabular}[c]{@{}c@{}}FÍSICA\\ 2º BACH B\end{tabular} &                                                                                    &                                  &                                                                                                         \\ \cline{1-5}
\end{tabular}
\caption{Horario seguido durante el período de prácticas.}
\label{tabla:horario seguido}
\end{table}

可预编码


\documentclass[pdftex,12pt,twoside,a4paper]{report}
\usepackage[spanish,es-noshorthands]{babel}
\usepackage[utf8]{inputenc}
%\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{amssymb,amsmath,amsthm}
\usepackage[spanish]{babel}
\usepackage{natbib}
%\usepackage{color}
% m\'{a}s modfolortbl} %se necesita para la documentaci\'on de tesis

\usepackage[pdftex]{graphicx}
%\usepackage{tikz}
\usepackage{pgfplots,tikz}
\usetikzlibrary{decorations.pathmorphing,patterns}
\usepackage{lscape}
\usepackage{url}
\usepackage{ulem}


\usepackage[table,xcdraw]{xcolor}
\usepackage{float}
\usepackage{cellspace}
\setlength{\cellspacetoplimit}{3pt}
\usepackage[usestackEOL]{stackengine}

%
% Añadidos para el TFG d
%
%\renewcommand{\baselinestretch}{1.5}

%\usepackage{subfig}
\usepackage[many]{tcolorbox}
\tcbuselibrary{listings}
\usepackage[american, cuteinductors]{circuitikz}
%\usepackage{tikz}
\usepackage{hyperref}
\usepackage{amssymb, amsmath, amsbsy} % simbolitos
\usepackage{upgreek} % para poner letras griegas sin cursiva
\usepackage{cancel} % para tachar.
\usepackage{mathdots} % para el comando \iddots
\usepackage{amsfonts}
\usepackage{mathrsfs} % para formato de letra
\usepackage{braket}
\usepackage{multicol}
\usepackage{mathtools}
\usepackage{array}
\usepackage{wasysym}
\usepackage{multirow}
\usepackage{booktabs}
\usepackage{ifthen}
\usepackage{subcaption}
\usepackage{siunitx}
\usepackage[acronym,shortcuts]{glossaries}
\usepackage{arydshln}


\usepackage[T1,OT1]{fontenc}
\usepackage{siunitx}
\newcommand{\pepito}{}


%%%%%%5 itemize
\let\olditemize\itemize
\def\itemize{\olditemize\itemsep=0pt }
%%%%%%%%%%%%%%
\providecommand{\abs}[1]{\lvert#1\rvert}
\pgfplotsset{compat=1.14}

\newcounter{ipythcntr}
\newlength\inwd
\setlength\inwd{1.3cm}

\definecolor{codegreen}{rgb}{0,0.6,0}
\definecolor{codegray}{rgb}{0.5,0.5,0.5}
\definecolor{codepurple}{rgb}{0.58,0,0.82}
\definecolor{backcolour}{rgb}{0.95,0.95,0.92}
\definecolor{dimgray}{rgb}{0.41, 0.41, 0.41}
\definecolor{aliceblue}{rgb}{0.94, 0.97, 1.0}
\definecolor{light-gray}{gray}{0.95}


\lstdefinestyle{mystyle}{
    backgroundcolor=\color{aliceblue},   
    commentstyle=\color{gray},
    keywordstyle=\color{blue},
    numberstyle=\tiny\color{gray},
    stringstyle=\color{red},
    basicstyle=\footnotesize,
    breakatwhitespace=false,         
    breaklines=true,                 
    captionpos=b,                    
    keepspaces=true,                 
    numbers=left,                    
    numbersep=5pt,                  
    showspaces=false,                
    showstringspaces=false,
    showtabs=false,                  
    tabsize=2
}

\lstset{style=mystyle}

\tcbset{listing engine=listings}
\newtcblisting{ipythonnb}[1][\theipythcntr]{
  enlarge left by=\inwd,
  width=\linewidth-\inwd,
  enhanced,
  boxrule=0.4pt,
  colback=light-gray,
  listing only,
  top=0pt,
  bottom=0pt,
  overlay={
    \node[
      anchor=north east,
      text width=\inwd,
      font=\footnotesize\ttfamily\color{blue!50!black},
      inner ysep=2mm,
      inner xsep=0pt,
      outer sep=0pt
      ] 
      at (frame.north west)
      {\stepcounter{ipythcntr}In [#1]:};
  }
    listing options={
      language=Python,
      basicstyle=\small\ttfamily,
      keywordstyle=\ttfamily\color{blue},
      stringstyle=\color{green},
      commentstyle=\ttfamily\color{red},
      showstringspaces=false,
      columns=fullflexible
  },
}

%
% Definiciones de macros...
%
%

\date{\today}
\textheight = 24.7cm
\textwidth = 15.5cm          %
%\oddsidemargin = -1.2cm    %
\evensidemargin = -0.04cm   %
\topmargin = -1.5cm
\headheight = 0cm 

\newcommand{\com}[1]{
\textbf{\textcolor{red}{**#1 **}}
}
\newcommand{\res}[1]{
\textbf{\textcolor{blue}{**#1 **}}
}

\newcommand{\tgr}[1]{
{\textcolor{green}{#1}}
}


\usepackage{etoolbox}

%% Para utilizar Uarial que es un clon de Arial
%% sudo getnonfreefonts-sys -a para instalar las fuentes en linux
\ifdefstring{\controlpe}{pe}{
\usepackage[scaled]{uarial}
\renewcommand{\rmdefault}{phv}
\renewcommand{\sfdefault}{phv}
}{}

%\renewcommand*\familydefault{\sfdefault} %% Only if the base font of           
%% the document is to be sans 
%\usepackage[T1]{fontenc}
%%

\input{./ficheros/variables.tex}

\newtheorem{theorem}{Teorema}[section]
\newtheorem{lemma}[theorem]{Lema}
\newtheorem{corollary}[theorem]{Corolario}
\newtheorem{definicion}{Definici\'on}[section]
\ifdefstring{\controltp}{ap}{
\addto\captionsspanish{\renewcommand\chaptername{Tema}}
}{}


\newcommand{\documentacion}{si}


\begin{document}
%
% Para cambiar Cuadro por Tabla
%
\renewcommand{\tablename}{Tabla}

\addtolength{\oddsidemargin}{-0,7mm}
\input{./ficheros/cabecera1.tex}
\addtolength{\oddsidemargin}{0,7mm}

\chapter*{}
\thispagestyle{empty}
\newpage

\setcounter{page}{0}

\tableofcontents



%% Comienzo de la estructura del tfg
\ifdefstring{\controltp}{tfg}


%%%%%%%%%%%%%%%%%% Capitulos en este espacio %%%%%%%%%%%%%%%%%%
\newpage\mbox{}


\input{./ficheros/descripcion.tex}
\input{./ficheros/comentario.tex}





\end{document}



错误信息 在此处输入图片描述

答案1

以下是对您的代码的一些简化和改进。我删除了所有不必要的\multicolumn{1}{c|}。我还使用了 \Centerstack 来自stackengine包的嵌套表格,并加载了cellspace包,它定义了一个最小在以字母为前缀的说明符的列中单元格顶部的垂直间距S(或者C如果您加载siunitx)。

无关的评论:该usenames选项xcolor已被弃用好几年了,因为它现在是默认选项。

\documentclass{article}
\usepackage[margin=1.5cm]{geometry}
\usepackage[table, xcdraw]{xcolor}
\usepackage{float}
\usepackage{cellspace}
\setlength{\cellspacetoplimit}{3pt}
\usepackage[usestackEOL]{stackengine}

\begin{document}

\begin{table}[H]
\begin{tabular}{|>{\bfseries}c|*{6}{Sc|}}
\cline{2-5} \cline{7-7}
\multicolumn{1}{c|}{} & \textbf{LUNES} & \textbf{MARTES} & \textbf{MIÉRCOLES} & \textbf{JUEVES} & & \textbf{VIERNES} \\ \hline
8:30-9:25 & \cellcolor[HTML]{9AFF99}2º ESO B & & \cellcolor[HTML]{9AFF99}2º ESO B & \cellcolor[HTML]{FFCCC9}\Centerstack{FÍSICA\\ 2º BACH A} & 8:30-9:25 & \\ \hline
9:25-10:20 & \cellcolor[HTML]{6665CD}4º ESO A & & & \cellcolor[HTML]{6665CD}4º ESO A & 9:25-10:20 & \\ \hline
10:20-11:15 & \cellcolor[HTML]{FFCCC9}\Centerstack{FÍSICA\\ 2º BACH A} & \cellcolor[HTML]{FFCCC9}\Centerstack{FÍSICA\\ 2º BACH A} & \cellcolor[HTML]{FFCCC9}\Centerstack{FÍSICA\\ 2º BACH A} & & 10:20-11:15 & \cellcolor[HTML]{68CBD0}\Centerstack{FyQ\\ 1º BACH B} \\ \hline
11:15-11:45 & \multicolumn{4}{c|}{\cellcolor[HTML]{C0C0C0}RECREO} & 11:15-11:30 & \cellcolor[HTML]{C0C0C0}RECREO \\ \hline
11:45-12:40 & & \cellcolor[HTML]{FFCB2F}\Centerstack{FyQ \\ 1º BACH A} & \cellcolor[HTML]{6665CD}4º ESO A & & 11:30-12:25 &\cellcolor[HTML]{9AFF99}2º ESO B \\ \hline
12:40-13:35 & \cellcolor[HTML]{FFFC9E}\Centerstack{FÍSICA\\ 2º BACH B} & & \cellcolor[HTML]{68CBD0}\Centerstack{FyQ\\ 1º BACH B} & \cellcolor[HTML]{FFCB2F}\Centerstack{FyQ\\ 1º BACH A} & 12:25-13:20 & \\ \hline
13:35-15:00 & \multicolumn{4}{c|}{\cellcolor[HTML]{C0C0C0}COMIDA} & 13:20-14:15 & \cellcolor[HTML]{FFFC9E}\Centerstack{FÍSICA\\ 2º BACH B} \\ \hline
15:00-15:55 & \cellcolor[HTML]{68CBD0}\Centerstack{FyQ\\ 1º BACH B} & \cellcolor[HTML]{FFFC9E}\Centerstack{FÍSICA\\ 2º BACH B} & \cellcolor[HTML]{FFCB2F}\Centerstack{FyQ\\ 1º BACH A} & \cellcolor[HTML]{68CBD0}\Centerstack{FyQ\\ 1º BACH B} \\ \cline{1-5}
15:55-16:50 & \cellcolor[HTML]{FFCB2F}\Centerstack{FyQ\\ 1º BACH A} & & \cellcolor[HTML]{FFFC9E}\Centerstack{FÍSICA\\ 2º BACH B} & \\ \cline{1-5}
\end{tabular}
\caption{Horario seguido durante el período de prácticas.}
\label{tabla:horario seguido}
\end{table}

\end{document} 

在此处输入图片描述

相关内容