Can I make this table fit in portrait mode?

I have a table which I want to make fit in portrait mode. Do you think this is possible?

Here is the minimal example:

\documentclass[11pt,a4paper]{book}
\usepackage[utf8x]{inputenc}
\usepackage{ucs}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{makeidx}
\usepackage{graphicx}
\usepackage[width=0.00cm, height=0.00cm, left=1.00in, right=1.00in, top=1.00in, bottom=1.00in]{geometry}
\usepackage{threeparttable}
\usepackage{rotating}
\usepackage{booktabs}

\begin{document}

{\footnotesize
\begin{table}[H!]
%\begin{sidewaystable}[h!]
\centering
\begin{threeparttable}
\caption{OLS results } \label{ols_results}
\begin{tabular}{lcccccccc} \toprule
& \multicolumn{4}{c}{Non-HMO Hospitals} & \multicolumn{4}{c}{HMO-Hospitals} \\
\cmidrule(r){2-5} \cmidrule{6-9}
& \multicolumn{2}{c}{Doctors} & \multicolumn{2}{c}{Non-Doctors} & \multicolumn{2}{c}{Doctors} & \multicolumn{2}{c}{Non-Doctors} \\
\cmidrule(r){2-3} \cmidrule(r){4-5} \cmidrule(r){6-7} \cmidrule{8-9}

& Mean &  StDev & Mean &  StDev & Mean &  StDev & Mean &  StDev \\ \midrule
\underline{Demographics}: &&&&&&&& \\
Age & 32.59* &  [4.00] & 31.13* &   [4.28] & 32.63* &   [4.12] & 30.69* &   [4.28] \\
Mother's Education ($\%$) &&&&&&&& \\
\hspace{0.2em} Some college &&&&&&&& \\
\hspace{0.2em} High education &&&&&&&& \\
Father's education &&&&&&&& \\
\hspace{0.2em} Some college &&&&&&&& \\
\hspace{0.2em} High education &&&&&&&& \\
Insurance ($\%$) &&&&&&&& \\
\hspace{0.2em} HMO &&&&&&&& \\
\hspace{0.2em} Government &&&&&&&& \\
\hspace{0.2em} Indigent &&&&&&&& \\
Placental/uterine rupture/haemorrhage & 1.44 & [0.23] &&&&&& \\ \midrule
Observations & \multicolumn{2}{c}{2360} & \multicolumn{2}{c}{7852} & \multicolumn{2}{c}{256} & \multicolumn{2}{c}{879}  \\
\bottomrule
\end{tabular}

\begin{tablenotes}
\tiny
\item[a] [whatever here, this is just a test] This table is made with the use if \LaTeXe{} . Cristobal is a port on the Atlantic side of the Panama Canal. It is located on the western edge of Manzanillo Island and is part of the Panamanian city and province of Colon. Cristobal Colon is the Spanish translation for Christopher Columbus, the Genovese explorer for whom these places were named.
\end{tablenotes}

\end{threeparttable}
%\end{sidewaystable}
\end{table}
}

\end{document}

-
Would changing "Placental/uterine rupture/haemorrhage" into an acronym (eg. PURH) or some other shorter version be acceptable? If you do then the table is small enough to fit into a portrait page using the techniques in this answer. –  jja Aug 30 '13 at 13:17
@jja of course this does the job, bu the paper having this table is in portrait mode and has "Placental/uterine rupture/hemorrhage" intact. –  Pantelis Kazakis Aug 30 '13 at 13:20
Your table is currently ignoring the \footnotesize command because it is outside the table environment. If you move it inside then the font will be smaller and the table at least shows in the page. It's still bigger than the margins, though (and the answer I linked to doesn't really work with floats...). :( –  jja Aug 30 '13 at 13:23
@jja Maybe they use a3paper, which works. But this is very uncommon :( –  Pantelis Kazakis Aug 30 '13 at 13:26
@jja, following your suggestion, it now fits in a portrait mode. Thanks mate! –  Pantelis Kazakis Aug 30 '13 at 13:31

The footnotesize is being ignored in your example because it is outside of the table environment. If you move it inside then the fnot is small enough to show the table in the page.

To venter it on the page I used the environment used in this answer to fit boxes that are too large for the margins. However, that will not work if your table is a float (but judging from your [H!] maybe that's not too serious?). Other greater minds may come up with a better solution, but this might do.

\documentclass[11pt,a4paper]{book}
\usepackage[
width=0.00cm,
height=0.00cm,
left=1.00in,
right=1.00in,
top=1.00in,
bottom=1.00in,
showframe
]{geometry}
\usepackage{threeparttable}
\usepackage{booktabs}

\newenvironment{xcenter}
{\par\setbox0=\hbox\bgroup\ignorespaces}
{\unskip\egroup\noindent\makebox[\textwidth]{\box0}\par}

\begin{document}

\begin{xcenter}
\footnotesize
% \centering
\begin{threeparttable}
\caption{OLS results } \label{ols_results}
\begin{tabular}{@{}lcccccccc@{}} \toprule
& \multicolumn{4}{c}{Non-HMO Hospitals} & \multicolumn{4}{c}{HMO-Hospitals} \\
\cmidrule(r){2-5} \cmidrule{6-9}
& \multicolumn{2}{c}{Doctors} & \multicolumn{2}{c}{Non-Doctors} & \multicolumn{2}{c}{Doctors} & \multicolumn{2}{c}{Non-Doctors} \\
\cmidrule(r){2-3} \cmidrule(r){4-5} \cmidrule(r){6-7} \cmidrule{8-9}

& Mean &  StDev & Mean &  StDev & Mean &  StDev & Mean &  StDev \\ \midrule
\underline{Demographics}: &&&&&&&& \\
Age & 32.59* &  [4.00] & 31.13* &   [4.28] & 32.63* &   [4.12] & 30.69* &   [4.28] \\
Mother's Education ($\%$) &&&&&&&& \\
\hspace{0.2em} Some college &&&&&&&& \\
\hspace{0.2em} High education &&&&&&&& \\
Father's education &&&&&&&& \\
\hspace{0.2em} Some college &&&&&&&& \\
\hspace{0.2em} High education &&&&&&&& \\
Insurance ($\%$) &&&&&&&& \\
\hspace{0.2em} HMO &&&&&&&& \\
\hspace{0.2em} Government &&&&&&&& \\
\hspace{0.2em} Indigent &&&&&&&& \\
Placental/uterine rupture/haemorrhage & 1.44 & [0.23] &&&&&& \\ \midrule
Observations & \multicolumn{2}{c}{2360} & \multicolumn{2}{c}{7852} & \multicolumn{2}{c}{256} & \multicolumn{2}{c}{879}  \\
\bottomrule
\end{tabular}

\begin{tablenotes}
\tiny
\item[a] [whatever here, this is just a test] This table is made with the use if \LaTeXe{} . Cristobal is a port on the Atlantic side of the Panama Canal. It is located on the western edge of Manzanillo Island and is part of the Panamanian city and province of Colon. Cristobal Colon is the Spanish translation for Christopher Columbus, the Genovese explorer for whom these places were named.
\end{tablenotes}

\end{threeparttable}
\end{xcenter}

\end{document}


-
This worked for me, thank you. I have a last question though: why do you use {@{} in the tabular environment? –  Pantelis Kazakis Aug 30 '13 at 13:51
It trims the extra space on the left and right of the table. If you don't use it the lines will be a little longer than the width of the table. I prefer the tighter look (try removing them and compare the results). Also, if this answer worked for you, please consider marking it as accepted. –  jja Aug 30 '13 at 13:54
Yes, I also prefer the tighter look. Thanks you so much! It was really helpful. –  Pantelis Kazakis Aug 30 '13 at 13:59
The result doesn't quite meet the OP's stated objective of fitting inside the textblock. You may want to try reducing the value of \tabcolsep (half the width of the intercolumn white space) to 4pt or even 3pt and see if the table starts to fit. –  Mico Aug 30 '13 at 19:13
Yes, there's a lot more tweaking that could be done, and your answer takes care of some of those. But I didn't really get the idea that the OP was particularly concerned with it not exceeding the margins at all; more like the problem was that the table did not fit in the page. –  jja Aug 30 '13 at 21:53

If you're willing to allow a line break in the header of the second-to-last row (Placental/uterine rupture/haemorrhage), you can get the table to fit into the text block in portrait mode by changing the type of the first, i.e., left-most, column from l to p{4cm}. Why 4 centimeters? So that the next-longest header, Mother's Education (\%), fits in the available space. Note that it's no longer necessary to reduce the font size.

I would also suggest a more systematic trimming of the \cmidrules in order to make the structure of the header rows more self-evident. And, in keeping with the general design philosophy that pervades the booktabs package, I'd get rid of the whitespace to the left of the first column and the right of the final column, by inserting @{} particles in the argument of the tabular environment. (The thin lines to the left and right of the image below denote the edges of the text block; the lines are inserted by the showframe option of the geometry package.)

\documentclass[11pt,a4paper]{book}
\usepackage[margin=1in,showframe]{geometry}
\usepackage{threeparttable,booktabs}
\begin{document}

\begin{table}
\centering
\begin{threeparttable}
\caption{OLS results} \label{ols_results}
\begin{tabular}{@{} p{4cm} cccccccc @{}}
\toprule
& \multicolumn{4}{c}{Non-HMO Hospitals}
& \multicolumn{4}{c@{}}{HMO-Hospitals} \\
\cmidrule(lr){2-5} \cmidrule(l){6-9}
& \multicolumn{2}{c}{Doctors} & \multicolumn{2}{c}{Non-Doctors}
& \multicolumn{2}{c}{Doctors} & \multicolumn{2}{c@{}}{Non-Doctors} \\
\cmidrule(lr){2-3} \cmidrule(lr){4-5} \cmidrule(lr){6-7} \cmidrule(l){8-9}
& Mean &  StDev & Mean &  StDev
& Mean &  StDev & Mean &  StDev \\
\midrule
\underline{Demographics}: &&&&&&&& \\
Age & 32.59* &  [4.00] & 31.13* &   [4.28] & 32.63* &   [4.12] & 30.69* &   [4.28] \\
Mother's Education (\%) &&&&&&&& \\
\hspace{0.2em} Some college &&&&&&&& \\
\hspace{0.2em} High education &&&&&&&& \\
Father's education &&&&&&&& \\
\hspace{0.2em} Some college &&&&&&&& \\
\hspace{0.2em} High education &&&&&&&& \\
Insurance (\%) &&&&&&&& \\
\hspace{0.2em} HMO &&&&&&&& \\
\hspace{0.2em} Government &&&&&&&& \\
\hspace{0.2em} Indigent &&&&&&&& \\
\raggedright Placental\slash uterine rupture\slash
haemorrhage & 1.44 & [0.23] &&&&&& \\
\midrule
Observations
& \multicolumn{2}{c}{2360} & \multicolumn{2}{c}{7852}
& \multicolumn{2}{c}{256} & \multicolumn{2}{c@{}}{879}  \\
\bottomrule
\end{tabular}
\begin{tablenotes}
\tiny
\item[a] [whatever here, this is just a test] This table is made with the use of \LaTeXe. Cristobal is a port on the Atlantic side of the Panama Canal. It is located on the western edge of Manzanillo Island and is part of the Panamanian city and province of Colon. Cristobal Colon is the Spanish translation for Christopher Columbus, the Genovese explorer for whom these places were named.
\end{tablenotes}
\end{threeparttable}
\end{table}
\end{document}

-
See also this comment for a solution with a manual line break and no width-guessing. –  Qrrbrbirlbel Aug 30 '13 at 14:06
@Qrrbrbirlbel - Actually, to make the table fit into the text block using your suggested method, it's necessary to typeset that cell as {\begin{tabular}[t]{@{}l@{}} Placental\slash uterine rup- \\ ture\slash hemorrhage \end{tabular}} -- note the required hyphenation of the word "rupture". Some guesswork in getting the column width right seems to be inevitable... –  Mico Aug 30 '13 at 14:19
I’d rather split uterine and rupture. In your case I actually would include \raggedright (or at least \RaggedRight from ragged2e). I’m sure there exist more than just this table where one of many solutions would be applicable. There is also \widthof for non-guessing. –  Qrrbrbirlbel Aug 30 '13 at 14:35
@Qrrbrbirlbel - Thanks, I've implemented both of your suggestions -- to use \raggedright in the cell, and to split the line between uterine and rupture. –  Mico Aug 30 '13 at 19:32