TransWikia.com

Creating a table with round corner

TeX - LaTeX Asked by Fonde Lapatrie on June 15, 2021

I am trying to replicate the following image:

enter image description here

with the following latex code. I would like to have the table’s corners rounded but I don’t know how to get it done

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}
setlengthheavyrulewidth{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{WideColWidthtextwidth}{
        begin{itemize}
            item 
            item 
            item 
        end{itemize}
    } 
&       & cellcolor[rgb]{ .906,  .902,  .902} parbox{WideColWidthtextwidth}{
    begin{itemize}
        item 
        item 
        item 
    end{itemize}
}  &       &cellcolor[rgb]{ .906,  .902,  .902}  parbox{WideColWidthtextwidth}{
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{WideColWidthtextwidth}{
        begin{itemize}
            item 
            item 
            item 
        end{itemize}
    } &       & cellcolor[rgb]{ .906,  .902,  .902} parbox{WideColWidthtextwidth}{
    begin{itemize}
        item 
        item 
        item 
    end{itemize}
}  &       &cellcolor[rgb]{ .906,  .902,  .902}  parbox{WideColWidthtextwidth}{
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}

2 Answers

As starting point:

Edit: Now with complete text in the table and slightly improved sticks layout:

enter image description here

Using tcolorbox and enumitem packages:

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=largebfseries,
        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}
raggedrighttextbf{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}
raggedrighttextbf{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}
raggedrighttextbf{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}
raggedrighttextbf{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}
raggedrighttextbf{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}
raggedrighttextbf{Browse All Courses in Engineering}
    end{tcbitemize}
end{document}

Correct answer by Zarko on June 15, 2021

From the beautiful table built by @GonzaloMedina --

Table with rounded corners

enter image description here

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}
renewcommandrmdefault{phv} % Arial
renewcommandsfdefault{phv} % Arial

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

newcolumntype{M}[1]{>{RaggedRightarraybackslash}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={},
    }
}

newcommandfontcol[1]{textcolor{fontcol}{textbf{#1}}}

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

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

Answered by js bibra on June 15, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP