Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Line cut in \tabularx{}

I have a code below. I would like to remove the white space before the highlighted part. image

 \documentclass[10pt,english,8pt]{beamer}
\usetheme{default}
\usepackage{booktabs}
\usepackage{tabularx}
%\newcommand{\iid}{\stackrel{\mathrm{iid}}{\sim}}
\newcolumntype{C}{>{\centering\arraybackslash}X}
\newcolumntype{R}{>{\raggedright\arraybackslash}X}
\newcolumntype{L}{>{\raggedleft\arraybackslash}X}


\title{Beamer Template}
\author{TeXstudio Team}
\begin{document}


\begin{frame}{Frame Title}

    \begin{table}[htbp]
        %\begin{table}[!ht]
        \centering
        \scriptsize
        %\caption{Title }
        \label{tab:5}
        \begin{tabularx}{1\textwidth}
            {>{\raggedright\arraybackslash}p{2cm}
                >{\centering\arraybackslash}p{1.75cm}
                >{\centering\arraybackslash}p{1.75cm}
                >{\centering\arraybackslash}p{1.75cm}
                >{\centering\arraybackslash}p{1.75cm}
            }
            %\multicolumn{11}{@{}p{1\textwidth}@{}}{\footnotesize 
                %   Caption }\\
            \toprule 
            
            & Log Probability of Default & Log Recovery Rate
            & Log Spread & Log Leverage  \\ [0.5ex] 
            & (1) & (2) & (3) & (4)  \\
            \midrule
            Log Damage 
            &0.017**    &-0.003***   & 0.002 & -0.157    \\
            &(0.0008)   &(0.003)   & (0.075) & (0.178)  \\
            Log Adaptation
            &-0.157***  &0.012  &-0.463** & 0.514*** \\
            &(0.021)    &(0.007)    &(0.182)    &(0.193)\\
            Log Damage X Log Adaptation
            &0.006  &0.018* &-0.398 &0.535 \\
            &(0.030) &(0.011) &(0.249) &(0.513)\\
            Constant
            &-1.227***&-0.117***&2.244***&0.101\\
            &(0.026)&(0.009)&(0.187)&(0.237)\\                      
            \midrule
            Observations &926 &925 &458 &177 \\
            $R^2$ &41\% &19\% &8\%  &38\%\\
            Adjusted $R^2$ &40\%&17\%&4\%&32\%\\
            Residual Std. Error 
            & 0.071 &   0.025 & 0.373 & 0.264 \\
            & (df = 907) & (df = 906) & (df = 439) & (df = 159)\\
            F Statistic 
            & 35.253*** &   11.455*** & 2.104***  & 5.811***  \\
            & (df = 18; 907)&   (df = 18; 906)& (df = 18; 439)& (df = 17; 159)\\
            
            
            \bottomrule 
            \addlinespace
            \multicolumn{4}{@{}p{0.8\textwidth}@{}}{\footnotesize \tiny{Note: *p<0.1; **p<0.05; ***p<0.01 }} \\
        \end{tabularx}
        %\end{table}
    \end{table}
    
\end{frame}

    

\end{document}

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

  • Log Damage X Log Adaptation is too long to fit into a single cell. The easiest fix is to manually move the second part of the phrase into the next line.

  • If you are using a tabularx, you should use at least one X column to make sure the table can adapt to the available space

  • I would use @{} in front and after the other columns to get rid of the extra space

  • To make reading the table easier, I would add some additional vertical space between the blocks

  • Are you abusing the poor X as multiplication sign? Don’t!

  • the syntax \tiny{...} is wrong. It is a switch and does not take an argument. Use {\tiny ...} instead.

  • Missing math mode around the < signs

  • most of your table should be in math mode to get correct minus sign and proper spacing around operators, but I’m too lazy to add this in the example below…

 \documentclass[10pt,english,8pt]{beamer}
\usetheme{default}
\usepackage{booktabs}
\usepackage{tabularx}

%\newcommand{\iid}{\stackrel{\mathrm{iid}}{\sim}}
\newcolumntype{C}{>{\centering\arraybackslash}X}
\newcolumntype{R}{>{\raggedright\arraybackslash}X}
\newcolumntype{L}{>{\raggedleft\arraybackslash}X}


\title{Beamer Template}
\author{TeXstudio Team}
\begin{document}


\begin{frame}{Frame Title}

    \begin{table}[htbp]
        %\begin{table}[!ht]
        \centering
        \scriptsize
        %\caption{Title }
        \label{tab:5}
        \begin{tabularx}{1\textwidth}
            {
                @{}
                >{\raggedright\arraybackslash}X
                >{\centering\arraybackslash}p{1.75cm}
                >{\centering\arraybackslash}p{1.75cm}
                >{\centering\arraybackslash}p{1.75cm}
                >{\centering\arraybackslash}p{1.75cm}
                @{}
            }
            %\multicolumn{11}{@{}p{1\textwidth}@{}}{\footnotesize 
                %   Caption }\\
            \toprule 
            
            & Log Probability of Default & Log Recovery Rate
            & Log Spread & Log Leverage  \\ [0.5ex] 
            & (1) & (2) & (3) & (4)  \\
            \midrule
            Log Damage 
            &0.017**    &-0.003***   & 0.002 & -0.157    \\
            &(0.0008)   &(0.003)   & (0.075) & (0.178)  \\\addlinespace
            Log Adaptation
            &-0.157***  &0.012  &-0.463** & 0.514*** \\
            &(0.021)    &(0.007)    &(0.182)    &(0.193)\\\addlinespace
            Log Damage $\times$ 
            &0.006  &0.018* &-0.398 &0.535 \\
            Log Adaptation &(0.030) &(0.011) &(0.249) &(0.513)\\\addlinespace
            Constant
            &-1.227***&-0.117***&2.244***&0.101\\
            &(0.026)&(0.009)&(0.187)&(0.237)\\                      
            \midrule
            Observations &926 &925 &458 &177 \\
            $R^2$ &41\% &19\% &8\%  &38\%\\
            Adjusted $R^2$ &40\%&17\%&4\%&32\%\\\addlinespace
            Residual Std. Error 
            & 0.071 &   0.025 & 0.373 & 0.264 \\
            & (df = 907) & (df = 906) & (df = 439) & (df = 159)\\\addlinespace
            F Statistic 
            & 35.253*** &   11.455*** & 2.104***  & 5.811***  \\
            & (df = 18; 907)&   (df = 18; 906)& (df = 18; 439)& (df = 17; 159)\\
            
            
            \bottomrule 
            \addlinespace
            \multicolumn{4}{@{}p{0.8\textwidth}@{}}{\footnotesize {\tiny Note: *$p<0.1$; **$p<0.05$; ***$p<0.01$ }} \\
        \end{tabularx}
        %\end{table}
    \end{table}
    
\end{frame}

\end{document}

enter image description here

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading