General ⇒ Table Size and Figure Spacing in LaTex
Table Size and Figure Spacing in LaTex
Hello All:
I am having trouble w. my table and figure. Hope you can help:
1.
I created a table in Latex, but currently it is too big. I would like to make the fonts of my table values smaller compared to the rest of my document. How can I do that?
2.
I uploaded .pdf graphics files into my MikTex project for various figures. But for each figure, there is alot of spacing that is put between the graph and my caption. The spacing is at least 1/3 of my 8x11 page. Does anyone know why that occurs and how to fix that?
Thank you in advance!
I am having trouble w. my table and figure. Hope you can help:
1.
I created a table in Latex, but currently it is too big. I would like to make the fonts of my table values smaller compared to the rest of my document. How can I do that?
2.
I uploaded .pdf graphics files into my MikTex project for various figures. But for each figure, there is alot of spacing that is put between the graph and my caption. The spacing is at least 1/3 of my 8x11 page. Does anyone know why that occurs and how to fix that?
Thank you in advance!
NEW: TikZ book now 40% off at Amazon.com for a short time.
Table Size and Figure Spacing in LaTex
Question 1.
There are several tips to reduce the width of a table:
Question 2
You can eliminate superfluous space by means of the trim option of \includegraphics. Please, take a look at this topic and this document.
Merry Christmas!
There are several tips to reduce the width of a table:
- Reduce the fontsize in the whole table. For this, put before the table a suitable declaration command as \small or \scriptsize. To limit the effect of this declaration to a specific table, add after it the \normalsize command, put the table in an environment (center, for example), or enclose the table with \begingroup and \endgroup.
- Reduce the space between columns, varying the \tabcolsep length.
- Scale down the table with \scale or resize it with \resizebox. Both commands are defined in the graphicx package
- Reduce the fontsize of some columns with the help of the array package. A command like >{\small} before a column descriptor writes all elements in that column in small size.
Code: Select all
\documentclass[a4paper]{article}
\usepackage{graphicx}
\usepackage{array}
\begin{document}
\noindent Left margin here \hfill right margin here.
\begin{center}
\begin{tabular}{|c|c|c|c|c|c|c|c|}
\hline \multicolumn{8}{|c|}{A wide table} \\ \hline
One.One & One.Two & One.Three & One.Four & One.Five
& One.Six & One.Seven & One.Eight \\
Two.One & Two.Two & Two.Three & Two.Four & Two.Five
& Two.Six & Two.Seven & Two.Eight \\ \hline
\end{tabular}
\end{center}
\begin{center}
\small\addtolength{\tabcolsep}{-5pt}
\begin{tabular}{|c|c|c|c|c|c|c|c|}
\hline \multicolumn{8}{|c|}{A (not so) wide table} \\ \hline
One.One & One.Two & One.Three & One.Four & One.Five
& One.Six & One.Seven & One.Eight \\
Two.One & Two.Two & Two.Three & Two.Four & Two.Five
& Two.Six & Two.Seven & Two.Eight \\ \hline
\end{tabular}
\end{center}
\begin{center}
\scalebox{0.7}{%
\begin{tabular}{|c|c|c|c|c|c|c|c|}
\hline \multicolumn{8}{|c|}{A (not so) wide table} \\ \hline
One.One & One.Two & One.Three & One.Four & One.Five
& One.Six & One.Seven & One.Eight \\
Two.One & Two.Two & Two.Three & Two.Four & Two.Five
& Two.Six & Two.Seven & Two.Eight \\ \hline
\end{tabular}}
\end{center}
\begin{center}
\resizebox{\textwidth}{!}{%
\begin{tabular}{|c|c|c|c|c|c|c|c|}
\hline \multicolumn{8}{|c|}{A (not so) wide table} \\ \hline
One.One & One.Two & One.Three & One.Four & One.Five
& One.Six & One.Seven & One.Eight \\
Two.One & Two.Two & Two.Three & Two.Four & Two.Five
& Two.Six & Two.Seven & Two.Eight \\ \hline
\end{tabular}}
\end{center}
\begin{center}
\addtolength{\tabcolsep}{-3pt}
\begin{tabular}{|>{\tiny}c|c|>{\tiny}c|c|>{\tiny}c|c|>{\tiny}c|c|}
\hline \multicolumn{8}{|c|}{A (not so) wide table} \\ \hline
One.One & One.Two & One.Three & One.Four & One.Five
& One.Six & One.Seven & One.Eight \\
Two.One & Two.Two & Two.Three & Two.Four & Two.Five
& Two.Six & Two.Seven & Two.Eight \\ \hline
\end{tabular}
\end{center}
\end{document}
You can eliminate superfluous space by means of the trim option of \includegraphics. Please, take a look at this topic and this document.
Merry Christmas!
Re: Table Size and Figure Spacing in LaTex
Thank you!
I will try out the solns. So far for 2., I have only been able to add graphics that are .pdf which is also what my LaTex file is output to. I will look for addtl extensions in the Document too. Happy New Year!

Re: Table Size and Figure Spacing in LaTex
Hello. I tried out the code on its own and worked exactly. Thank you. But when I added a caption to the Table, I got the table back in the same size as before (not the smaller version
) and the caption went missing. The code that I had modified the original posted earlier was:
\begin{table}
\begin{center}
\small\addtolength{\tabcolsep}{-5pt}
\begin{tabular}{c||c|c|c||c|c||c}
X& x1 & $x2$ & x3 & x4 & x5&x6\\\hline
I & 1& 2& 3 & 4 & 5& 6\\
& (.46) & & & (.16)&&\\
II&1&2&3 & 4&5&6\\
& (.82) & & & (.28)&&\\
III &1&2 &3& 4&5&6\\
& (.63) & & & (.24)&&\\
IV & 1& 2& 3& 4&5& 6\\
& (.39) & & & (.14)&&\\
V & 1& 2& 3& 4&5& 6\\
& (.82) & & & (.39)&&\\
VI & 1& 2& 3& 4&5& 6\\
& (1.15) & & & (2.65)&&\\
\end{tabular}
\end{center}
}
\caption{My caption} \label{tab:mytab}
\end{table}

\begin{table}
\begin{center}
\small\addtolength{\tabcolsep}{-5pt}
\begin{tabular}{c||c|c|c||c|c||c}
X& x1 & $x2$ & x3 & x4 & x5&x6\\\hline
I & 1& 2& 3 & 4 & 5& 6\\
& (.46) & & & (.16)&&\\
II&1&2&3 & 4&5&6\\
& (.82) & & & (.28)&&\\
III &1&2 &3& 4&5&6\\
& (.63) & & & (.24)&&\\
IV & 1& 2& 3& 4&5& 6\\
& (.39) & & & (.14)&&\\
V & 1& 2& 3& 4&5& 6\\
& (.82) & & & (.39)&&\\
VI & 1& 2& 3& 4&5& 6\\
& (1.15) & & & (2.65)&&\\
\end{tabular}
\end{center}
}
\caption{My caption} \label{tab:mytab}
\end{table}
Re: Table Size and Figure Spacing in LaTex
For the graphics figure, how does one modify the resizing code above so that I the graphs and captions fit nicely without caption drooping at the bottom border... And how does one fit more than one external graphic file onto a page? The lines below only inserted the two graphs onto separate pages w. captions hugging the bottom borders.
\begin{figure}[t]
\centering
\includegraphics[width=1.00\textwidth]{Fiigure3.pdf}
\caption{Y(STUDENT'S T) minus Y(GSHD) matched by kurtosis}
\label{fig:Fiigure3}
\end{figure}\begin{figure}[t]
\centering
\includegraphics[width=1\textwidth]{secondgraph.pdf}
\caption{N(0,1) in black, Standardized t(5) in green and GHSD(lambda(5) in blue)}
\label{fig:secondgraph}
\end{figure}
Many thanks
\begin{figure}[t]
\centering
\includegraphics[width=1.00\textwidth]{Fiigure3.pdf}
\caption{Y(STUDENT'S T) minus Y(GSHD) matched by kurtosis}
\label{fig:Fiigure3}
\end{figure}\begin{figure}[t]
\centering
\includegraphics[width=1\textwidth]{secondgraph.pdf}
\caption{N(0,1) in black, Standardized t(5) in green and GHSD(lambda(5) in blue)}
\label{fig:secondgraph}
\end{figure}
Many thanks
Table Size and Figure Spacing in LaTex
Concerning the table, in this part of your code
there is a superfluous brace, the isolated one. Just remove it. By the way, since the whole thing is inside a table environment, you can replace the center environment by \centering. In other words, the following code works:
Concerning graphics, you can improve your code in two senses:
* It seems you want both graphics in the same page. However, in both figure environments you use the t descriptor, which forces LaTeX to put the graphic at the top of a page. It is better to use the default option (tbp descriptors), so LaTeX have more chances to place both graphics in the same page. You can even include both graphics with a unique figure environment:
Of couse, you can replace \bigskip with a different command in order to get a proper vertical separation between graphics.
* You can also improve control over the dimensions of the area covered by the graphics. To this end, use the optional argument of \includegraphics. For example, the command
includes a graphic which occupies, at most, a rectangle of 4 cm x 5 cm. The keepaspectratio key avoids distortion of the image. You can also set relative lengths:
Here, the width of the graphic is, at most, 40% of \textwidth and its height is not greater than the 30 % of \textheight.
Please, read the epslatex document. You will find there many more tips and hints about managing graphics in LaTeX.
Code: Select all
\end{tabular}
\end{center}
}
\caption{My caption}\label{tab:mytab}
Code: Select all
\begin{table}
\centering
\small\addtolength{\tabcolsep}{-5pt}
\begin{tabular}{c||c|c|c||c|c||c}
X& x1 & $x2$ & x3 & x4 & x5&x6\\\hline
I & 1& 2& 3 & 4 & 5& 6\\
& (.46) & & & (.16)&&\\
II&1&2&3 & 4&5&6\\
& (.82) & & & (.28)&&\\
III &1&2 &3& 4&5&6\\
& (.63) & & & (.24)&&\\
IV & 1& 2& 3& 4&5& 6\\
& (.39) & & & (.14)&&\\
V & 1& 2& 3& 4&5& 6\\
& (.82) & & & (.39)&&\\
VI & 1& 2& 3& 4&5& 6\\
& (1.15) & & & (2.65)&&\\
\end{tabular}
\caption{My caption} \label{tab:mytab}
\end{table}
* It seems you want both graphics in the same page. However, in both figure environments you use the t descriptor, which forces LaTeX to put the graphic at the top of a page. It is better to use the default option (tbp descriptors), so LaTeX have more chances to place both graphics in the same page. You can even include both graphics with a unique figure environment:
Code: Select all
\begin{figure}
\centering
\includegraphics{firstgraphicfile}
\caption{A suitable graphic} \label{fig:one}
\bigskip
\includegraphics{secondgraphicfile}
\caption{Another interesting graphic} \label{fig:two}
\end{figure}
* You can also improve control over the dimensions of the area covered by the graphics. To this end, use the optional argument of \includegraphics. For example, the command
Code: Select all
\includegraphics[width=4cm,height=5cm,keepaspectratio]{graphicsfile}
Code: Select all
\includegraphics[width=0.4\textwidth,height=0.3\textheight,keepaspectratio]{graphicsfile}
Please, read the epslatex document. You will find there many more tips and hints about managing graphics in LaTeX.
Re: Table Size and Figure Spacing in LaTex
All the above worked very well. The trim option fixed the problem. Thank you! 

-
- Posts: 3
- Joined: Wed Oct 26, 2016 11:42 am
Table Size and Figure Spacing in LaTex
My problem is solved, that's all I need
Thanks a lot

Thanks a lot
Table Size and Figure Spacing in LaTex
This worked like a charm. Using
\usepackage{longtable}
for long tables had problems with some of your suggestions, but reducing the space between columns worked great. You have to compile the .tex file a couple of times to get the headings and data to all line up. This saves me a lot of headache.
\usepackage{longtable}
for long tables had problems with some of your suggestions, but reducing the space between columns worked great. You have to compile the .tex file a couple of times to get the headings and data to all line up. This saves me a lot of headache.
- Stefan Kottwitz
- Site Admin
- Posts: 10319
- Joined: Mon Mar 10, 2008 9:44 pm
Table Size and Figure Spacing in LaTex
Hi bbrout,
welcome to the forum! And thanks for sharing your experience!
Stefan
welcome to the forum! And thanks for sharing your experience!
Stefan
LaTeX.org admin