0

Any suggestions my the table width is extending beyond the page. The generated code is as follows:

      \documentclass[a4paper, 12pt]{article} 
       \usepackage[margin=2cm]{geometry}
       \usepackage{tabulary}
       \usepackage{tabularx}
       \usepackage{varioref}
       \usepackage{multirow}
       \usepackage{booktabs}
       \usepackage[svgnames,table]{xcolor}  
       \usepackage{amsmath}
       \usepackage{amsthm} 
        \usepackage{mathpazo}
        \usepackage{eucal}
        \usepackage{mathrsfs}
        \usepackage{lmodern}
        \usepackage{cuted}
       \usepackage[utf8]{inputenc}
       \usepackage[T1]{fontenc}
       \usepackage[english]{babel}
       \usepackage{graphicx}
       \usepackage{amssymb}
       \usepackage{mathtools}
       \usepackage{array}
      \usepackage[justification=centering]{caption}
      \usepackage[english]{babel}
       \usepackage{siunitx} 
       \usepackage[onehalfspacing]{setspace}                        
     \newcolumntype{C}{>{\centering\arraybackslash}X}
      \usepackage{rotating}
      \usepackage{siunitx}
      \usepackage{xparse,xstring} 
       \usepackage{varioref}  
    \usepackage[colorlinks,allcolors=blue]{hyperref}
    \usepackage[nameinlink,noabbrev]{cleveref} 
      \crefname{equation}{eq.}{eq.}
        %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       \DeclareRobustCommand{\variablename}[1]{\mathop{\textnormal{\slshape #1}}\nolimits}
       \newcommand{\COVID}{\variablename{COVID\_19}}
       \newcommand{\China}{\variablename{F\_China}}
         \newcommand{\World}{\variablename{F\_World}}
        \newcommand{\ln}{\variablename{\ln}}
       %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
       \def\Plus{\texttt{+}}
       \def\Minus{\texttt{-}}
          %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        \newcolumntype{d}[1]{D..{#1}}
        \newcommand\mc[1]{\multicolumn{1}{c}{#1}}
             %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    \begin{document}
     \begin{table}[htbp]
      \centering
      \def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
      \caption{Summary of Sign restrictions}
     \label{tab1}
     \begin{tabular}{l*{8}{c}}
    \toprule
    &F^{Ener}_{t}& F^{Prec_m}_{t}& F^{Ind_m}_{t}& F^{Agr}_{t}} & F^{Live_s}_{t}& 
    R^{\COVID}_{\substack{World}}& F^{China}_{j,t} & R^{\COVID}_{\substack{China}}   \\                
    \midrule
    Foreign Energy Price         &\Plus&\Plus&\Plus&\times&\times&\times&\times  \\               
    \midrule
    Foreign Precious metals Price& \Plus&\Plus&\Minus&\Minus&\Minus&\times&\times    \\
   \midrule
    Foreign Industrial metals Price   & \Plus&\Plus&\Minus&\Minus&\Minus&\times&\times    \\
    \midrule
     Foreign Agricultural Price   & \Plus&\Plus&\Minus&\Minus&\Minus&\times&\times    \\
  \midrule
  Foreign Livestock Price   & \Plus&\Plus&\Minus&\Minus&\Minus&\times&\times   \\
  \midrule
  World $R^{\COVID}_{\substack{World}}$    & \Plus&\Plus&\Minus&\Minus&\Minus&\times&\times   \\
   \midrule
   China Domestic factors    & \Plus&\Plus&\Minus&\Minus&\Minus&\times&\times    \\
  \midrule
  China $R^{\COVID}_{\substack{China}}$  & \Plus&\Plus&\Minus&\Minus&\Minus&\times&\times    \\ 
  \bottomrule
    \end{tabular}
    \end{table}
    \end{document}

My Output: enter image description here

  • Can you shorten the entries of the first column? – leandriis Nov 30 '20 at 14:10
  • @leandriis it solves the problems but I want to have a more specific column, Thanks for the clever suggestion – haithem Nov 30 '20 at 14:25
  • @leandriis maybe i could add "foreign" as footnote – haithem Nov 30 '20 at 14:27
  • add \footnotesize right after \begin{table}[htbp] – Lupino Nov 30 '20 at 14:45
0

You can turn the headers sideways. The rotating package provides an environment \begin{sideways}...\end{sideways}

enter image description here

\documentclass[a4paper, 12pt]{article} 
\usepackage{booktabs}
\usepackage{amsmath}
\usepackage{rotating}
\newcommand\sw[1]{\begin{sideways}$#1$\end{sideways}}
\DeclareRobustCommand{\variablename}[1]{\mathop{\textnormal{\slshape #1}}\nolimits}
\newcommand{\COVID}{\variablename{COVID\_19}}
\def\Plus{\texttt{+}}
\def\Minus{\texttt{-}}
\begin{document}
\noindent
\begin{tabular}{l*{8}{c}}
  \toprule
  &\sw{F^{Ener}_{t}}& \sw{F^{Prec_m}_{t}}& \sw{F^{Ind_m}_{t}}& \sw{F^{Agr}_{t}}
  &\sw{F^{Live_s}_{t}}& \sw{R^{\COVID}_{\substack{World}}}& \sw{F^{China}_{j,t}} & \sw{R^{\COVID}_{\substack{China}}}   \\                
  \midrule
  Foreign Energy Price         &\Plus&\Plus&\Plus&$\times$&$\times$&$\times$&$\times$  \\               
  \midrule
  Foreign Precious metals Price& \Plus&\Plus&\Minus&\Minus&\Minus&$\times$&$\times$    \\
  \midrule
  Foreign Industrial metals Price   & \Plus&\Plus&\Minus&\Minus&\Minus&$\times$&$\times$    \\
  \midrule
  Foreign Agricultural Price   & \Plus&\Plus&\Minus&\Minus&\Minus&$\times$&$\times$    \\
  \midrule
  Foreign Livestock Price   & \Plus&\Plus&\Minus&\Minus&\Minus&$\times$&$\times$   \\
  \midrule
  World $R^{\COVID}_{\substack{World}}$    & \Plus&\Plus&\Minus&\Minus&\Minus&$\times$&$\times$   \\
  \midrule
  China Domestic factors    & \Plus&\Plus&\Minus&\Minus&\Minus&$\times$&$\times$    \\
  \midrule
  China $R^{\COVID}_{\substack{China}}$  & \Plus&\Plus&\Minus&\Minus&\Minus&$\times$&$\times$    \\ 
  \bottomrule
\end{tabular}
\end{document}
0

An acceptable compromise could be:

        \begin{tabular}{>{\raggedright}m{90pt}*{8}{c}} % changed <<<
        \toprule
     & $F^{Ener}_{t}$ & $ F^{Prec_m}_{t}$ & $F^{Ind_m}_{t}$ & $ F^{Agr}_{t} $ & $ F^{Live_s}_{t}$ & $R^{\COVID}_{\substack{World}}$ & $ F^{China}_{j,t}$ & $ R^{\COVID}_{\substack{China}}$   \\                
        \midrule
        Foreign Energy Price & \Plus & \Plus & \Plus & \times & \times & \times & \times  \\               
        \midrule
        Foreign Precious metals Price & \Plus & \Plus & \Minus & \Minus & \Minus & \times & \times    \\
        \midrule
        Foreign Industrial metals Price & \Plus & \Plus & \Minus & \Minus & \Minus & \times & \times    \\
        \midrule
        Foreign Agricultural Price & \Plus & \Plus & \Minus & \Minus & \Minus & \times & \times    \\
        \midrule
        Foreign Livestock Price & \Plus & \Plus & \Minus & \Minus & \Minus & \times & \times   \\
        \midrule
        World $R^{\COVID}_{\substack{World}}$ & \Plus & \Plus & \Minus & \Minus & \Minus & \times & \times   \\
        \midrule
        China Domestic factors & \Plus & \Plus & \Minus & \Minus & \Minus & \times & \times    \\
        \midrule
        China $R^{\COVID}_{\substack{China}}$ & \Plus & \Plus & \Minus & \Minus & \Minus & \times & \times    \\ 
        \bottomrule
    \end{tabular}

out6

(added \def\times{\texttt{x}} to preamble.)

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.