整理凌乱的桌子

整理凌乱的桌子

我正在尝试用 Latex 制作一张桌子。现在我已经将我的大部分 Latex 经验结合到制作中(我还是新手),我以为我取得了很大的进步,直到我看到最终结果。

问题是文本太乱了,导致表格太长。老实说,我不知道该如何修复这个问题,如果能得到任何帮助,我将不胜感激。

以下是 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}

答案1

m表格版本的替代方案。在我看来,主要问题是列说明符的使用,该说明符用于垂直对齐在中间的文本。p建议的方法改为使用垂直对齐在顶部的段落文本。

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

为了进一步获得一些用于逐项列出的物品的空间,解决方案使用

\setlength{\leftmargini}{1em} 

将项目稍微向左移动。

在此处输入图片描述

代码

\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}

答案2

\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}

相关内容