I notice that there is some gap after my table. See the following snapshot:
My LaTeX code is:
\begin{table}[htb]
\caption{Error rates VS training size in AdaBoosted stump, SVM and kNN. \label{tab:examplecount8000errerrplot}}
\begin{center}
\begin{tabular}{c c}
\includegraphics[scale=0.4]{../boost.eps}
&
\includegraphics[scale=0.4]{../svm.eps} \\
\includegraphics[scale=0.4]{../knn.eps}
& \\
\end{tabular}
\end{center}
\end{table}
%
\subsection{Feature Numbers}
Is the gap normal or how can I reduce the gap to be normal?
Instead of centering the tables with the {center} environment, try to use the \centering macro. I should be something like
\begin{table}
\centering
...
\end{table}
If Charles's and midtiby's answers don't fix it for you and you must adjust it (because, for instance the margin lady won't pass your dissertation until you do), you can diddle the lengths
\floatsep
\textfloatsep
\intextsep
(and their two column brethren) which adjust the spacing around and between floats. In this case I believe you want \textfloatsep.
But do what Charles and midtiby said first, and consider Bears' advice as well.
You can always fix vertical spacing by emitting a vskip command, say \vskip{-1em}, in vertical mode, such as before the \section. Bears is right: delay worrying about layout as late as possible. There should be a saying about premature formatting...
The table would look more attractive to me if the caption was at the bottom. The matter of appearance would be as much what is the proportion of space above and below the caption as the total amount of space.
You can use \raggedbottom
\begin{table}
\centering
...
\end{table}
\raggedbottom
Undeleted answer, since this was referred to by dmckee. I'm generally against fiddling about with the way you express content: better live with the unwanted space, change things in the style files (per dmckee's suggestion), change what you want to express (like where captions are), or put in pure band-aid (like vspace). So I don't like this answer, since terminating every row of a tabular with a \\ makes them easier to maintain, like ending C blocks with a semicolon.
Delete the last \\ in the tabular environment.
try this in your tables: \setlength\belowcaptionskip{-20pt}
Related
Looking for the best way to fit a figure tightly that spans the full height of a page. I'm writing a document about the ionosphere and want to include this image along the side: https://en.wikipedia.org/wiki/Thermosphere#/media/File:EarthAtmosphereBig.jpg
Seems like a job for minipage but I can't quite figure out a good solution. Any tips?
You can achieve this by placing two minipages, one with a larger width than the other, side-by-side.
\documentclass[12pt]{article}
\usepackage[demo]{graphicx} %demo option should be omitted in real document
\usepackage{lipsum} %for random text, should be omitted in real document
%--------%Shows page layout, also should be omitted in real document.
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%--------%Idea from Zarko of TEX.SE
\begin{document}
\begin{minipage}{0.8\textwidth}
\lipsum[1-3]
\end{minipage}
\begin{minipage}[r]{0.2\textwidth}
\centering
\includegraphics[width=0.2\textwidth, height=\textheight]{demo.png}
\end{minipage}
\end{document}
In my document I talk about a calculation and then I do all the equations. So I would like to have those next to each other. Unfortunately some floats really make life difficult.
I have the folowing latex code:
[Some Paragraph]
\begin{table}
... This is a small table (4rows)
\end{table}
\begin{table}
... This table spans almost a page
\end{table}
\begin{figure}
... This figure spans half a page
\end{figure}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
THIS PARAGRAP REFERS TO THE CALCULATION BELOW AND SHOULD BE FOLLOWED IMMEDIATELY BY THE CALCULATION.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{align*}
... This is the CALCULATION.
\end{align*}
The result is that all the tables and figures slide between the PARAGRAPH and the CALCULATION.
I could fix every Figure with the [H] parameter but that's not what I really want to do. Instead I want to prevent anything from sliding between my PARAGRAPH and my CALCULATION
How is it possible to prevent floats from getting between a paragraph and an align?
I want to have the picture exactly in a specific position in my text. I use the commands below
\begin{enumerate}
\item T.D. Lee(1957 Physics Nobel Laureate)
\begin{figure}
\begin{center}
\includegraphics[scale=0.5]{TdLee.eps}
\end{center}
\end{figure}
I have many figures like this. What happens is that I see figures and items in different order. Can you let me know which latex command i should use in order to have the picture under or right to the each item?
Thanks
Kurt
To work with the standard float system, you might try the h positioner (as mentioned in another answer) but with the ! modifier as in
\begin{figure}[h!]
...
\end{figure}
There is even another H positioner, like h! but tries harder. It needs the package float
\usepackage{float}
...
\begin{figure}[H]
...
\end{figure}
but even that doesn't work many times. However since you are doing this in a list, trying to use a float might not be the best for you.
You might try to create a minipage to house the figure. Or perhaps the way to do what you want might be to omit the figure environment all together but keep the center one if you want it.
If you know exactly where you want the figure, don't use a float (that's what the "figure" environment is)...floats are there to.....wait for it.....float!
So if you know exactly where you want your figure, simply use \includegraphics:
\begin{enumerate}
\item T.D. Lee(1957 Physics Nobel Laureate)
\begin{center}
\includegraphics[scale=0.5]{TdLee.eps}
\end{center}
...
\end{enumerate}
You can also redefine the enumerate environment so that you do not have to surround each picture with a \begin{center}...\end{center} environment, but if you are interested in how to do that, I'll leave it for a separate question. (And unapologetically suggest that you ask it on the TeX Stack Exchange, where no TeX-related question is too small.)
Try the h placement specifier. From here:
\begin{figure}[h]
\centering
\includegraphics[scale=0.5]{TdLee.eps}
\end{figure}
It does not guarantee perfect placement, but it tries.
I have a few tables which are not long enough to warrant the use of \longtable, but they always start on the next page which breaks the whole flow and trying to force it with a [!h] in the table did not help. So I stopped using \tables and just have \tabular tag now which seems to have fixed the layout as there are no floats.
But the problem now is I can't get automatic captions for the Tables - any ideas how I can do this and also get auto numbering so when I use \addcontentsline it can show up in the TOC?
To use a caption outside a float environment, one needs to use \captionof which is part of package caption.
Example
\documentclass{article}
\usepackage{caption}
\begin{document}
\begin{center}
\begin{tabular}{rl}
right & left \\
right & left \\
\end{tabular}
\captionof{table}{Your caption here}
\end{center}
\end{document}
There is also a capt-of package if you are just interested in using the command \captionof.
Short answer; you need a \table for the caption. Only using \tabular + captioning is not gonna work.
bit longer
There may be a nasty work-around as people tend to create work-arounds for everything, but my base rule for most of those work-arounds is: "if latex does not provide it by itself, do not try to do it". Most of time those "fixes" will give even more text-flow problems anyway.
Now if you really want it right below the text just do a \clearpage before the table and place the table. Than the rest of the text. This will probably solve it, although it will give an empty space on the rest of your 'previous' page of course.
I have a LaTeX table that looks like this:
\begin{table}[!ht]
\centering
\small
\caption{
\bf{Caption}}
\begin{tabular}{l|c|c|l|c|c|c|c|c}
field1 & field 2 & ... \\
\hline
...
the problem is that even with "\small" the table is too big, since I use:
\usepackage{setspace}
\doublespacing
in the header. How can I:
Make the table single spaced? and
Make the table smaller?
I'd like it to fit on an entire page.
http://en.wikibooks.org/wiki/LaTeX/Tables#Resize_tables talks about two ways to do this.
I used:
\scalebox{0.7}{
\begin{tabular}
...
\end{tabular}
}
As well as \singlespacing mentioned previously to reduce the height of the table, a useful way to reduce the width of the table is to add \tabcolsep=0.11cm before the \begin{tabular} command and take out all the vertical lines between columns. It's amazing how much space is used up between the columns of text. You could reduce the font size to something smaller than \small but I normally wouldn't use anything smaller than \footnotesize.
if it's too long for one page, use the longtable package. and if it's too wide for the page, use p{width} in place of l,r, or c for the column specifier. you can also go smaller than \small, i.e. \footnotesize and \tiny. I would consult the setspace package for options on how to remove the double space, though it's probably \singlespace or something like that.
There is also the singlespace environment:
\begin{singlespace}
\end{singlespace}
You could add \singlespacing near the beginning of your table. See the setspace instructions for more options.
If you want a smaller table (e.g. if your table extends beyond the area that can be displayed) you can simply change:
\usepackage[paper=a4paper]{geometry} to \usepackage[paper=a3paper]{geometry}.
Note that this only helps if you don't plan on printing your table out, as it will appear way too small, then.