[Tex/LaTex] Table is not within the margins

tables

I have set margins using the geometry package (for my resume). I have put up the table but it is going beyond the margins. And, how to bring the Operating System text between the two lines? Please help!

The MWE:

\documentclass[12pt]{article}
\usepackage[left=2.54cm,right=2.54cm,top=2.54cm,bottom=2.54cm]{geometry}
\begin{document}
\begin{center}
\begin{tabular}{ l l }
\hline
\textbf{Operating Systems} & Windows XP, Windows 7, Windows 8 \\
& Ubuntu, Debian, Fedora \\
\hline
\textbf{Programming Languages} & C, C++, Core Java, Core Python, Basic C\#\\
\hline
\textbf{Web Technologies} & HTML5, CSS3, XML, Javascript, Node.js, PHP, JSP, ASP.NET\\
\hline
\textbf{Databases} & Oracle 10g, MySQL 5 \\
\hline
\textbf{Packages} & Netbeans 8.0, Microsoft Visual Studio 2008/2010/2012, Eclipse 5\\
\hline
\textbf{Linux} & Bash Shell Scripting
\end{tabular}
\end{center}
\end{document} 

enter image description here

Best Answer

This is one option that abuses multirow. Generally this shouldn't be done. But for this case it works.

\documentclass[12pt]{article}
\usepackage[left=2.54cm,right=2.54cm,top=2.54cm,bottom=2.54cm]{geometry}
   %\usepackage[margin=1in]{geometry}  %% this is short.
\usepackage{tabularx,multirow}
\begin{document}
\begin{center}
\begin{tabularx}{\textwidth}{>{\bfseries}lX}
\hline
\multirow{2}{*}{Operating Systems} & Windows XP, Windows 7, Windows 8,  Ubuntu, Debian, Fedora       \\
\hline
Programming Languages              & C, C++, Core Java, Core Python, Basic C\#                       \\
\hline
\multirow{2}{*}{Web Technologies}  & HTML5, CSS3, XML, Javascript, Node.js, PHP, JSP, ASP.NET        \\
\hline
Databases                          & Oracle 10g, MySQL 5                                             \\
\hline
\multirow{2}{*}{Packages}          & Netbeans 8.0, Microsoft Visual Studio 2008/2010/2012, Eclipse 5 \\
\hline
Linux                              & Bash Shell Scripting                                                                                       
\end{tabularx}
\end{center}
\end{document}

enter image description here

This is another version without abusing anything.

\documentclass[12pt]{article}
\usepackage[left=2.54cm,right=2.54cm,top=2.54cm,bottom=2.54cm]{geometry}
   %\usepackage[margin=1in]{geometry}  %% this is short.
\usepackage{array,calc}
\newlength{\mylen}
\setlength{\mylen}{\widthof{\textbf{Programming Languages}}}
\newcolumntype{L}{p{\dimexpr\textwidth-\mylen-4\tabcolsep\relax}}
\newcommand{\col}[1]{%       %% code stolen from egreg
  \begin{tabular}{@{}>{\raggedright}L@{}}
  \strut #1\strut
  \end{tabular}%
}
\begin{document}
\begin{center}
\begin{tabular}{>{\bfseries}ll}
\hline
Operating Systems     & \col{Windows XP, Windows 7, Windows 8,  Ubuntu, Debian, Fedora}       \\
\hline
Programming Languages & \col{C, C++, Core Java, Core Python, Basic C\#}                       \\
\hline
Web Technologies      & \col{HTML5, CSS3, XML, Javascript, Node.js, PHP, JSP, ASP.NET}        \\
\hline
Databases             & \col{Oracle 10g, MySQL 5}                                             \\
\hline
Packages              & \col{Netbeans 8.0, Microsoft Visual Studio 2008/2010/2012, Eclipse 5} \\
\hline
Linux                 & \col{Bash Shell Scripting}                                            
\end{tabular}
\end{center}
\end{document}

enter image description here

But, you will be better off using a list instead of tabular.

Related Question