Ich verstehe nicht, warum ich im folgenden Code (ich weiß, ich muss die Präambel vielleicht noch ein wenig aufpolieren) „Variablen“ nicht linksbündig ausrichten kann. Ich habe verschiedene Lösungen ausprobiert, aber es bleibt immer noch zentriert.
Ein weiteres (kleineres und weniger wichtiges) Problem ist, dass ich versucht habe, die Reihenfolge der Spalten zu ändern und die Beschreibung ans Ende zu setzen. Allerdings erhalte ich immer eine Fehlermeldung. Irgendeine Idee?
\documentclass[11pt]{article}
\usepackage{rotating}
\usepackage{longtable}
\usepackage[labelfont=bf, labelsep=newline, justification=centering, textfont=it]{caption}
\usepackage{adjustbox}
\usepackage{graphicx}
\usepackage{booktabs, makecell, siunitx}
\usepackage{eqparbox}
\pagenumbering{gobble}
\usepackage{booktabs}
\usepackage[referable,para]{threeparttablex}
\usepackage[a4paper,margin=1.5cm]{geometry}
\usepackage{multirow}
\usepackage{pdflscape}
\usepackage{stackengine}
\usepackage{interval}
\usepackage{amsmath,ragged2e} % <-- new
\usepackage{interval,pbox}
\usepackage{booktabs,tabularx}
\sisetup{group-separator={,}, table-format=1.3, table-space-text-post=***,
table-number-alignment =center}
\newcommand*{\MyIndent}
{\hspace*{1.5cm}}
\usepackage{dcolumn}
\newcolumntype{d}[1]{D..{#1}}
\newcommand\mc[1]{\multicolumn{1}{c}{#1}} % handy shortcut macro
\newcommand\mytab[1]{%
\smash[b]{\begin{tabular}[c]{@{}c@{}}#1\end{tabular}}}
\hyphenation{bur-kina}
\begin{document}
\begin{table}
\renewcommand{\arraystretch}{1.5}
\caption{Descriptions of variables\label{A1}}
\begin{tabularx}{\textwidth}{@{}lXSS@{}}
\toprule
\multicolumn{1}{l}{Variables}&\mc{Description}&\mc{Mean}&\mc{SD}\\
\midrule
Health&Test of a really long description which should itself span many rows, in fact occupying much space, hopefully, causing it to span a couple of normal rows. Test of a really long description which should itself span many rows, in fact occupying much space, hopefully, causing it to span a couple of normal rows&\mc{0.8049}&\mc{0.3928}\\
Age&Test of a really long description which should itself span many rows, in fact occupying much space, hopefully, causing it to span a couple of normal rows&\mc{49.16}&\mc{15.82}\\
\bottomrule
\end{tabularx}
\end{table}
\end{document}
Antwort1
Etwas wie das?
\documentclass[11pt]{article}
\usepackage{rotating}
\usepackage{longtable}
\usepackage[labelfont=bf, labelsep=newline, justification=centering, textfont=it]{caption}
\usepackage{adjustbox}
\usepackage{graphicx}
\usepackage{booktabs, makecell, siunitx}
\usepackage{eqparbox}
\pagenumbering{gobble}
\usepackage{booktabs}
\usepackage[referable,para]{threeparttablex}
\usepackage[a4paper,margin=1.5cm]{geometry}
\usepackage{multirow}
\usepackage{pdflscape}
\usepackage{stackengine}
\usepackage{interval}
\usepackage{amsmath,ragged2e} % <-- new
\usepackage{interval,pbox}
\usepackage{booktabs,tabularx}
\sisetup{group-separator={,}, table-format=1.3, table-space-text-post=***,
table-number-alignment =center}
\newcommand*{\MyIndent}
{\hspace*{1.5cm}}
\usepackage{dcolumn}
\newcolumntype{d}[1]{D..{#1}}
\newcommand\mc[1]{\multicolumn{1}{c}{#1}} % handy shortcut macro
\newcommand\mytab[1]{%
\smash[b]{\begin{tabular}[c]{@{}c@{}}#1\end{tabular}}}
\hyphenation{bur-kina}
\begin{document}
\begin{table}
\renewcommand{\arraystretch}{1.5}
\caption{Descriptions of variables\label{A1}}
\begin{tabularx}{\textwidth}{@{}lXSS@{}}
\toprule
\multicolumn{1}{@{}l}{Variables}&\mc{Description}&\mc{Mean}&\mc{SD}\\ % @{} here
\midrule
Health&Test of a really long description which should itself span many rows, in fact occupying much space, hopefully, causing it to span a couple of normal rows. Test of a really long description which should itself span many rows, in fact occupying much space, hopefully, causing it to span a couple of normal rows&\mc{0.8049}&\mc{0.3928}\\
Age&Test of a really long description which should itself span many rows, in fact occupying much space, hopefully, causing it to span a couple of normal rows&\mc{49.16}&\mc{15.82}\\
\bottomrule
\end{tabularx}
\end{table}
\end{document}