1

I want to produce a table with no vertical lines and I used the following code:

\begin{table}[H]
    \centering
    \caption{Annualized Sharpe ratios for the mean reversion strategies.}\label{tab:1}
    \begin{tabular}{p{1.1in} p{0.5in} p{0.6in} p{0.4in} p{0.3in} p{0.5in}} 
        ~ & \textbf{CMSTNO  } & \textbf{RS-CMSTNO} & \textbf{HRP} & \textbf{MSR} & \textbf{S\&P500} \\ 
        Annualized mean & 16.47\% & 17.43\% & 8.72\% & 7.18\% & 11.38\% \\  
        Annualized st. deviation & 12.93\% & 12.70\% & 10.46\% & 8.78\% & 16.44\% \\  
        Skewness & -1.46 & -1.46 & -1.41 & -0.62 & -0.94 \\  
        Kurtosis & 5.53 & 5.27 & 7.76 & 4.07 & 8.01 \\  
        Volatility Skewness & 0.92 & 0.87 & 0.83 & 1.08 & 0.95 \\  
        Sharpe Ratio & 1.3 & 1.42 & 0.8 & 0.8 & 0.64 \\  
        Sortino Ratio & 0.24 & 0.26 & 0.16 & 0.162 & 0.133 \\  
        \hline
    \end{tabular}
\end{table} 

Nevertheless, some column names end up one of on top of the other (column name 1 and 2 in particular) and also the name of the second row, Annualized st. deviation, is printed on two rows.

Any idea on how to not have the row names printed on two rows/column names printed on top of each other?

Many thanks.

3
  • 3
    p colums are for paragraphs that can linebreak to the specified width you want the columns here to be the natural width of the data so r or better D (from dcolumn or S (from siunitx) so the numeric data aligns on the decimal point. Please provide the code as a small but complete document so we can run it, eg [H] option is not defined by default, and we have no idea how wide your column is to fit the table. May 13 '21 at 11:16
  • You indirectly answered my question, pointing me to the width of the column in inches. Thanks!
    – Vitomir
    May 13 '21 at 11:49
  • I'd also use horizontal lines from the booktabs package instead of \hline.
    – leandriis
    May 13 '21 at 13:13
3

enter image description here

Changes in comparison to the original:

  • l type column instead of p for the first column to prevent linebreaks
  • S type columns form siunitx to improve alignment of numbers in their columns
  • horizontal lines from the booktabs package instead of \hline for improved spacing around the horizontal lines
  • caption package for improved spacing between caption and table
  • tabular* in combination with \setlength{\tabcolsep}{0pt} and @{\extracolsep{\fill}} in order to make sure the table fits into the textwidth. (Probably net needed, depends on the documentclass/ available space)
  • removed bold in column headers to save space
  • abbreviated entry in the first column to save space
  • removed repeated \% and added this information into the first column instead in order to avoid repetition/ save space.

\documentclass{article}
\usepackage{booktabs}
\usepackage{siunitx}
\usepackage{caption}
\begin{document}
\begin{table}
    \caption{Annualized Sharpe ratios for the mean reversion strategies.}\label{tab:1}
    \setlength{\tabcolsep}{0pt}
    \begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}l *{3}{S[table-format=-2.2]} *{2}{S[table-format=-2.3]}}
    \toprule 
                                 & {CMSTNO} & {RS-CMSTNO} & {HRP} & {MSR} & {S\&P500} \\ 
         \midrule
        Annualized mean (\%)     & 16.47    & 17.43       & 8.72  & 7.18  & 11.38     \\  
        Annualized st. dev. (\%) & 12.93    & 12.70       & 10.46 & 8.78  & 16.44     \\  
        Skewness                 & -1.46    & -1.46       & -1.41 & -0.62 & -0.94     \\  
        Kurtosis                 & 5.53     & 5.27        & 7.76  & 4.07  & 8.01      \\  
        Volatility Skewness      & 0.92     & 0.87        & 0.83  & 1.08  & 0.95      \\  
        Sharpe Ratio             & 1.3      & 1.42        & 0.8   & 0.8   & 0.64      \\  
        Sortino Ratio            & 0.24     & 0.26        & 0.16  & 0.162 & 0.133     \\  
        \bottomrule
    \end{tabular*}
\end{table} 

\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.