4

Is it possible to create this table, page a4?

Difficult parts are border, wrap and cell size. Table created in Excel

\begin{tabular}{r|lllll|}
    \cline{2-6}
    \multicolumn{1}{l|}{}                                                                    >& \multicolumn{1}{c}{\textbf{2000}} & \multicolumn{1}{c}{\textbf{2005}} & \multicolumn{1}{c}{\textbf{2007}} & \multicolumn{1}{c}{\textbf{2010}} & \multicolumn{1}{c|}{\textbf{2012}} \\ \hline
    \multicolumn{1}{|r|}{\textbf{Global Electricity Consumption (Million MWh)}}              & 1                             & 6                             & 7                             & 12                             & 13                              \\ \hline
    \multicolumn{1}{|r|}{\textbf{Global Data Center Electricity Use (Million MWh)}}          & 2                             & 5                            & 8                             & 11                            & 14                                \\ \hline
    \multicolumn{1}{|r|}{\textbf{Data Center as Fraction of Global Electricity Consumption}} & 3\%                            & 4\%                            & 9\%                            & 10\%                            & 15\%                             \\ \hline
\end{tabular}
  • By wrap, do you mean that the text in first column breaks over two lines? – Torbjørn T. Aug 26 '16 at 11:27
  • Do the lines that border the cells have to be doubled? – Mico Aug 26 '16 at 11:38
  • @TorbjørnT. yes, like in excel, if to make cell width small (to make the whole table within a page) – Mr.EU Aug 26 '16 at 12:30
  • @Mico That'll look cool. Really want to play with borders in latex – Mr.EU Aug 26 '16 at 12:31
  • 3
    @Mr.EU Just my personal opinion, but all these double lines are a bit too much. You might find inf.ethz.ch/personal/markusp/teaching/guides/guide-tables.pdf interesting to read. – user36296 Aug 26 '16 at 12:41
13

The closest to what you like to obtain:

enter image description here

MWE:

\documentclass{article}
\usepackage{array,mdwtab,hhline}
\newcolumntype{R}[1]{>{\raggedleft\bfseries}m{#1}}

\begin{document}
\begin{tabular}{!{\vline[1pt]}R{44ex}||c|c| c|c| c !{\vline[1pt]}}
    \cline[1pt]{2-6}
\multicolumn{1}{c||}{}
    & \textbf{2000} & \textbf{2005} & \textbf{2007} 
            & \textbf{2010} & \textbf{2012}         \\ \hhline{=::=====}
Global Electricity Consumption (Million MWh)              
    &   1   &   6   &   7   &   12  &   13          \\ \hhline{-||-----}
Global Data Center Electricity Use (Million MWh)         
    &   2   &   5   &   8   &   11  &   14          \\ \hhline{-||-----}
Data Center as Fraction of Global Electricity Consumption 
    & 3\%   & 4\%   & 9\%   & 10\%  & 15\%          \\ \hhline{-||-----}
    \hlx[1pt]{h}
\end{tabular}
\end{document}

As you can see, in above MWE I use hhline package for double lines (personaly I wouldn't use them also not all vertical lines) and good old mdwtab (which is not compatible with colortbl).

An alternative, to my taste more professional look you can obtain by use of booktabs and tabularx packages:

enter image description here

\documentclass{article}
\usepackage{booktabs,tabularx}
\renewcommand\tabularxcolumn[1]{m{#1}}
\newcolumntype{R}{>{\raggedleft\arraybackslash\bfseries}X}

\begin{document}
\begin{tabularx}{\textwidth}{@{}R cc cc c}
    \cmidrule[1pt]{2-6}
    & \textbf{2000} & \textbf{2005} & \textbf{2007} 
            & \textbf{2010} & \textbf{2012}         \\ \midrule
Global Electricity Consumption (Million MWh)              
    &   1   &   6   &   7   &   12  &   13          \\ %\hhline{-||-----}
Global Data Center Electricity Use (Million MWh)         
    &   2   &   5   &   8   &   11  &   14          \\ %\hhline{-||-----}
Data Center as Fraction of Global Electricity Consumption 
    & 3\%   & 4\%   & 9\%   & 10\%  & 15\%          \\ %\hhline{-||-----}
    \bottomrule[1pt]
\end{tabularx}
\end{document}
  • 7
    (+1) for the booktabs solution. This looks so much better! – user36296 Aug 26 '16 at 13:19
  • 1
    yea. It is really terrible, when people try to mimic a design of excel tables and their fancy borders in LaTeX. – Zarko Aug 26 '16 at 14:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.