[Tex/LaTex] Fix column width with tabularx

tablestabularx

I want to create a table with 100% width? The first two columns should have a minimum width and the last column should have the rest width. The text in the last column (except the first cell) should be left aligned.

\documentclass[draft=on]{scrbook}
\usepackage{blindtext}
\usepackage{tabularx}

\begin{document}
\begin{tabularx}{\textwidth}{ccX}
  A & B & \multicolumn{1}{c}{C} \\
  A & B & \blindtext
\end{tabularx}
\end{document}

Best Answer

I wasn't sure about the "minimum width" column specification. Two possible options: the first one has two c type columns and an X column; the second one has two p{...} columns with centered content and an X column. Both tabularxs span the whole \textwidth (notice \noindent):

\documentclass{article}
\usepackage{showframe}
\usepackage{blindtext}
\usepackage{tabularx}

\newcolumntype{C}[1]{>{\centering}p{#1}}

\begin{document}
\noindent\frame{\begin{tabularx}{\textwidth}{cc>{\raggedright\arraybackslash}X}
  A & B & \multicolumn{1}{c}{C} \\
  A & B & \blindtext
\end{tabularx}}

\noindent\frame{\begin{tabularx}{\textwidth}{C{2cm}C{3cm}>{\raggedright\arraybackslash}X}
  A & B & \multicolumn{1}{c}{C} \\
  A & B & \blindtext
\end{tabularx}}

\end{document}

enter image description here

I added the showframe package and a frame around each table (using \frame) as visual guidelines. You can safely delete those in your code.

Related Question