Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am trying to make a table in Latex. Now I have combined most of my Latex experience in making this (I am still new) and I thought I was making good progress until I saw the end result.

The problem is that the text is all messed, and it makes the table too long. I honestly have no idea on how this can be fixed and I would appreciate any possible help.

Here is the MWE:

\documentclass[a4paper,10pt]{article}

\usepackage[table]{xcolor}
\usepackage[utf8]{inputenc}
\usepackage{tabularx}
\usepackage{array}

%define some nice colors
\definecolor{middleware_green}{RGB}{82, 119, 17}
\definecolor{middleware_white}{RGB}{255, 255, 255}
\definecolor{middleware_light_gray}{RGB}{239, 239, 239}
\definecolor{middleware_dark_gray}{RGB}{153, 153, 153}

%renewing commands for tabularx
\renewcommand{\tabularxcolumn}[1]{>{\small}m{#1}}

%new column type for test tables 
\newcolumntype{L}{>{\leavevmode\ignorespaces\raggedleft\arraybackslash\sffamily}X}%
\newcolumntype{C}{>{\leavevmode\ignorespaces\centering\arraybackslash\sffamily}X}%

\newcolumntype{R}{|>{\leavevmode\ignorespaces\color{magenta!70!black}\raggedright\sffamily\bfseries\footnotesize}p{2.5cm}}%
\newcolumntype{H}{|>{\leavevmode\ignorespaces\color{orange!30!black}\centering\arraybackslash\sffamily\footnotesize}X}%
\newcolumntype{J}{|>{\leavevmode\ignorespaces\color{green!30!black}\centering\sffamily\footnotesize}X}%
\newcolumntype{W}{|>{\leavevmode\ignorespaces\color{blue!30!black}\centering\arraybackslash\sffamily\footnotesize}X|}%


\begin{document}

\begin{table}[ph!]
\footnotesize\centering
\rowcolors{2}{middleware_white}{middleware_light_gray}

\begin{tabularx}{\textwidth}{|L|L|L|L|L|L|}
\hline\rowcolor{middleware_green}
\multicolumn{ 6}{|c|}{\small\textcolor{white}{\textbf{Cloud Types}}} \\ \hline
\rowcolor{middleware_dark_gray}
&   \multicolumn{1}{|C}{\textcolor{white}{\textbf{Pu\-blic cloud}}}             & 
    \multicolumn{1}{|C}{\centering\textcolor{white}{\textbf{Pri\-va\-te cloud}}}    & 
    \multicolumn{1}{|C}{\centering\textcolor{white}{\textbf{Hy\-brid cloud}}}       & 
    \multicolumn{1}{|C|}{\textcolor{white}{\textbf{Vir\-tu\-al pri\-va\-te cloud}}}     &
    \multicolumn{1}{|C|}{\textcolor{white}{\textbf{Com\-mu\-ni\-ty cloud}}}         \\ \hline
Definition  &   Focuses on sharing or renting services and infrastructures from external entities with several clients. In this type of cloud the resources are usually allocated dynamically during an undetermined amount of time.    &   Also known as internal clouds, these are designed for the exclusive use of a company. Depending on the contract, it may be maintained by the company itself, or by an external company. These clouds usually exist when the client has specific needs or when it wants a long term contract.    &   This is a combination of the public cloud with the private cloud, trying to overcome the limitations of both types while gaining the benefits from them. As the name suggest, in this type of cloud, part of the system is external to the client, while the other part is internally managed by him.   &   This is an alternative to attack the problems present in both private and public clouds. In this approach, the supplier of a public cloud has a has system of virtual private networks (VPNs) that allow him to define management and security protocols, thus effectively simulate a network of virtual servers and their connections. This is sometimes mistaken as a hybrid cloud, however the main difference is that in such a cloud, both public and private clouds are real, while in the one the private cloud is merely virtualized on the top of the public cloud.    &   This type of cloud is a shared cloud between several entities that share a common interest, such as politics, security or other.    \\ \hline
Advantages  &   \begin{itemize}
                 \item The client does not need initialization money to build the cloud because this money has already been invested by the supplier.
                 \item Migrates the responsibility and management of risks to the supplier.
                 \item Are usually a lot bigger than the private clouds.
                \end{itemize}
        &   \begin{itemize}
             \item The client has more control over the infrastructures, and can therefore have its own security and failure protocols.
             \item Easier and cheaper than buying a database.
            \end{itemize}
        &   \begin{itemize}
             \item More flexible than a private cloud or a public cloud.
             \item Provide more control than public clouds have easier scalability when compared to private clouds.
             \item Helps isolate and delegate the computational resources used, thus increasing the availability of the company's own resources.
            \end{itemize}
        &   \begin{itemize}
             \item Allows the client to use the provider's infrastructures as part of his own cloud.
             \item Allows the dynamic manipulation of the protocols defined.
             \item Easier to scale because the created servers are virtual.
            \end{itemize}
        &   \begin{itemize}
             \item Because it shares the costs, this option is the cheapest one.
            \end{itemize}
        \\  \hline
Disadvantages   &   \begin{itemize}
                     \item The client has no control over the data, security and network. 
                    \end{itemize}
        &   \begin{itemize}
             \item Criticized by being similar to private server farms, thus sharing all their problems including maintenance.
             \item Requires an initial investment to buy the necessary infrastructures.
            \end{itemize}
        &   \begin{itemize}
             \item Requires a careful analysis of what should go to the private cloud and what should go to the public one.
             \item Moving big amounts of data between the two clouds results in additional costs and stateful applications are harder to maintain.
            \end{itemize}
        &   \begin{itemize}
             \item Adds the complexity of migrating workload from the client to the supplier's cloud.
            \end{itemize}
        &   \begin{itemize}
             \item Because each company has specific security restrictions, this type of cloud has to manage them all at he same time, consequently not being very effective at doing it.
             \item There is little control over the resources because the environment in which they are is shared.
            \end{itemize}
        \\  \hline
\end{tabularx}
\caption{Cloud Types\label{tab:cloud_types}}
\end{table}



\end{document}
share|improve this question
2  
Please ask single questions like "how can I get a wider table" or "how do I use itemize in tables" or "how to align the first lines of text in table cells" or alike. It is not clear, what you are asking for. Until know, you have too much text in the cells. Easy to see this. Do you really need this? You will need to split your table then onto more pages or set the font to really small. You will find all this information on this homepage. I guess, all this would be much easier to solve in text with description or itemize. No need for green colours then... –  LaRiFaRi May 16 at 14:05
    
The problem is that I do not know what I need in order to fix this table ! I think I did everything alright, but the output clearly disagrees with me :S –  Flame_Phoenix May 16 at 15:01

2 Answers 2

up vote 2 down vote accepted

An alternative of table version. The main issue, in my view, is the use of m column specifier, which is for text vertically aligned in the middle. Use p for paragraph text vertically aligned at the top instead is what the proposed method did.

\renewcommand{\tabularxcolumn}[1]{>{\small}m{#1}}  % use p{#1} in the proposal

Further to gain some spaces for itemized item, the solutions uses

\setlength{\leftmargini}{1em} 

to move the item to the left a bit.

enter image description here

Code

\documentclass[a4paper,10pt]{article}
\usepackage[margin=0.5cm]{geometry}
\usepackage[table]{xcolor}
\usepackage[utf8]{inputenc}
\usepackage{tabularx,multirow}
\usepackage{array}

%define some nice colors
\definecolor{middleware_green}{RGB}{82, 119, 17}
\definecolor{middleware_white}{RGB}{255, 255, 255}
\definecolor{middleware_light_gray}{RGB}{239, 239, 239}
\definecolor{middleware_dark_gray}{RGB}{153, 153, 153}

%renewing commands for tabularx
\renewcommand{\tabularxcolumn}[1]{>{\small} p{#1}}
%new column type for test tables 
\newcolumntype{L}{>{\raggedright\arraybackslash\sffamily}X}%
\newcolumntype{C}{>{\centering\arraybackslash\sffamily}X}%


\begin{document}

\begin{table}[ph!]
\footnotesize\centering
\rowcolors{2}{middleware_white}{middleware_light_gray}

\begin{tabularx}{\textwidth}{|L|L|L|L|L|L|}
\hline\rowcolor{middleware_green}
\multicolumn{6}{|c|}{\small\textcolor{white}{\textbf{Cloud Types}}} \\ \hline
\rowcolor{middleware_dark_gray}
&   \multicolumn{1}{C|}{\textcolor{white}{\textbf{Pu\-blic cloud}}}             & 
    \multicolumn{1}{C|}{\centering\textcolor{white}{\textbf{Pri\-va\-te cloud}}}    & 
 \multicolumn{1}{C|}{\centering\textcolor{white}{\textbf{Hy\-brid cloud}}}       & 
    \multicolumn{1}{C|}{\textcolor{white}{\textbf{Vir\-tu\-al pri\-va\-te cloud}}}     &
    \multicolumn{1}{C|}{\textcolor{white}{\textbf{Com\-mu\-ni\-ty cloud}}}  \\ \hline
Definition
&   
Focuses on sharing or renting services and infrastructures from external entities with several clients. In this type of cloud the resources are usually allocated dynamically during an undetermined amount of time.    &   
Also known as internal clouds, these are designed for the exclusive use of a company. Depending on the contract, it may be maintained by the company itself, or by an external company. These clouds usually exist when the client has specific needs or when it wants a long term contract.    
&   
This is a combination of the public cloud with the private cloud, trying to overcome the limitations of both types while gaining the benefits from them. As the name suggest, in this type of cloud, part of the system is external to the client, while the other part is internally managed by him.   
&   
This is an alternative to attack the problems present in both private and public clouds. In this approach, the supplier of a public cloud has a has system of virtual private networks (VPNs) that allow him to define management and security protocols, thus effectively simulate a network of virtual servers and their connections. This is sometimes mistaken as a hybrid cloud, however the main difference is that in such a cloud, both public and private clouds are real, while in the one the private cloud is merely virtualized on the top of the public cloud.    
&   
This type of cloud is a shared cloud between several entities that share a common interest, such as politics, security or other.    \\ \hline  % 2nd column
Advantages  &   
\setlength{\leftmargini}{1em}
\begin{itemize}
\item The client does not need initialization money to build the cloud because this money has already been invested by the supplier.
\item Migrates the responsibility and management of risks to the supplier.
\item Are usually a lot bigger than the private clouds.
\end{itemize}
&   
\setlength{\leftmargini}{1em}
\begin{itemize}
\item The client has more control over the infrastructures, and can therefore have its own security and failure protocols.
\item Easier and cheaper than buying a database.
\end{itemize}
&   
\setlength{\leftmargini}{1em}
\begin{itemize}
\item More flexible than a private cloud or a public cloud.
\item Provide more control than public clouds have easier scalability when compared to private clouds.
\item Helps isolate and delegate the computational resources used, thus increasing the availability of the company's own resources.
\end{itemize}
&   
\setlength{\leftmargini}{1em}
\begin{itemize}
\item Allows the client to use the provider's infrastructures as part of his own cloud.
\item Allows the dynamic manipulation of the protocols defined.
\item Easier to scale because the created servers are virtual.
\end{itemize}
&   
\setlength{\leftmargini}{1em}
\begin{itemize}
\item Because it shares the costs, this option is the cheapest one.
\end{itemize}        \\  \hline
Disadvantages   
&   
\setlength{\leftmargini}{1em}
\begin{itemize}
\item The client has no control over the data, security and network. 
\end{itemize}
&   
\setlength{\leftmargini}{1em}
\begin{itemize}
\item Criticized by being similar to private server farms, thus sharing all their problems including maintenance.
\item Requires an initial investment to buy the necessary infrastructures.
\end{itemize}
&   
\setlength{\leftmargini}{1em}
\begin{itemize}
\item Requires a careful analysis of what should go to the private cloud and what should go to the public one.
\item Moving big amounts of data between the two clouds results in additional costs and stateful applications are harder to maintain.
\end{itemize}
&   
\setlength{\leftmargini}{1em}
\begin{itemize}
\item Adds the complexity of migrating workload from the client to the supplier's cloud.
\end{itemize}
&   
\setlength{\leftmargini}{1em}
\begin{itemize}
\item Because each company has specific security restrictions, this type of cloud has to manage them all at he same time, consequently not being very effective at doing it.
\item There is little control over the resources because the environment in which they are is shared.
\end{itemize}  \\  \hline
\end{tabularx}
\caption{Cloud Types\label{tab:cloud_types}}
\end{table}
\end{document}
share|improve this answer
    
Wow, this is exactly what I was looking for. Now I can play with the text a little more, but at least I have a basic structure to see ! Thanks! –  Flame_Phoenix May 16 at 15:22
    
You are welcome. –  Jesse May 16 at 15:25
\documentclass[a4paper,10pt]{article}

\usepackage[table]{xcolor}
\usepackage[utf8]{inputenc}
\usepackage{tabularx}
\usepackage{array}

%define some nice colors
\definecolor{middleware_green}{RGB}{82, 119, 17}
\definecolor{middleware_white}{RGB}{255, 255, 255}
\definecolor{middleware_light_gray}{RGB}{239, 239, 239}
\definecolor{middleware_dark_gray}{RGB}{153, 153, 153}

%renewing commands for tabularx
\renewcommand{\tabularxcolumn}[1]{>{\small}m{#1}}

%new column type for test tables 
\newcolumntype{L}{>{\leavevmode\ignorespaces\raggedleft\arraybackslash\sffamily}X}%
\newcolumntype{C}{>{\leavevmode\ignorespaces\centering\arraybackslash\sffamily}X}%

\newcolumntype{R}{|>{\leavevmode\ignorespaces\color{magenta!70!black}\raggedright\sffamily\bfseries\footnotesize}p{2.5cm}}%
\newcolumntype{H}{|>{\leavevmode\ignorespaces\color{orange!30!black}\centering\arraybackslash\sffamily\footnotesize}X}%
\newcolumntype{J}{|>{\leavevmode\ignorespaces\color{green!30!black}\centering\sffamily\footnotesize}X}%
\newcolumntype{W}{|>{\leavevmode\ignorespaces\color{blue!30!black}\centering\arraybackslash\sffamily\footnotesize}X|}%


\begin{document}

\subsection{Definitions}
\begin{description}
\item[Public Cloud]
 Focuses on sharing or renting services and infrastructures from external entities with several clients. In this type of cloud the resources are usually allocated dynamically during an undetermined amount of time.    
\item[Private Cloud]
   Also known as internal clouds, these are designed for the exclusive use of a company. Depending on the contract, it may be maintained by the company itself, or by an external company. These clouds usually exist when the client has specific needs or when it wants a long term contract.    
\item[Hybrid Cloud]
   This is a combination of the public cloud with the private cloud, trying to overcome the limitations of both types while gaining the benefits from them. As the name suggest, in this type of cloud, part of the system is external to the client, while the other part is internally managed by him.   
\item[Virtual Private Cloud]
   This is an alternative to attack the problems present in both private and public clouds. In this approach, the supplier of a public cloud has a has system of virtual private networks (VPNs) that allow him to define management and security protocols, thus effectively simulate a network of virtual servers and their connections. This is sometimes mistaken as a hybrid cloud, however the main difference is that in such a cloud, both public and private clouds are real, while in the one the private cloud is merely virtualized on the top of the public cloud.    
\item[Community by Cloud]
   This type of cloud is a shared cloud between several entities that share a common interest, such as politics, security or other.
\end{description}

\subsection{Advantages}
\begin{description}

  \item[Public Cloud]
   \begin{itemize}
                 \item The client does not need initialization money to build the cloud because this money has already been invested by the supplier.
                 \item Migrates the responsibility and management of risks to the supplier.
                 \item Are usually a lot bigger than the private clouds.
                \end{itemize}
\item[Private cloud]
           \begin{itemize}
             \item The client has more control over the infrastructures, and can therefore have its own security and failure protocols.
             \item Easier and cheaper than buying a database.
            \end{itemize}
\item[Hybrid cloud]
           \begin{itemize}
             \item More flexible than a private cloud or a public cloud.
             \item Provide more control than public clouds have easier scalability when compared to private clouds.
             \item Helps isolate and delegate the computational resources used, thus increasing the availability of the company's own resources.
            \end{itemize}
\item[Virtual private cloud]
           \begin{itemize}
             \item Allows the client to use the provider's infrastructures as part of his own cloud.
             \item Allows the dynamic manipulation of the protocols defined.
             \item Easier to scale because the created servers are virtual.
            \end{itemize}
\item[Community by cloud]
           \begin{itemize}
             \item Because it shares the costs, this option is the cheapest one.
            \end{itemize}
\end{description}

\subsection{Disdvantages}
\begin{description}


\item[Public Cloud]
 \begin{itemize}
                     \item The client has no control over the data, security and network. 
                    \end{itemize}
\item[Private Cloud]
           \begin{itemize}
             \item Criticized by being similar to private server farms, thus sharing all their problems including maintenance.
             \item Requires an initial investment to buy the necessary infrastructures.
            \end{itemize}
\item[Hybrid cloud]
           \begin{itemize}
             \item Requires a careful analysis of what should go to the private cloud and what should go to the public one.
             \item Moving big amounts of data between the two clouds results in additional costs and stateful applications are harder to maintain.
            \end{itemize}
\item[Virtual private cloud]
           \begin{itemize}
             \item Adds the complexity of migrating workload from the client to the supplier's cloud.
            \end{itemize}
\item[Community by cloud]
           \begin{itemize}
             \item Because each company has specific security restrictions, this type of cloud has to manage them all at he same time, consequently not being very effective at doing it.
             \item There is little control over the resources because the environment in which they are is shared.
            \end{itemize}
\end{description}



\end{document}
share|improve this answer
    
So, in your opinion, a Table is a terrible solution to output this information right? –  Flame_Phoenix May 16 at 15:04
    
@Flame_Phoenix Not quite what I said, but I don't think I'd use a table for this much text. That much footnotesize text on an actual paper would be unreadable (I probably ought to wear my glasses more often:-) –  David Carlisle May 16 at 16:02

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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