Ich verwende Multicolumn unter tabularx sehr oft. Anstatt Leerzeichen zu entfernen
\multicolumn{2}{@{}l}{...}
Ich möchte eine neue Umgebung erstellen, die nachstehende Leerzeichen sowohl vorne als auch hinten entfernt. Gibt es Vorschläge, wie ich das auch machen kann? Danke.
Grüße,
Bearbeiten :
Wenn ich den folgenden Code verwende,
\begin{tabularx}{\textwidth}{@{}Xc@{}}
\toprule\toprule
Some random text & 1,75,650\\\midrule
\multicolumn{2}{@{}l}{\textbf{Panel A1: AAA}} \\\midrule
Number of observations ... & 1,75,650\\
Ich bekomme
Aber wenn ich verwende (@{} aus Multicloud entfernt)
\begin{tabularx}{\textwidth}{@{}Xc@{}}
\toprule\toprule
Some random text & 1,75,650\\\midrule
\multicolumn{2}{l}{\textbf{Panel A1: AAA}} \\\midrule
Number of observations ... & 1,75,650\\
Ich bekomme
Da ich \multicolumn{2}{@{}l} mehrmals verwenden müsste, wollte ich eine neue Umgebung erstellen, die sich um @{} kümmert.
Falls jemand MWE sucht:
\documentclass{article}
\usepackage{ltablex}
\usepackage{threeparttable}
\usepackage{booktabs}
\title{Document}
\begin{document}
\maketitle
\begin{tabularx}{\textwidth}{Xc}
\toprule\toprule
Some random text & 1,75,650\\\midrule
\multicolumn{2}{l}{\textbf{Panel A1: AAA}} \\\midrule
Number of observations ... & 1,75,650\\
Delete: ... & (78,420)\\
Delete: ... & (7,104)\\
Final sample & 90,126\\
Delete: & (2,143)\\
Delete: & (8,345)\\
Final sample & 79,638\\\midrule
\multicolumn{2}{l}{\textbf{Panel A2: AAA}} \\\midrule
Number of observations & 79,638\\
Delete: & (39,540)\\
Delete: & (7,979) \\
Final sample & 32,119 \\\midrule
\multicolumn{2}{l}{\textbf{Panel B1: BBB }} \\\midrule
Number of observations & 1,75,650\\
Delete: & (78,420)\\
Delete: & (47,136)\\
Delete: & (7,178)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Final sample & 42,884\\\midrule
\multicolumn{2}{l}{\textbf{Panel B2: BBB}} \\\midrule
Number of observations & 1,75,650\\
Delete: & (78,420)\\
Delete: & (47,136)\\
Delete: & (7,178)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Number of observations & 1,75,650\\
Delete: & (78,420)\\
Delete: & (47,136)\\
Delete: & (7,178)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Final sample & 42,884\\\midrule\bottomrule
\end{tabularx}
\end{document}
Bearbeiten: Falls es jemanden interessiert, so habe ich es definiert:
\newcommand{\gmc}[2]{\multicolumn{#1}{@{}#2@{}}}
Antwort1
Ein Beispiel mit tabularray
und einem neuen Tabellenbefehl \gmc
:
\documentclass[twocolumn]{article}
\usepackage{tabularray}
\UseTblrLibrary{booktabs}
\NewTableCommand{\gmc}{\SetCell[c=2]{l}\SetRow{font=\bfseries}}
\DefTblrTemplate{contfoot-text}{default}{To be continued}
\DefTblrTemplate{conthead-text}{default}{(continued)}
\title{Document}
\author{}
\begin{document}
\maketitle
\begin{longtblr}[
caption={A table \emph{without} initial and final space before the columns}
]{
colspec={Xc},
column{1}={leftsep=0pt},
column{Z}={rightsep=0pt},
}
\toprule\toprule
Some random text & 1,75,650\\\midrule
\gmc Panel A1: AAA \\\midrule
Number of observations ... & 1,75,650\\
Delete: ... & (78,420)\\
Delete: ... & (7,104)\\
Final sample & 90,126\\
Delete: & (2,143)\\
Delete: & (8,345)\\
Final sample & 79,638\\\midrule
\gmc Panel A2: AAA \\\midrule
Number of observations & 79,638\\
Delete: & (39,540)\\
Delete: & (7,979) \\
Final sample & 32,119 \\\midrule
\gmc Panel B1: BBB \\\midrule
Number of observations & 1,75,650\\
Delete: & (78,420)\\
Delete: & (47,136)\\
Delete: & (7,178)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Final sample & 42,884\\\midrule
\gmc Panel B2: BBB\\\midrule
Number of observations & 1,75,650\\
Delete: & (78,420)\\
Delete: & (47,136)\\
Delete: & (7,178)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Number of observations & 1,75,650\\
Delete: & (78,420)\\
Delete: & (47,136)\\
Delete: & (7,178)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Final sample & 42,884\\\midrule\bottomrule
\end{longtblr}
\begin{longtblr}[
caption={A table \emph{with} initial and final space before the columns}
]{
colspec={Xc}
}
\toprule\toprule
Some random text & 1,75,650\\\midrule
\gmc Panel A1: AAA \\\midrule
Number of observations ... & 1,75,650\\
Delete: ... & (78,420)\\
Delete: ... & (7,104)\\
Final sample & 90,126\\
Delete: & (2,143)\\
Delete: & (8,345)\\
Final sample & 79,638\\\midrule
\gmc Panel A2: AAA \\\midrule
Number of observations & 79,638\\
Delete: & (39,540)\\
Delete: & (7,979) \\
Final sample & 32,119 \\\midrule
\gmc Panel B1: BBB \\\midrule
Number of observations & 1,75,650\\
Delete: & (78,420)\\
Delete: & (47,136)\\
Delete: & (7,178)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Final sample & 42,884\\\midrule
\gmc Panel B2: BBB\\\midrule
Number of observations & 1,75,650\\
Delete: & (78,420)\\
Delete: & (47,136)\\
Delete: & (7,178)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Number of observations & 1,75,650\\
Delete: & (78,420)\\
Delete: & (47,136)\\
Delete: & (7,178)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Delete: & (32)\\
Final sample & 42,884\\\midrule\bottomrule
\end{longtblr}
\end{document}
Off-Topic: Ihre Zahl 1.75.650 ist ziemlich seltsam.