我怎样才能在这个表格上画出 \hhline 产生的空行?

我怎样才能在这个表格上画出 \hhline 产生的空行?

您好,提前感谢您的关注。

我已经搜索了好几天如何做才能提高它的美观度。我读了彩色表格手册中解释的内容“更多乐趣\hhline它对我不起作用。

话虽如此,您有什么建议吗?

表格代码为:

\documentclass[a4paper,11pt]{article}
\usepackage[spanish]{babel}
\usepackage[utf8]{inputenc}
\usepackage{color}
\usepackage{fancyhdr}
\usepackage{pgfplots}
\pgfplotsset{width=11cm,compat=newest}
\usepackage{colortbl}
\usepackage{multirow}
\usepackage{array}
\usepackage{hhline}
\usepackage{float}
\usepackage{anysize}

\marginsize{1.5cm}{1.5cm}{1.5cm}{1.5cm}
\parindent=0mm
\parskip=3mm
\renewcommand{\baselinestretch}{1}

\definecolor{darkblue}{cmyk}{1,0.5,0.10,0.5}

\newcommand{\darkbluecell}[1]{\textcolor{black}{\bfseries #1}\cellcolor{darkblue!30}}
\newcommand{\bluecell}[1]{\textcolor{black}{\bfseries #1}\cellcolor{darkblue!20}}
%\newcommand{\lightbluecell}[1]{\textcolor{black}{\bfseries #1}\cellcolor{darkblue!10}}

\begin{document}

\begingroup
\setlength{\tabcolsep}{4.5pt}
\begin{table}[H]
\begin{center} 
\begin{tabular}{|c|c|c|c|c|}
\hline
\rowcolor{darkblue!30} & \multicolumn{3}{c|}{\bf{Forma}} &  \\ \hhline{~---~}
\darkbluecell{\multirow{-2}{*}{Tiempo}} & \bluecell{Afirmativa} & \bluecell{Negativa} & \bluecell{Dubitativa} & \darkbluecell{\multirow{-2}{*}{Se usa en...}} \\ \hline
\rowcolor{darkblue!10}\begin{tabular}{l} \bf Presente \\ \bf simple \end{tabular} & \begin{tabular}{l}I/You/We/ \\ They \textbf{work} \end{tabular} & \begin{tabular}{l} I/You/We/ \\ They \textbf{don't work} \end{tabular} & \begin{tabular}{l} \textbf{Do} I/you/we/ \\ they \textbf{work?}\end{tabular} & \begin{tabular}{l} $\bullet$ Hechos y \\ \hspace{6pt} afirmaciones \vspace{2mm}\\ $\bullet$ Hábitos y \\ \hspace{6pt} acciones que \\ \hspace{6pt} se repiten \vspace{2mm}\\ $\bullet$ Verbos de \\ \hspace{6pt} estado \end{tabular} \\ \hline
\rowcolor{darkblue!20}\begin{tabular}{l} \bf Presente \\ \bf continuo\end{tabular} & \begin{tabular}{l}\textbf{I am} ('m) \\ \bf working \vspace{2mm} \\ He/She/It \\ \textbf{is} ('s) \bf working \vspace{2mm}\\ You/We/They \\ \textbf{are} ('re) \bf working  \end{tabular} & \begin{tabular}{l}\textbf{I am} ('m) \bf not \\ \bf working \vspace{2mm} \\ He/She/It \textbf{is not} \\ (isn't) \bf working \vspace{2mm}\\ You/We/They \textbf{are not} \\ (aren't) \bf working  \end{tabular} & \begin{tabular}{l} \bf Am I \\ \bf working? \vspace{2mm} \\ \textbf{Is} he/she/it \\ \bf working? \vspace{2mm}\\ Are you/we/they \\ \bf working?  \end{tabular} & \begin{tabular}{l} $\bullet$ Acciones en \\ \hspace{6pt} progreso en \\ \hspace{6pt} ese momento \\ $\bullet$ Situaciones \\ \hspace{6pt} temporales \\ $\bullet$ Uso de futuro, \\ \hspace{6pt} para hablar \\ \hspace{6pt} de eventos \\ \hspace{6pt} o planes \end{tabular}\\ \hline            
\end{tabular}
\end{center}
\end{table}
\endgroup
\end{document}

答案1

无法绘制\hhlines 的原因是它们使用了 >{\arrayrulecolor{some color}},并且由于某种原因,此语法与 冲突>,并被<变为活动字符babel-spanish。我想这是一个错误,因为表格序言中使用的类似语法有效。

解决方案是使用命令使它们在表中处于非活动状态\shorthandsoff。我借此机会使用软件包、和来简化和改进您的表格tabularxmakecell此外tabstackengineenumitem我用选项替换了加载colorcolortbl加载。xcolor[table]

\documentclass[a4paper, spanish, table, 11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{fancyhdr}
\usepackage{xcolor}
\usepackage{pgfplots}
\pgfplotsset{width=11cm,compat=newest}
\usepackage{multirow, makecell}
\renewcommand\cellalign{lc}
\renewcommand\theadalign{lc}
\renewcommand\theadfont{\normalsize\bfseries}
\usepackage{array}
\usepackage{hhline}
\usepackage{float}
\usepackage{anysize}
\usepackage{tabstackengine, tabularx, enumitem}
\usepackage[showframe, margin=1.5cm]{geometry}
\parindent=0mm
\parskip=3mm
\renewcommand{\baselinestretch}{1}

\definecolor{darkblue}{cmyk}{1,0.5,0.10,0.5}
\newcommand{\darkbluecell}[1]{\cellcolor{darkblue!30}\bfseries #1}%
\newcommand{\bluecell}[1]{\cellcolor{darkblue!20}\bfseries #1}
\newcommand{\lightbluecell}[1]{\cellcolor{darkblue!10}\bfseries #1}

\makeatletter
\newcommand*{\compress}{\@minipagetrue}
\makeatother
\renewcommand{\tabularxcolumn}[1]{>{\arraybackslash\compress}m{#1}}

\begin{document}

\begin{table}[H]
  \centering
  {\setlength{\tabcolsep}{4.5pt}\centering\shorthandoff{<>}
    \setlist[itemize]{wide=0pt, leftmargin=*, itemsep=0pt, parsep=0pt, before=\vspace*{\topsep}, after=\vspace*{-\topsep}}%3pt
    \renewcommand\stackalignment{l}
    \rowcolors{2}{darkblue!20}{darkblue!10}
    \begin{tabularx}{\linewidth}{|c|c|c|c|X|}
      \hline
      \rowcolor{darkblue!30} & \multicolumn{3}{c|}{\bfseries Forma} & \\
      \hhline{|>{\arrayrulecolor{darkblue!30}}->{\arrayrulecolor{black}}|---|>{\arrayrulecolor{darkblue!30}}->{\arrayrulecolor{black}}|}
      \darkbluecell{\multirow{-2}{*}{Tiempo}}
        & \textbf{Afirmativa} & \textbf{Negativa} & \textbf{Dubitativa} & \darkbluecell{\multirow{-2}{*}{Se usa en...}} \\ \hline%
      \thead{Presente \\ simple} & \Centerstack{I/You/We/ \\ They \textbf{work}} & \Centerstack{ I/You/We/ \\ They \textbf{don't work}} & \Centerstack{\textbf{Do} I/you/we/ \\ they \textbf{work?}} &
      \begin{itemize}
        \item Hechos y afirmaciones
        \item Hábitos y acciones que se repiten
        \item Verbos de estado
      \end{itemize}
      \\ \hline
      \thead{Presente \\ continuo} & \makecell{\textbf{I am} ('m) \\ \bfseries working \\[1ex] He/She/It \\ \textbf{is} ('s) \bfseries working \\[1ex] You/We/They \\ \textbf{are} ('re) \bfseries working} & \makecell{\textbf{I am} ('m) \bfseries not \\ \bfseries working \\[1ex] He/She/It \textbf{is not} \\ (isn't) \bfseries working \\[1ex] You/We/They \textbf{are not} \\ (aren't) \bfseries working} & \makecell{\bfseries Am I \\ \bfseries working? \\[1ex] \textbf{Is} he/she/it \\ \bfseries working?\\[1ex] Are you/we/they \\ \bfseries working?} &
      \begin{itemize}[before =\vspace{2\topsep}]
        \item Acciones en progreso en ese momento
        \item Situaciones temporales
        \item Uso de futuro, para hablar de eventos o planes
      \end{itemize}
      \\ \hline
    \end{tabularx}}
\end{table}

\end{document} 

在此处输入图片描述

相关内容