How to make such a nice table in LaTeX?

Below is an example, it seems rather complex for me. I can only make a table with dark lines, and don't know how to make the dark lines hollow ones.

Is there a way to embed such a fancy table in LaTeX?

• This table doesn't look that complex, although I would not have all of those rules. Can you show us what you'd tried so far? – Joseph Wright Apr 1 '15 at 7:26
• I wasn't the down-voter, but I'd venture a guess that it got down-voted because you've set forth a "do-this-for-me" demand while not demonstrating any discernible research effort. – Mico Apr 1 '15 at 7:43
• The table would actually look much nicer without all these useless lines... – user17424 Apr 1 '15 at 7:51
• Er, round here, that isn't what we call a "nice table" – Brent.Longborough Apr 1 '15 at 9:03
• @Brent.Longborough It was in 1995 and when HTML tables were interesting :P – percusse Apr 2 '15 at 1:10

Here is why every one says " get rid of vertical lines". Double lines everywhere add further to disaster.

\documentclass{article}
\usepackage{hhline}
\usepackage{caption}
\usepackage{booktabs}
\begin{document}
\begin{table}[htb]
\centering
\sffamily
\captionsetup{font={bf,sf},skip=0.5ex}
\caption*{Access Levels}
\begin{tabular}{||*{5}{l||}}
\hhline{|t:=:t:=:t:=:t:=:t:=:t|}
\bfseries Modifier              & \bfseries Class & \bfseries Package & \bfseries Subclass & \bfseries World \\
\hhline{|:=::=::=::=::=:|}
\texttt{public}                  & Y               & Y                 & Y                  & Y               \\
\hhline{|:=::=::=::=::=:|}
\texttt{protected}               & Y               & Y                 & Y                  & N               \\
\hhline{|:=::=::=::=::=:|}
\itshape no modifier             & Y               & Y                 & N                  & N               \\
\hhline{|:=::=::=::=::=:|}
\texttt{private}                 & Y               & N                 & N                  & N               \\
\hhline{|b:=:b:=:b:=:b:=:b:=:b|}
\end{tabular}
\end{table}

\begin{table}[htb]
\centering
\sffamily
\captionsetup{font={bf,sf},skip=0.5ex}
\caption*{Access Levels}
\begin{tabular}{l*{4}{c}}
\toprule
\bfseries Modifier  & \bfseries Class & \bfseries Package & \bfseries Subclass & \bfseries World \\
\midrule
\texttt{public}      & Y               & Y                 & Y                  & Y               \\
\texttt{protected}   & Y               & Y                 & Y                  & N               \\
\itshape no modifier & Y               & Y                 & N                  & N               \\
\texttt{private}     & Y               & N                 & N                  & N               \\ \bottomrule
\end{tabular}
\end{table}
\end{document}


Decide yourself which one looks good. I like the second one.

As noted by touhami, adding \setlength\tabcolsep{1pt} produces a look more similar to the image in the question, but it is cramped IMO.

You may want to use colours to make Y and N conspicuous.

\documentclass{article}
\usepackage{hhline}
\usepackage{caption}
\usepackage{booktabs}
\usepackage[table]{xcolor}
\newcommand*{\myred}{\cellcolor{red!50}}
\newcommand*{\mygreen}{\cellcolor{green!50}}
\newcommand*{\mycolor}{\cellcolor{olive!40}}
\begin{document}
\begin{table}[htb]
\arrayrulecolor{white}
\doublerulesepcolor{gray!20}
\centering
\sffamily
\captionsetup{font={bf,sf},skip=0.5ex}
\caption*{Access Levels}
\begin{tabular}{||*{5}{c||}}
\hhline{|t:=:t:=:t:=:t:=:t:=:t|}
\rowcolor{blue!30}
\bfseries Modifier               & \bfseries Class & \bfseries Package & \bfseries Subclass & \bfseries World \\ \hhline{|:=::=::=::=::=:|}
\mycolor\texttt{public}          & \mygreen Y      & \mygreen Y        & \mygreen Y         & \mygreen Y      \\
\hhline{|:=::=::=::=::=:|}
\mycolor\texttt{protected}       & \mygreen Y      & \mygreen Y        & \mygreen Y         & \myred N        \\
\hhline{|:=::=::=::=::=:|}
\mycolor\itshape no modifier     & \mygreen Y      & \mygreen Y        & \myred N           & \myred N        \\
\hhline{|:=::=::=::=::=:|}
\mycolor\texttt{private}         & \mygreen Y      & \myred N          & \myred N           & \myred N        \\
\hhline{|b:=:b:=:b:=:b:=:b:=:b|}
\end{tabular}
\end{table}

\end{document}


• @xmllmx I would pretty much prefer Yes and No rather than Y and N. You don't lose anything and you gain being more informative. Moreover, the words having different lengths are easier to distinguish. – yo' Apr 1 '15 at 8:57

I don't share your opinion that the table given in the question is nice. And I don't prefer the questions where OP only uses the tex.sx.com as "code generator" (i.e. to put the picture and to wait to the code). But if the LaTeX solution was presented here then I can show plain TeX solution (just for completeness).

The double lines table can be simply created by:

\input opmac
\input chelvet  % Helvetica plus Courier
\def\tabstrut{\lower4pt\vbox to15pt{}} % more vertical space

\hfil {\bf Access Levels}
\smallskip
\hfil\frame{\table{|l||l||l||l||l|}{\crli
\bf Modifier    & \bf Class & \bf Package & \bf Subclass & \bf World \crlli
\tt public      &     Y     &     Y       &     Y        &     Y \crlli
\tt protected   &     Y     &     Y       &     Y        &     N \crlli
\it no modifier &     Y     &     Y       &     N        &     N \crlli
\tt private     &     Y     &     N       &     N        &     N \crli
}}
\bye


The result:

If you need the colored version, then we need to copy a few lines from OPmac-tricks page, because OPmac doesn't support colored cells by default.

\input opmac
\input chelvet  % Helvetica plus Courier
\def\tabstrut{\lower4pt\vbox to15pt{}} % more vertical space

%%% The code from http://petr.olsak.net/opmac-tricks-e.html#cellcolor

\def\tabdeclareC{\futurelet\next\setcellcolor##\end\hfil\hfil}
\def\setcellcolor{\ifx\next\global \expandafter\setcellcolorC\else \expandafter\setcellcolorD\fi}
\def\setcellcolorC#1\fi#2\end#3#4{%
\setbox0=\hbox{{\tabiteml\localcolor#2\unskip\tabitemr}}%
\kern-\wd0 \box0
\ifx#4\hfil {\kern-.2pt \localcolor#1\fi\leaders\vrule\hskip.2pt plus1fil}\fi
}
\def\setcellcolorD{\ifx\cellcolor\undefined \let\next=\setcellcolorN
\else \def\next{\expandafter\expandafter\expandafter\setcellcolorC\cellcolor}%
\fi \next
}
\def\setcellcolorN#1\end#2#3{#2\tabiteml{\localcolor#1\unskip}\tabitemr#3}

%%% The table:

\def\LightGreen{\setcmykcolor{.5 0 .5 0}}
\def\LightRed{\setcmykcolor{0 .5 .5 0}}
\def\LightBlue{\setcmykcolor{.3 .1 0 0}}

\hfil {\bf Access Levels}
\smallskip
{\tabskip=2pt \def\cskip{\noalign{\kern2pt}}
\let\cellcolor=\LightBlue \def\Y{\LightGreen Y}  \def\N{\LightRed N}
\hfil\table{CCCCC}{
\bf Modifier    & \bf Class & \bf Package & \bf Subclass & \bf World \cr \cskip
\tt public      &     \Y    &     \Y       &    \Y        &    \Y    \cr \cskip
\tt protected   &     \Y    &     \Y       &    \Y        &    \N    \cr \cskip
\it no modifier &     \Y    &     \Y       &    \N        &    \N    \cr \cskip
\tt private     &     \Y    &     \N       &    \N        &    \N
}}
\bye


The result:

• +1 for the plain code and first three lines of answer and the coloured version. Really nice. :-) – user11232 Apr 2 '15 at 16:08