Graphics, Figures & TablesControl Table Size

Information and discussion about graphics, figures & tables in LaTeX documents.
latexhelp1
Posts: 141
Joined: Sun Jun 12, 2011 6:30 am

Control Table Size

Post by latexhelp1 »

localghost wrote: This is a bit confusing. You are now presenting a table where the font size for the complete content is decreased. In this case you won't need the new \rowstyle command and the corresponding column types because a simple switch at the right place would suffice. Would be good if you could clarify that and present a table that is closer to that in your final document.
By the way, what is "this" in "this is a bit confusing." I just don't know what you are referring to, and I am not a bit confused. Are you referring to the example with the multicolumn? I just want to know how I can incorporate \multicolumn into a table with X? The example I gave you is the type of table I am working with.

I hope you realize that I am deeply grateful for your help. Thank you so much for your time.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Control Table Size

Post by localghost »

latexhelp1 wrote:[…] In plain english, can I set the table so that is an 8.5 inch by 11 inch page, I am using a 1 in by 1 in margin, and the table is using the full 6.5 inches of width? It seems to me right now, the table is using maybe only 4-5 inches of width, at most. […]
If so, then why do you present a sample document that is set up for A4 paper size? Drop the a4paper option for the document class and set up the correct type area by the geometry package.

Code: Select all

\documentclass[titlepage]{article}
\usepackage[margin=1in]{geometry}
Please refer to the package manual for details.

To come back to your issue with the manuals. You can find all class and package manuals on CTAN. Note that these are always the manuals for the current versions. They can differ from those installed on your machine if you didn't get an update.
latexhelp1 wrote:By the way, what is "this" in "this is a bit confusing." I just don't know what you are referring to, and I am not a bit confused. Are you referring to the example with the multicolumn? I just want to know how I can incorporate \multicolumn into a table with X? The example I gave you is the type of table I am working with. […]
I was confused because the original table also contained stuff that wasn't decreased in its font size. Regarding the problem with \multicolumn I mentioned that this might need another approach. At the moment I'm not aware of a solition for »X» columns. Perhaps the PracTeX Journal article I mentioned early can help in this regard.
latexhelp1
Posts: 141
Joined: Sun Jun 12, 2011 6:30 am

Control Table Size

Post by latexhelp1 »

Thank you very much for your response. The table looks infinitely better.

I have one problem though. The article in which I embed this table uses \documentclass[12pt]{article} for the overall project. If I use \documentclass[titlepage]{article}, the article does not look good but the table does.

I was able to code an example in which \multicolumn works.

Note in the following code though I still have the original problem with the documentclass of article. Is it possible to use article and have the total table width fixed at 6.5 inches?

Code: Select all

\documentclass[12pt]{article}
\usepackage[margin=1in]{geometry}
    \usepackage[T1]{fontenc}
    \usepackage[labelfont=bf,tableposition=top]{caption}
    \usepackage{array,booktabs,tabularx,threeparttable}
    \usepackage{lscape}

    % This code is taken from the UK TeX FAQ (http://www.tex.ac.uk/cgi-bin/texfaq2html?label=wholerow)
    \newcolumntype{_}{>{\global\let\currentrowstyle\relax}}
    \newcolumntype{^}{>{\currentrowstyle}}
    \newcommand{\rowstyle}[1]{%
      \gdef\currentrowstyle{#1}%
      #1\ignorespaces
    }

    \begin{document}

\begin{table}[!ht]
\caption{Table caption}\label{tab:dummy}
\centering
\begin{threeparttable}
\begin{tabularx}{\textwidth}{_l^X^X^X^X^X^X^X^X}\toprule
\rowstyle{\small} & (1) & (2) & (3) & (4) & (5) & (6) & (7) & (8) \\ \midrule
\multicolumn{9}{c}{\small{Test}} \\
\rowstyle{\small}  Variable &  0.011\tnote{***} & 0.026\tnote{***} & -0.003\tnote{***}& -0.004\tnote{***} & -0.005\tnote{***} & -0.006\tnote{***} & -0.007\tnote{***} & -0.008\tnote{***}\\ \bottomrule\addlinespace
\end{tabularx}
\begin{tablenotes}
\scriptsize
\item[***] Notes:
\end{tablenotes}
\end{threeparttable}
\end{table}
\end{document}
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Control Table Size

Post by localghost »

latexhelp1 wrote:[…] The article in which I embed this table uses \documentclass[12pt]{article} for the overall project. If I use \documentclass[titlepage]{article}, the article does not look good but the table does. […]
I don't know why I proposed my first example with the »titlepage« option. Must have been a relic from another example. Just drop it and set the font size to 12pt for your document. But it should not affect the appearance of your document since it only concerns the title.
latexhelp1 wrote:[…] Note in the following code though I still have the original problem with the documentclass of article. Is it possible to use article and have the total table width fixed at 6.5 inches? […]
You now have letterpaper with fixed margins of 1" and a table with a width that is set to the text width. So I don't see the problem. The table width is with 6.5" exactly as desired.
latexhelp1
Posts: 141
Joined: Sun Jun 12, 2011 6:30 am

Control Table Size

Post by latexhelp1 »

I'm so sorry but I don't understand exactly what you mean in your response. I put the sample code in the last response. Would you mind please stating what you mean, written in Latex code?

As I wrote, I am using \documentclass[12pt]{article}, and I am still having the same sorts of problems.

I don't want the table landscaped if possible. However, I landscape it to better verify if the it is occupying the full width within the margin. So the following code is using landscape. And when I do, it is not.

So please note the following:
1. This code uses \documentclass[12pt]{article}, which I want to use to match the article.
2. It is landscaped only for example purposes.
3. The numbers are not fitting nicely onto 1 row despite the extra space at the end.
4. I am using \small font and do not want to go smaller.
5. I have successfully coded \multicolumn!

Code: Select all

\documentclass[12pt]{article}
\usepackage[margin=1in]{geometry}
    \usepackage[T1]{fontenc}
    \usepackage[labelfont=bf,tableposition=top]{caption}
    \usepackage{array,booktabs,tabularx,threeparttable}
    \usepackage{lscape}

    % This code is taken from the UK TeX FAQ (http://www.tex.ac.uk/cgi-bin/texfaq2html?label=wholerow)
    \newcolumntype{_}{>{\global\let\currentrowstyle\relax}}
    \newcolumntype{^}{>{\currentrowstyle}}
    \newcommand{\rowstyle}[1]{%
      \gdef\currentrowstyle{#1}%
      #1\ignorespaces
    }

    \begin{document}

\begin{landscape}
\begin{table}[!ht]
\caption{Table caption}\label{tab:dummy}
\centering
\begin{threeparttable}
\begin{tabularx}{\textwidth}{_l^X^X^X^X^X^X^X^X}\toprule
\rowstyle{\small} & (1) & (2) & (3) & (4) & (5) & (6) & (7) & (8) \\ \midrule
\multicolumn{9}{c}{\small{Test}} \\
\rowstyle{\small}  Variable &  0.011\tnote{***} & 0.026\tnote{***} & -0.003\tnote{***}& -0.004\tnote{***} & -0.005\tnote{***} & -0.006\tnote{***} & -0.007\tnote{***} & -0.008\tnote{***}\\ \bottomrule\addlinespace
\end{tabularx}
\begin{tablenotes}
\scriptsize
\item[***] Notes:
\end{tablenotes}
\end{threeparttable}
\end{table}
\end{landscape}
\end{document}

localghost wrote:
latexhelp1 wrote:[…] The article in which I embed this table uses \documentclass[12pt]{article} for the overall project. If I use \documentclass[titlepage]{article}, the article does not look good but the table does. […]
I don't know why I proposed my first example with the »titlepage« option. Must have been a relic from another example. Just drop it and set the font size to 12pt for your document. But it should not affect the appearance of your document since it only concerns the title.
latexhelp1 wrote:[…] Note in the following code though I still have the original problem with the documentclass of article. Is it possible to use article and have the total table width fixed at 6.5 inches? […]
You now have letterpaper with fixed margins of 1" and a table with a width that is set to the text width. So I don't see the problem. The table width is with 6.5" exactly as desired.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Re: Control Table Size

Post by localghost »

Sorry, I don't know how to explain it to you. I have the impression that we are talking at cross purposes. Furthermore I seem not to be able to follow the discussion any more. And I can't invest more time to figure out. Other tasks are waiting which demand my attention. I contributed my share. This is all I can do at the moment.
latexhelp1
Posts: 141
Joined: Sun Jun 12, 2011 6:30 am

Control Table Size

Post by latexhelp1 »

I hope you know that I do deeply appreciate your help.

I am just wondering what the syntax/code should be so that I can use \documentclass[12pt]{article} and yet have the table be 6.5 inches wide. It is only 6.5 inches wide if I use \documentclass[titlepage]{article} but I do not want to use that.

Your post, two posts ago, I could not understand what you meant because you did not provide the latex code or syntax.
localghost wrote:Sorry, I don't know how to explain it to you. I have the impression that we are talking at cross purposes. Furthermore I seem not to be able to follow the discussion any more. And I can't invest more time to figure out. Other tasks are waiting which demand my attention. I contributed my share. This is all I can do at the moment.
*****************************************************************************

On another note, I am now trying to make a 11 column table (10 columns for the data plus 1 column for the variable names.) There are too many columns for a proper display. So, I tried to landscape it, and the table fails to expand the exploit the page now being 11 X 8.5.

I would deeply appreciate your help in making the table to be landscaped so that it is 9 inches by 6.5 inches (leaving a 1 inch margin on all sides). I am attaching the code and .pdf. In the .pdf the table looks like the landscaping is not helping give me a table that is 9 inches wide.

Code: Select all

\documentclass[titlepage]{article}
\usepackage[margin=1in]{geometry}
\usepackage[T1]{fontenc}
\usepackage[labelfont=bf,tableposition=top]{caption}
\usepackage{array,booktabs,tabularx,threeparttable}
\usepackage{lscape}

% This code is taken from the UK TeX FAQ (http://www.tex.ac.uk/cgi-bin/texfaq2html?label=wholerow)
\newcolumntype{_}{>{\global\let\currentrowstyle\relax}}
\newcolumntype{^}{>{\currentrowstyle}}
\newcolumntype{C}{>{\centering\arraybackslash}X}
\newcommand{\rowstyle}[1]{%
\gdef\currentrowstyle{#1}%
#1\ignorespaces
}

\begin{document}


\begin{landscape}
\begin{table}[!ht]
\caption{Table caption}\label{tab:dummy}
\centering
\begin{threeparttable}
\begin{tabularx}{\textwidth}{_l^C^C^C^C^C^C^C^C^C^C}\toprule
\rowstyle{\small} & (1) & (2) & (3) & (4) & (5) & (6) & (7) & (8) & (9) & (10) \\ \midrule
\multicolumn{11}{c}{\small{Test}} \\
\rowstyle{\small}  Variable &  0.011\tnote{***} & 0.026\tnote{***} & -0.003\tnote{***}& -0.004\tnote{***} & -0.005\tnote{***} & -0.006\tnote{***} & -0.007\tnote{***} & -0.008\tnote{***} & -0.009\tnote{***} & -0.019\tnote{***}\\ \bottomrule\addlinespace
\end{tabularx}
\begin{tablenotes}
\scriptsize
\item[***] Notes:
\end{tablenotes}
\end{threeparttable}
\end{table}
\end{landscape}
\end{document}
I very much appreciate your time. Bless you.
Last edited by latexhelp1 on Mon Oct 24, 2011 4:52 pm, edited 1 time in total.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Control Table Size

Post by localghost »

latexhelp1 wrote:[…] I am just wondering what the syntax/code should be so that I can use \documentclass[12pt]{article} and yet have the table be 6.5 inches wide. It is only 6.5 inches wide if I use \documentclass[titlepage]{article} but I do not want to use that. […]
You can, but you will have to decrease the font size further for the entire table, what you don't want. Otherwise the cell contents won't fit hence the whole table becomes skewed. An example for that would be the code below. The new columns types as introduced earlier are not used any more.

Code: Select all

\documentclass[12pt]{article}
\usepackage[T1]{fontenc}
\usepackage[margin=1in]{geometry}
\usepackage[font=small,labelfont=bf,tableposition=top]{caption}
\usepackage{booktabs,tabularx,threeparttable}

\newcolumntype{C}{>{\centering\arraybackslash}X}

\begin{document}
  \begin{table}[!ht]
    \caption{Table caption}\label{tab:dummy}
    \centering
    \begin{threeparttable}
      \footnotesize
      \begin{tabularx}{\textwidth}{l*8{C}}\toprule
        & (1) & (2) & (3) & (4) & (5) & (6) & (7) & (8) \\ \midrule
        \multicolumn{9}{c}{Test} \\ \addlinespace
        Variable &  0.011\tnote{***} & 0.026\tnote{***} & -0.003\tnote{***}& -0.004\tnote{***} & -0.005\tnote{***} & -0.006\tnote{***} & -0.007\tnote{***} & -0.008\tnote{***}\\ \bottomrule\addlinespace
      \end{tabularx}
      \begin{tablenotes}
        \scriptsize
        \item[***] Notes:
      \end{tablenotes}
    \end{threeparttable}
  \end{table}
\end{document}
latexhelp1 wrote:[…] On another note, I am now trying to make a 11 column table (10 columns for the data plus 1 column for the variable names.) There are too many columns for a proper display. So, I tried to landscape it, and the table fails to expand the exploit the page now being 11 X 8.5. […]
I wouldn't do this by the lscape package. The rotating package provides an environment that turns the table and makes it occupy the complete page.

Code: Select all

\documentclass[12pt]{article}
\usepackage[T1]{fontenc}
\usepackage[margin=1in]{geometry}
\usepackage[font=small,labelfont=bf,tableposition=top]{caption}
\usepackage{booktabs,tabularx,threeparttable}
\usepackage{rotating}

\newcolumntype{C}{>{\centering\arraybackslash}X}

\begin{document}
  \begin{sidewaystable}
    \caption{Table caption}\label{tab:dummy}
    \centering
    \begin{threeparttable}
      \begin{tabularx}{\textheight}{l*8{C}}\toprule
        & (1) & (2) & (3) & (4) & (5) & (6) & (7) & (8) \\ \midrule
        \multicolumn{9}{c}{Test} \\ \addlinespace
        Variable &  0.011\tnote{***} & 0.026\tnote{***} & -0.003\tnote{***}& -0.004\tnote{***} & -0.005\tnote{***} & -0.006\tnote{***} & -0.007\tnote{***} & -0.008\tnote{***}\\ \bottomrule\addlinespace
      \end{tabularx}
      \begin{tablenotes}
        \scriptsize
        \item[***] Notes:
      \end{tablenotes}
    \end{threeparttable}
  \end{sidewaystable}
\end{document}
I just took the example from above and modified it. Note that the width of the table is now \textheight since it turned by 90°.
latexhelp1
Posts: 141
Joined: Sun Jun 12, 2011 6:30 am

Control Table Size

Post by latexhelp1 »

Thank you so much for all of your help. I do not know how to thank you enough. I think you have addressed all of my tabling needs. (Well, with the exception of a question on page numbers that I asked in a different thread since it finally has nothing to do with controlling the table size).

Hopefully everything you've taught me will carry on over to beamer! You are a true saint.
localghost wrote: You can, but you will have to decrease the font size further for the entire table, what you don't want. Otherwise the cell contents won't fit hence the whole table becomes skewed. An example for that would be the code below. The new columns types as introduced earlier are not used any more.

Code: Select all

\documentclass[12pt]{article}
\usepackage[T1]{fontenc}
\usepackage[margin=1in]{geometry}
\usepackage[font=small,labelfont=bf,tableposition=top]{caption}
\usepackage{booktabs,tabularx,threeparttable}

\newcolumntype{C}{>{\centering\arraybackslash}X}

\begin{document}
  \begin{table}[!ht]
    \caption{Table caption}\label{tab:dummy}
    \centering
    \begin{threeparttable}
      \footnotesize
      \begin{tabularx}{\textwidth}{l*8{C}}\toprule
        & (1) & (2) & (3) & (4) & (5) & (6) & (7) & (8) \\ \midrule
        \multicolumn{9}{c}{Test} \\ \addlinespace
        Variable &  0.011\tnote{***} & 0.026\tnote{***} & -0.003\tnote{***}& -0.004\tnote{***} & -0.005\tnote{***} & -0.006\tnote{***} & -0.007\tnote{***} & -0.008\tnote{***}\\ \bottomrule\addlinespace
      \end{tabularx}
      \begin{tablenotes}
        \scriptsize
        \item[***] Notes:
      \end{tablenotes}
    \end{threeparttable}
  \end{table}
\end{document}
latexhelp1 wrote:[…] On another note, I am now trying to make a 11 column table (10 columns for the data plus 1 column for the variable names.) There are too many columns for a proper display. So, I tried to landscape it, and the table fails to expand the exploit the page now being 11 X 8.5. […]
I wouldn't do this by the lscape package. The rotating package provides an environment that turns the table and makes it occupy the complete page.

Code: Select all

\documentclass[12pt]{article}
\usepackage[T1]{fontenc}
\usepackage[margin=1in]{geometry}
\usepackage[font=small,labelfont=bf,tableposition=top]{caption}
\usepackage{booktabs,tabularx,threeparttable}
\usepackage{rotating}

\newcolumntype{C}{>{\centering\arraybackslash}X}

\begin{document}
  \begin{sidewaystable}
    \caption{Table caption}\label{tab:dummy}
    \centering
    \begin{threeparttable}
      \begin{tabularx}{\textheight}{l*8{C}}\toprule
        & (1) & (2) & (3) & (4) & (5) & (6) & (7) & (8) \\ \midrule
        \multicolumn{9}{c}{Test} \\ \addlinespace
        Variable &  0.011\tnote{***} & 0.026\tnote{***} & -0.003\tnote{***}& -0.004\tnote{***} & -0.005\tnote{***} & -0.006\tnote{***} & -0.007\tnote{***} & -0.008\tnote{***}\\ \bottomrule\addlinespace
      \end{tabularx}
      \begin{tablenotes}
        \scriptsize
        \item[***] Notes:
      \end{tablenotes}
    \end{threeparttable}
  \end{sidewaystable}
\end{document}
I just took the example from above and modified it. Note that the width of the table is now \textheight since it turned by 90°.
latexhelp1
Posts: 141
Joined: Sun Jun 12, 2011 6:30 am

Control Table Size

Post by latexhelp1 »

I spoke too quickly....

I am trying to do another application in my program that does not work if I use the geometry package. However, I really like the table that you helped me design. I like that it occupies the full width of the margin.

Is there someway to do this without using the geometry package? The default just seems to be to make a tiny table. I just want a big table. That is all.

Here is my code. Again, I love this table. I just want to know if I can make an equally large table without using the geometry package.

Code: Select all

\documentclass[12pt]{article}
\usepackage[T1]{fontenc}
\usepackage[margin=1in]{geometry}
\usepackage[font=small,labelfont=bf,tableposition=top]{caption}
\usepackage{booktabs,tabularx,threeparttable}
\usepackage{rotating}

\newcolumntype{C}{>{\centering\arraybackslash}X}

\begin{document}

\begin{sidewaystable}
\caption{Table caption}\label{tab:dummy}
\centering
\begin{threeparttable}
\begin{tabularx}{\textheight}{l*8{C}}\toprule
& (1) & (2) & (3) & (4) & (5) & (6) & (7) & (8) \\ \midrule
\multicolumn{9}{c}{Test} \\ \addlinespace
Variable &  0.011\tnote{***} & 0.026\tnote{***} & -0.003\tnote{***}& -0.004\tnote{***} & -0.005\tnote{***} & -0.006\tnote{***} & -0.007\tnote{***} & -0.008\tnote{***}\\ \bottomrule\addlinespace
\end{tabularx}
\begin{tablenotes}
\scriptsize
\item[***] Notes:
\end{tablenotes}
\end{threeparttable}
\end{sidewaystable}
\end{document}

Post Reply