0

Problem with the table it shows only in half

[![][1]][1]

\documentclass[11pt, english, singlespacing, ]{MastersDoctoralThesis} 

\usepackage[utf8]{inputenc} 
\usepackage[T1]{fontenc} 

\renewcommand{\chaptermarkformat}{\thechapter.~}

\usepackage{mathpazo} 
\usepackage[backend=bibtex,style=authoryear,natbib=true]{biblatex} % Use the bibtex backend with the authoryear citation style (which resembles APA)

\addbibresource{example.bib} 

\usepackage[autostyle=true]{csquotes} 

\usepackage{dirtytalk}

\usepackage{titlesec}

\setcounter{secnumdepth}{-10}

\renewcommand{\abovechapterskip}{\vspace*{2pt}}

\renewcommand\rightmark{Albania: Transition from Equality to Inequality}
\renewcommand\leftmark{Klisman Ndoje}

\usepackage{graphicx}

\usepackage[export]{adjustbox}

\usepackage{geometry}

\usepackage{siunitx}

\usepackage[referable]{threeparttablex}

\usepackage{array, caption, hhline, cellspace,  booktabs}


%--------------------------------------------------
\usepackage{amsthm, amsmath, amsfonts, mathtools, amssymb} %% Math packages 



%----------------------------------------------------------------------------------------
%   MARGIN SETTINGS
%----------------------------------------------------------------------------------------

\geometry{
    paper=a4paper, % Change to letterpaper for US letter
    inner=2.5cm, % Inner margin
    outer=3.8cm, % Outer margin
    bindingoffset=.5cm, % Binding offset
    top=1.5cm, % Top margin
    bottom=1.5cm, % Bottom margin
    %showframe, % Uncomment to show how the type block is set on the page
}

\begin{document}
\begin{table}

\caption{SCORING FACTORS AND SUMMARY STATSTICS FOR VARIABLES ENTERING THE COMPUTATION
OF THE FIRST PRINCIPAL COMPONENT}

\smallskip{}

\begin{tabular}{l>{\centering}p{1.4cm}cc>{\centering}p{2.2cm}> {\centering}p{1.3cm}>{\centering}p{1.3cm}>{\centering}p{1.3cm}}
\toprule 
& \multicolumn{4}{c}{All India} & \multicolumn{3}{c}{Means}\tabularnewline
\cmidrule(r){2-5}
\cmidrule(l){6-8}
& Scoring Factors & Mean & SD & Scoring Factor $\times$ SD & Poorest 40\% & 
Middle 40\% & Richest 20\%\tabularnewline
\midrule
\midrule 
Own Clock/Watch & 0.270 & 0.533 & 0.499 & 0.54 & 0.164 & 0.739 & 0.985\tabularnewline
Own Bicycle & 0.130 & 0.423 & 0.494 & 0.26 & 0.264 & 0.510 &         0.621\tabularnewline
Own Radio &  &  &  &  &  &  & \tabularnewline
Own Television &  &  &  &  &  &  & \tabularnewline
Own Sewing Machine &  &  &  &  &  &  & \tabularnewline
Own Motorcycle &  &  &  &  &  &  & \tabularnewline
Own Refigerator &  &  &  &  &  &  & \tabularnewline
Own Car &  &  &  &  &  &  & \tabularnewline
Drinking Water From  &  &  &  &  &  &  & \tabularnewline
Drinking Water From  &  &  &  &  &  &  & \tabularnewline
Drinking Water From  &  &  &  &  &  &  & \tabularnewline
Flush Toilet &  &  &  &  &  &  & \tabularnewline
Pit Toilet/Latrine &  &  &  &  &  &  & \tabularnewline
None/Other Toilet &  &  &  &  &  &  & \tabularnewline
Main Source of Lighting Electric &  &  &  &  &  &  & \tabularnewline
Number of Rooms in Dwelling &  &  &  &  &  &  & \tabularnewline
Kitchen a Seperate Room &  &  &  &  &  &  & \tabularnewline
Main Cooking Fuel Biomass  &  &  &  &  &  &  & \tabularnewline
Dwelling All High-Quality Materials &  &  &  &  &  &  & \tabularnewline
Dwelling All Low-Quality Materials &  &  &  &  &  &  & \tabularnewline
Own >6 acres Land &  &  &  &  &  &  & \tabularnewline
Economic Status Index &  &  &  &  &  &  & \tabularnewline
\bottomrule
\end{tabular}

\emph{Note: }bla bla bla

\emph{Source: }Bla bla bla
\end{table}
\end{document}
8
  • Probably your table is too wide for the \textwidth you have. You can play with different parameters to make it fit between the margins, but it's hard to say which without a full code.
    – Bernard
    Commented Jul 20, 2018 at 8:41
  • the full code of the document? or of the table? Commented Jul 20, 2018 at 8:42
  • The relevant part of the code – this includes the document class, font size, packages determining the layout, &c.
    – Bernard
    Commented Jul 20, 2018 at 8:44
  • below you will find the whole code Commented Jul 20, 2018 at 8:49
  • if you would consider my answer on your question (tex.stackexchange.com/questions/442333/…) , this will not happen.
    – Zarko
    Commented Jul 20, 2018 at 8:57

2 Answers 2

2

based on my answer on your question how-to-generate-a-table-as-below-in-latex. added are

  • real names in columns headers
  • real items in the first column
  • use of threeparttable, which enable to use \tnote (in column headers, see mwe below)
  • use os smaller font size (since your table is a bit to wide for space of \textwidth)

    \documentclass[11pt, english, singlespacing]{book}% i havent your document class {MastersDoctoralThesis}
    
    \usepackage{babel}
    \usepackage[T1]{fontenc}
    \usepackage{graphicx}
    
    
    \usepackage[paper=a4paper, % Change to letterpaper for US letter
                inner=2.5cm, % Inner margin
                outer=3.8cm, % Outer margin
                bindingoffset=.5cm, % Binding offset
                top=1.5cm, % Top margin
                bottom=1.5cm, % Bottom margin
                showframe, % Uncomment to show how the type block is set on the page
                ]
                {geometry}
    
    \usepackage{siunitx}
    \usepackage{booktabs, makecell}
    \usepackage[referable]{threeparttablex}
    
    \usepackage[skip=1ex]{caption}
    
    \begin{document}
       \begin{table}[htb]
        \begin{threeparttable}
    \caption{SCORING FACTORS AND SUMMARY STATISTICS FOR VARIABLES ENTERING THE COMPUTATION
    OF THE FIRST PRINCIPAL COMPONENT}
    \label{tab:score}
        \small
        \setlength\tabcolsep{0pt}
        \begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}
                            l
                            S[table-format=-1.3]
                       *{2}{S[table-format= 1.3]}
                            S[table-format=-1.2]
                            S[table-format=-1.3]
                       *{2}{S[table-format= 1.3]}
                                }
        \toprule
        &   \multicolumn{4}{c}{All India}   &   \multicolumn{3}{c}{Means}   \\
        \cmidrule(r){2-5}
        \cmidrule(l){6-8}
        &   {\thead[b]{Scoring\\ Factors}}
            &   {\thead[b]{Mean}}
                &   {\thead[b]{SD}}
                    &   {\thead[b]{SF\tnote{a}\\$\times$SD}}
                        &   {\thead[b]{Poorest\\ \SI{40}{\%}}}
                            &   {\thead[b]{Middle\\ \SI{40}{\%}}}
                                &   {\thead[b]{Richest\\ \SI{20}{\%}}}      \\
        \midrule
    Own Clock/Watch
        & 0.270 & 0.533 & 0.499 & 0.54  & 0.164 & 0.739 & 0.985              \\
    Own Bicycle
        & 0.130 & 0.423 & 0.494 & 0.26  & 0.264 & 0.510 & 0.621              \\
    Own Radio
        &       &       &       &       &       &       &                   \\
    Own Television
        &       &       &       &       &       &       &                   \\
    Own Sewing Machine
        &       &       &       &       &       &       &                   \\
    Own Motorcycle
        &       &       &       &       &       &       &                   \\
    Own Refigerator
        &       &       &       &       &       &       &                   \\
    Own Car
        &       &       &       &       &       &       &                   \\
    Drinking Water From
        &       &       &       &       &       &       &                   \\
    Drinking Water From
        &       &       &       &       &       &       &                   \\
    Drinking Water From
        &       &       &       &       &       &       &                   \\
    Flush Toilet
        &       &       &       &       &       &       &                   \\
    Pit Toilet/Latrine
        &       &       &       &       &       &       &                   \\
    None/Other Toilet
        &       &       &       &       &       &       &                   \\
    Main Source of Lighting Electric
        &       &       &       &       &       &       &                   \\
    Number of Rooms in Dwelling
        &       &       &       &       &       &       &                   \\
    Kitchen a Seperate Room
        &       &       &       &       &       &       &                   \\
    Main Cooking Fuel Biomass
        &       &       &       &       &       &       &                   \\
    Dwelling All High-Quality Materials
        &       &       &       &       &       &       &                   \\
    Dwelling All Low-Quality Materials
        &       &       &       &       &       &       &                   \\
    Own >6 acres Land
        &       &       &       &       &       &       &                   \\
    Economic Status Index
        &       &       &       &       &       &       &                   \\
        \bottomrule
      \end{tabular*}
      \begin{tablenotes}[flushleft]\small
      \item[a] SF: Scoring Factors
      \note   each variable ...
      \source   Authors' calculations ...
      \end{tablenotes}
    \end{threeparttable}
    \end{table}
    
    \end{document}
    

result:

enter image description here

0

Here is one possibility for your table. I don't of course have your class, so I used book instead, and added \usepackage{mathpazo} (I'm not sure if the font used is actually Palatino, I'm terrible at recognizing fonts, but I don't think it's standard Computer Modern at least.)

I used S columns (from siunitx) instead of p columns, and reduced the fontsize and \tabcolsep (space between columns), as well as removing the padding at the start and end of each row.

For the multi-line column headings, I used a macro made by egreg in https://tex.stackexchange.com/a/19678, for making manual linebreaks in a table cell.

enter image description here

\documentclass[11pt]{book} 
\usepackage[T1]{fontenc} 
\usepackage{geometry}
\usepackage{siunitx}
\usepackage{array, booktabs}

% font package added for example only
\usepackage{mathpazo} % don't use in your actual document


%----------------------------------------------------------------------------------------
%   MARGIN SETTINGS
%----------------------------------------------------------------------------------------

\geometry{
    paper=a4paper, % Change to letterpaper for US letter
    inner=2.5cm, % Inner margin
    outer=3.8cm, % Outer margin
    bindingoffset=.5cm, % Binding offset
    top=1.5cm, % Top margin
    bottom=1.5cm, % Bottom margin
    %showframe, % Uncomment to show how the type block is set on the page
}

\newcommand{\specialcell}[2][t]{% from https://tex.stackexchange.com/a/19678
  \begin{tabular}[#1]{@{}c@{}}#2\end{tabular}}

\begin{document}
\begin{table}

\caption{SCORING FACTORS AND SUMMARY STATSTICS FOR VARIABLES ENTERING THE COMPUTATION
OF THE FIRST PRINCIPAL COMPONENT}

\smallskip%
\footnotesize % reduce fontsize
\setlength\tabcolsep{3.5pt} % modify space between columns (default 6pt I think)

\begin{tabular}{@{}l *{7}{S} @{}} % remove padding at start/end of row, use S columns instead of p
\toprule 
& \multicolumn{4}{c}{All India} & \multicolumn{3}{c}{Means}\tabularnewline
\cmidrule(r){2-5}
\cmidrule(l){6-8}
& {\specialcell{Scoring\\Factors}} & {Mean} & {SD} & {\specialcell{Scoring\\Factor\\$\times \mathrm{SD}$}} & 
  {\specialcell{Poorest\\40\%}} & {\specialcell{Middle\\40\%}} & {\specialcell{Richest\\20\%}} \tabularnewline
\midrule
\midrule 
Own Clock/Watch & 0.270 & 0.533 & 0.499 & 0.54 & 0.164 & 0.739 & 0.985\tabularnewline
Own Bicycle & 0.130 & 0.423 & 0.494 & 0.26 & 0.264 & 0.510 &         0.621\tabularnewline
Own Radio &  &  &  &  &  &  & \tabularnewline
Own Television &  &  &  &  &  &  & \tabularnewline
Own Sewing Machine &  &  &  &  &  &  & \tabularnewline
Own Motorcycle &  &  &  &  &  &  & \tabularnewline
Own Refigerator &  &  &  &  &  &  & \tabularnewline
Own Car &  &  &  &  &  &  & \tabularnewline
Drinking Water From  &  &  &  &  &  &  & \tabularnewline
Drinking Water From  &  &  &  &  &  &  & \tabularnewline
Drinking Water From  &  &  &  &  &  &  & \tabularnewline
Flush Toilet &  &  &  &  &  &  & \tabularnewline
Pit Toilet/Latrine &  &  &  &  &  &  & \tabularnewline
None/Other Toilet &  &  &  &  &  &  & \tabularnewline
Main Source of Lighting Electric &  &  &  &  &  &  & \tabularnewline
Number of Rooms in Dwelling &  &  &  &  &  &  & \tabularnewline
Kitchen a Seperate Room &  &  &  &  &  &  & \tabularnewline
Main Cooking Fuel Biomass  &  &  &  &  &  &  & \tabularnewline
Dwelling All High-Quality Materials &  &  &  &  &  &  & \tabularnewline
Dwelling All Low-Quality Materials &  &  &  &  &  &  & \tabularnewline
Own >6 acres Land &  &  &  &  &  &  & \tabularnewline
Economic Status Index &  &  &  &  &  &  & \tabularnewline
\bottomrule
\end{tabular}

\smallskip % add some vertical space

\emph{Note: }bla bla bla

\emph{Source: }Bla bla bla
\end{table}
\end{document}
1
  • it works, than you sir :) Commented Jul 20, 2018 at 12:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .