【问题标题】:How to fix a specific width for tables keep right instead of left from latex?如何固定表格的特定宽度保持在乳胶的右侧而不是左侧?
【发布时间】:2021-12-27 19:09:32
【问题描述】:

我有一个表格需要用latex写,然后我需要使用下面的代码来制作一个表格。

\begin{table}[]
\begin{tabular}{|l|r|}
\hline
\textbf{Item}         & \textbf{Amount} \\ \hline
User Account          & 15,763          \\ \hline
Original Post         & 56,797          \\ \hline
Post Reply            & 1,515,618       \\ \hline
Post (Original+Reply) & 1,572,415       \\ \hline
Adopted Post          & 88,240          \\ \hline
\end{tabular}
\end{table}

但是,它不能设置特定的宽度。当我想写 \begin{tabular}{|l{3.8}|r{3.8}|} 时,它不起作用。

如果我使用 p{3.8cm},它确实有效。但是,它不是靠右,而是靠左。

我想从表格中创建一个特定的宽度并将其设置为保持右侧而不是左侧。

谁能帮帮我?谢谢!!

【问题讨论】:

    标签: latex xelatex overleaf


    【解决方案1】:
    \documentclass{article}
    
    \usepackage{array}
    
    \begin{document}
    
    \begin{table}[]
    \begin{tabular}{|l|>{\raggedleft\arraybackslash}p{3.8cm}|}
    \hline
    \textbf{Item}         & \textbf{Amount} \\ \hline
    User Account          & 15,763          \\ \hline
    Original Post         & 56,797          \\ \hline
    Post Reply            & 1,515,618       \\ \hline
    Post (Original+Reply) & 1,572,415       \\ \hline
    Adopted Post          & 88,240          \\ \hline
    \end{tabular}
    \end{table}
    
    
    \end{document}
    

    【讨论】:

      猜你喜欢
      • 2012-07-30
      • 1970-01-01
      • 1970-01-01
      • 2018-03-11
      • 2011-03-08
      • 2010-10-02
      • 1970-01-01
      • 2017-12-06
      • 1970-01-01
      相关资源
      最近更新 更多