1

I'm trying to remove the first column (RoE) in this example:

\documentclass[11pt]{article}
\usepackage{multirow}
\usepackage{tabularx}
\usepackage{booktabs}

\begin{document}

\begin{table}[htbp]
  \centering
  \footnotesize
  \caption{...}
    \makebox[\textwidth][c]{\begin{tabular}{@{\quad} l*{5}{c@{\hspace{8pt}}cp{0.1\tabcolsep}}cc}
    \toprule
          & \multicolumn{2}{c}{RoE} && 
          \multicolumn{2}{c}{RoA} && 
          \multicolumn{2}{c}{GP} && 
          \multicolumn{2}{c}{INV} && 
          \multicolumn{2}{c}{B/P}\\
          \cmidrule{2-3}\cmidrule{5-6}\cmidrule{8-9}\cmidrule{11-12} \cmidrule{14-15}
 &{US} & {EU} && {US} & {EU} && {US} & {EU} && {US} & {EU} && {US} & {EU}  \\
    \midrule
    \multicolumn{3}{l}{Panel A: Boardroom Description} \\
    \midrule
     \multicolumn{1}{l}{Size } & 2.51\% & -3.41\% && -0.63\% & -2.67\% && -4.40\% & -6.11\% && -4.10\% & -0.92\% && 0.05 & 0.18 \\ 
    \end{tabular}}%
  \label{tab:char}%
\end{table}%

\end{document}

Unfortunately, I have no clue how I would do this. Can anyone point me in the right direction?

My final table has over 30 rows, so I would like to refrain from manually removing all values that can be found within the table.

  • Could you please add a description, or even better a sketch, of the desired output? Do you only want to remove the text "RoE", or what exactly would you like to remove? Pease clarify. – leandriis Oct 20 '19 at 14:31
  • Please also add an explanation for the rather lengthy column declaration {@{\quad} l*{5}{c@{\hspace{8pt}}cp{0.1\tabcolsep}}cc} and the bunch of empty columns. Wouldn't it be sufficient, to use \cmidrule(lr)[4-5} instead of \cmidrule{4-5} and so on in order to get the small gap between adjacent cmidrule commands? – leandriis Oct 20 '19 at 14:33
  • You could also consider removing the repeated % signs and putting that information either into the column headers (or probably even into the caption). Like this you will save some horizontal space and might be able to easily fit your table into the textwidth without the need for commands like \makebox and with a probably a bit larger font size. – leandriis Oct 20 '19 at 14:38
  • @leandriis I'm sorry for being rather unclear. I'm a complete novice when it comes to LaTeX and I personally don't fully grasp what the column declaration does myself (I simply copied it from a previous question I posted, see: https://tex.stackexchange.com/questions/510699/multicolumn-layout/). What I would like is to remove the multicolumn within the table itself, as can be done with a regular column by applying one of the answers found here: https://tex.stackexchange.com/questions/16604/easiest-way-to-delete-a-column). Thanks for you reply regardless. – Menno Van Dijk Oct 20 '19 at 15:49
  • If you want to remove parts of your code, it might be best to use Regular Expressions and deploy some search-and-replace algorithm. For example something like /^.*?\&/gm would select everything between the start of a line in your document until the first &. This way, you could easily remove the first column from your table. You'd need to adjust the column count in the specification and in the \cline commands, of course. – Jasper Habicht Feb 29 '24 at 01:35

2 Answers2

0

Simpifyng the table and using \cmidrule(lr){1-2}... as suggested by @leandriis, you can get the following. Also, the %s can be moved up with the headers.

\documentclass[11pt]{article}
\usepackage{multirow}
\usepackage{tabularx}
\usepackage{booktabs}

\begin{document}

\begin{table}[htbp]
\centering
%\footnotesize
\caption{...}
\smallskip
\begin{tabular}{@{} *8{c} @{}}
\toprule
\multicolumn{2}{c}{RoA (\%)} & \multicolumn{2}{c}{GP (\%)} & \multicolumn{2}{c}{INV (\%)} & \multicolumn{2}{c}{B/P} \\  \cmidrule(lr){1-2} \cmidrule(lr){3-4} \cmidrule(lr){5-6} \cmidrule(lr){7-8}
US      & EU      & US      & EU      & US      & EU      & US   & EU   \\ \midrule
$-0.63$ & $-2.67$ & $-4.40$ & $-6.11$ & $-4.10$ & $-0.92$ & 0.05 & 0.18 \\ \bottomrule
\end{tabular}
\label{tab:char}
\end{table}

\end{document}

enter image description here

AboAmmar
  • 46,352
  • 4
  • 58
  • 127
0

It is not very clear, what you like to have. I understood, that you like to remove columns belong to RoA columns header (well, you only need to remove them from table, so what is really problem?).

enter image description here

(red lines indicate text borders)

Also why you define 25 columns and than use only 12 (before removing RoA part of table). According to my understanding of your request, it is sufficient to define 9 columns from which two are empty (serve to add space between columns groups):

\documentclass[11pt]{article}
\usepackage{booktabs,
            multirow,
            tabularx}
\usepackage[skip=1ex]{caption}

\begin{document}
    \begin{table}[ht]
\centering
\caption{...}
\label{tab:char}
\begin{tabular}{l cc p{0.5\tabcolsep} cc p{0.5\tabcolsep} cc}
    \toprule
        &   \multicolumn{2}{c}{GP  (\%)}
        &&  \multicolumn{2}{c}{INV (\%)}
        &&  \multicolumn{2}{c}{B/P (\%)} \\
        \cmidrule{2-3}\cmidrule{5-6}\cmidrule{8-9}
        & EU    & US    && EU       & US    && EU    & US      \\
    \midrule
\multicolumn{9}{l}{Panel A: Boardroom Description}          \\
    \midrule
Size    & -4.40 & -6.11 && -4.10    & -0.92 && 0.05 & 0.18  \\
    \bottomrule
\end{tabular}
    \end{table}
\end{document}
Zarko
  • 296,517
  • I'm a complete novice when it comes to LaTeX. My final table has over 30 columns, which makes it a rather tedious process to manually remove all columns from this table. I know that methods exist to remove columns from a table for regular columns (see https://tex.stackexchange.com/questions/16604/easiest-way-to-delete-a-column). However, I could not get the previous example to work for my table. – Menno Van Dijk Oct 20 '19 at 15:47
  • @MennoVanDijk, I notice, that you define far to much columns than you use, but i didn't comment this, I will ad that to my answer now. – Zarko Oct 20 '19 at 15:50