如何在表格数据中右移文本

如何在表格数据中右移文本

这是我正在编写的简单文档中的缩写代码。

\begin{tabular}{l l}  
        \textbf{VM} & Virtual Machine\\ 
        \textbf{AWS} & Amazon Web Services\\
        \textbf{GCP} & Google Cloud Platform \\
        \textbf{IaaS} & Infrastructure as a Service \\
        \textbf{PaaS} & Platform as a Service \\
        \textbf{SaaS} & Software as a Service \\
        \textbf{AaaS} & Authentication as a Service \\
        \textbf{CaaS} & Communication as a Service \\
        \textbf{EC2} & Proprietary Technology of Amazon,Stands for Elastic Compute Cloud \\
        \textbf{DaaS} & Desktop as a Service \\
        \textbf{Multi Tenant} & Multi tenant is a phrase used to describe multiple customers  using same cloud \\
        \textbf{Private Cloud} & Used to describe cloud implemented within corporate firewall.\\
        \textbf{Public Cloud} & Refers to cloud services provided to users over internet to any one who\\ purchases the service.\\
    \end{tabular}
\end{table} 

当我编译它时,最后一行

    \textbf{Public Cloud} & Refers to cloud services provided to users over internet to any one who\\ purchases the service.\\

这给我带来了问题,我想写更多的缩写,但随后它出现如下 缩写下方的最后一行
在上图中,我想 purchases the service.水平移动文本,但无法水平移动,因为它位于粗体缩写下方,这使我的文档变得难看。在这种情况下,我应该怎么做才能使文本向右移动,以便我可以添加更多缩写。

答案1

正如@leandriis 在评论中已经建议的那样,您可能需要使用一个tabularx环境,将其整体宽度设置为\textwidth,并使用X第二列(即右侧列)的列类型以允许自动换行,同时自动选择最大可能的列宽。

另一个建议:不要使用粗体对于第一列,除非你认为或者只是想向你的读者发出信号,“妈妈,看看我!我知道如何在 LaTeX 中使用粗体!“(因此根本就不顾及读者的感受,他们并不喜欢被大声呵斥)。即使满足其中一个条件,也不要将表格左侧列中的每个单词都包裹在\textbf包装器中;而是只需将l列说明符更改为>{\bfseries}l

在此处输入图片描述

\documentclass{article}
\usepackage{tabularx} % for 'tabularx' env. and 'X' col. type
\begin{document}
\section*{List of Abbreviations}
\begin{tabularx}{\textwidth}{@{} l X @{}}  
VM   & Virtual Machine\\ 
AWS  & Amazon Web Services\\
GCP  & Google Cloud Platform \\
IaaS & Infrastructure as a Service \\
PaaS & Platform as a Service \\
SaaS & Software as a Service \\
AaaS & Authentication as a Service \\
CaaS & Communication as a Service \\
EC2  & Proprietary Technology of Amazon, Stands for Elastic Compute Cloud \\
DaaS & Desktop as a Service \\
Multi Tenant  & Multi tenant is a phrase used to describe multiple customers  using same cloud \\
Private Cloud & Used to describe cloud implemented within corporate firewall\\
Public Cloud  & Refers to cloud services provided to users over internet to any one who purchases the service\\
\end{tabularx}
\end{document}

相关内容