テキスト内に表を収める

テキスト内に表を収める

最初の付録の表を作成しようとしていますが、次の 2 つの問題に直面しています。

  • 最初の列のテキストを左揃えにしたいと思います。
  • 列はテキストの幅に沿って均等に分散されていません。

ここで私が使用しているコードとその結果を示します。

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

つまり、L3 つの列すべてに列タイプを使用します。

ここに画像の説明を入力してください

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

関連情報