
我正在嘗試為我的第一個附錄建立一個表格,但我面臨以下兩個問題:
- 我想將第一列的文字向左對齊。
- 這些列沿著文字的寬度分佈不均勻。
我在這裡向您展示我正在使用的程式碼及其結果:
\usepackage{float}
\usepackage{adjustbox}
\usepackage{multicol}
\usepackage{longtable}
\renewcommand*\descriptionlabel[1]{\hspace\leftmargin$#1$}
\usepackage{array,ragged2e}
\newcolumntype{C}{>{\Centering\hspace{0pt}}p{0.1\textwidth}}
\usepackage[output-decimal-marker={,}]{siunitx}
\usepackage{booktabs, makecell, tabularx}
\newcolumntype{L}{>{\raggedright\arraybackslash}X}
\newcolumntype{P}[1]{>{\centering\arraybackslash}p{#1}}
\appendix
\section{Suppliers´ production capacities}
\begin{table}[ht]
\setcellgapes{3pt}
\makegapedcells
\begin{tabularx}{\linewidth}{@{}ccL@{}}
\toprule
Facility Name & Year & Overall Capacity \\
\midrule
Text & 2020 & 1.500 \\
Text & 2020 & 1.600 \\
Text & 2020 & 2.500 \\
\bottomrule
\end{tabularx}
\caption{Supplier facilities´ production capacities}
\end{table}
答案1
我想將第一列的文字向左對齊。
只是改變
\begin{tabularx}{\linewidth}{@{}ccL@{}}
到
\begin{tabularx}{\linewidth}{@{}lcL@{}}
這些列沿著文字的寬度分佈不均勻。
怎麼樣
\begin{tabularx}{\linewidth}{@{}LLL@{}}
即,L
對所有三列使用列類型。
\documentclass{article}
\usepackage{tabularx,ragged2e,booktabs}
\newcolumntype{L}{>{\RaggedRight}X}
\begin{document}
\begin{table}[ht]
\begin{tabularx}{\linewidth}{@{} LLL @{}}
\toprule
Facility Name & Year & Overall Capacity \\
\midrule
Text & 2020 & 1.500 \\
Text & 2020 & 1.600 \\
Text & 2020 & 2.500 \\
\bottomrule
\end{tabularx}
\caption{Supplier facilities' production capacities}
\end{table}
\end{document}