创建带圆角的表格

创建带圆角的表格

我正在尝试复制以下图像:

在此处输入图片描述

使用以下 latex 代码。我想让桌子的角变圆,但我不知道该怎么做

\documentclass[]{article}
%Packages required for excel2latex generated tables
%
\usepackage{booktabs, multicol, multirow}
\usepackage{colortbl}
\usepackage{rotating}
\usepackage{tabularx}
\usepackage{array}
\usepackage{makecell}
%For landscapte table
\usepackage{pdflscape}
\renewcommand{\arraystretch}{1.3}
\setlength\heavyrulewidth{0.3ex}


\begin{document}


\begin{table}[htbp]
    \newcommand{\WideColWidth}{0.3}
  \centering
  \caption{Add caption}
   
    
             \begin{tabular}{|l|r|l|r|l|}
  \rowcolor[rgb]{ .267,  .447,  .769} \textcolor[rgb]{ 1,  1,  1}{\textbf{Header}} & \cellcolor[rgb]{ 1,  1,  1}\textcolor[rgb]{ 1,  1,  1}{} & \textcolor[rgb]{ 1,  1,  1}{\textbf{Header}} & \cellcolor[rgb]{ 1,  1,  1}\textcolor[rgb]{ 1,  1,  1}{} & \textcolor[rgb]{ 1,  1,  1}{\textbf{Header}} \\
   \cellcolor[rgb]{ .906,  .902,  .902}  \parbox{\WideColWidth\textwidth}{
        \begin{itemize}
            \item 
            \item 
            \item 
        \end{itemize}
    } 
&       & \cellcolor[rgb]{ .906,  .902,  .902} \parbox{\WideColWidth\textwidth}{
    \begin{itemize}
        \item 
        \item 
        \item 
    \end{itemize}
}  &       &\cellcolor[rgb]{ .906,  .902,  .902}  \parbox{\WideColWidth\textwidth}{
\begin{itemize}
    \item 
    \item 
    \item 
\end{itemize}
} \\
\cmidrule{1-1}\cmidrule{3-3}\cmidrule{5-5}    \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} & \multicolumn{1}{r}{} \\
   \rowcolor[rgb]{ .267,  .447,  .769} \textcolor[rgb]{ 1,  1,  1}{\textbf{Header}} & \cellcolor[rgb]{ 1,  1,  1}\textcolor[rgb]{ 1,  1,  1}{} & \textcolor[rgb]{ 1,  1,  1}{\textbf{Header}} & \cellcolor[rgb]{ 1,  1,  1}\textcolor[rgb]{ 1,  1,  1}{} & \textcolor[rgb]{ 1,  1,  1}{\textbf{Header}} \\
   \cellcolor[rgb]{ .906,  .902,  .902}  \parbox{\WideColWidth\textwidth}{
        \begin{itemize}
            \item 
            \item 
            \item 
        \end{itemize}
    } &       & \cellcolor[rgb]{ .906,  .902,  .902} \parbox{\WideColWidth\textwidth}{
    \begin{itemize}
        \item 
        \item 
        \item 
    \end{itemize}
}  &       &\cellcolor[rgb]{ .906,  .902,  .902}  \parbox{\WideColWidth\textwidth}{
\begin{itemize}
    \item 
    \item 
    \item 
\end{itemize}
}  \\
\cmidrule{1-1}\cmidrule{3-3}\cmidrule{5-5}    \end{tabular}%
  \label{tab:addlabel}%
\end{table}%
\end{document}

答案1

作为起点:

编辑: 现在表格中有完整的文本,并且棒状布局略有改进:

在此处输入图片描述

使用tcolorboxenumitem包装:

\documentclass{article}
\usepackage[margin=20mm]{geometry}
\usepackage{enumitem}
\usepackage{etoolbox}
\AtBeginEnvironment{tcolorbox}{%
\setlist[itemize]{nosep,
                 leftmargin=*,
                 label=\textbullet,
                 before=\begin{minipage}[t]{\linewidth}, % <---
                 after=\end{minipage}\medskip}                   % <---
                            }

\usepackage[most]{tcolorbox}
\tcbuselibrary{raster}

\usepackage{lipsum}

\begin{document}
\begin{tcbitemize}[%
        raster columns=3,
        raster equal height,
        before=,after=\hfill,
        boxsep=3pt, left=3pt,   right=3pt,
        colframe=blue!75!black,colback=white,
        fonttitle=\large\bfseries,
        halign=left]

\tcbitem[title=Programming Courses]
    \begin{itemize}
\item   Pyton Courses
\item   Java Courses
\item   HTML Courses
\item   Blockchain Courses
\item   Cloud Courses
\item   DevOps Courses
\item   App Development Courses
    \end{itemize}
\raggedright\textbf{Browse All Courses in Programming}
%
\tcbitem[title=Business Courses]
    \begin{itemize}
\item   Finance Courses
\item   Marketing Courses
\item   International Business Courses
\item   Accounting Courses
\item   Supply chain Courses
    \end{itemize}
\raggedright\textbf{Browse All Courses in Business}
%
\tcbitem[title=Management Courses]
    \begin{itemize}
\item   Data Analysis Courses
\item   Leadership Courses
\item   Business Ethic Courses
\item   Business Analysis Courses
\item   Inovation Courses
    \end{itemize}
\raggedright\textbf{Browse All Courses in Management}
    \linebreak
\tcbitem[title=Communication Courses]
    \begin{itemize}
\item   Language Courses
\item   Grammar Courses
\item   Writing Courses
\item   ESL Courses
\item   Chinese Courses
\item   Spanish Courses
    \end{itemize}
\raggedright\textbf{Browse All Courses in Communication}
%
\tcbitem[title=Life Science Courses]
    \begin{itemize}
\item   Biology Courses
\item   Physic Courses
\item   Chemistry Courses
\item   Climate Change Courses
\item   Energy Courses
\item   Renewable Energy Courses
\item   Solar Energy Courses
\item   Astronomy Courses
\item   Environmental Science Courses
\item   Human Anatomy Courses
    \end{itemize}
\raggedright\textbf{Browse All Courses in Life Science}
%
\tcbitem[title=Engineering Courses]
    \begin{itemize}
\item   Mechanical Engineering Courses
\item   Urban Planing Courses
\item   Electronics Courses
\item   Geology Courses
\item   Structural Engineering Courses
    \end{itemize}
\raggedright\textbf{Browse All Courses in Engineering}
    \end{tcbitemize}
\end{document}

答案2

来自@GonzaloMedina 制作的精美桌子——

带圆角的桌子

在此处输入图片描述

\documentclass{article}
\usepackage[spanish]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[usenames,dvipsnames,table]{xcolor}
\usepackage[most]{tcolorbox}
\usepackage{tabularx}
\usepackage{booktabs}
\usepackage{environ}
\usepackage{times}
\usepackage{ragged2e}
\usepackage{enumitem}
\renewcommand\rmdefault{phv} % Arial
\renewcommand\sfdefault{phv} % Arial

\colorlet{TablaBordeSuperior}{blue}
\colorlet{TablaBordeInferior}{blue}
\colorlet{TablaCentroSuperior}{blue!1}
\colorlet{TablaCentroInferior}{blue!20}
\colorlet{fontcol}{white}

\newcolumntype{M}[1]{>{\RaggedRight\arraybackslash}m{#1}}

\tcbset{rtab/.style={
        freelance,
        frame code={
            \path[top color=blue,bottom color=blue] 
            ([yshift=-#1*(\baselineskip+2pt)]interior.north west) --
            ([yshift=-#1*(\baselineskip+2pt)]interior.north east) {[rounded corners]--
                ([yshift=3pt]interior.north east) --
                ([yshift=3pt]interior.north west)} -- cycle;
            \path[top color=TablaCentroSuperior,bottom color=TablaCentroInferior] 
            ([yshift=-#1*(\baselineskip+2pt)]interior.north west) --
            ([yshift=-#1*(\baselineskip+2pt)]interior.north east) --
            (interior.south east) --
            (interior.south west) -- cycle;
            \path[top color=TablaBordeInferior,bottom color=TablaBordeSuperior] 
            (interior.south west) --
            (interior.south east) {[rounded corners]--
                ([yshift=-5pt]interior.south east) --
                ([yshift=-5pt]interior.south west)} -- cycle;
        },
        interior code={},
    }
}

\newcommand\fontcol[1]{\textcolor{fontcol}{\textbf{#1}}}

\NewEnviron{RCtable}[2][htbp]
{%
    \begin{table}[#1]
        \begin{tcolorbox}[#2]\BODY\end{tcolorbox}%
%       \caption{#3}
%       \label{tab:#4}
    \end{table}
}

\begin{document}
    
    \begin{RCtable}{
            rtab=1,
            tabularx*={}%
            {>{\bfseries}M{0.3\linewidth}}
        }{}{}
        \fontcol{Details of Courses} \\
        \\[-1.7ex]
        \begin{itemize}[label=$\bullet$]
        \item Course1
        \item Course2
        \end{itemize}
    \end{RCtable}
    
\end{document}

相关内容