I have tables which I want to set horizontally, they are too big that they don't fit with the page, either column header shift down, are doesn't fit on page, how can set them. I used long table too. What shall I do?
You can re-size the table to make it fit the page size. Like this:
\usepackage{graphicx}
\begin{table}
...
\scalebox{0.7}{ %% change it to smaller here, change to other values if needed
\begin{tabular}
...
\end{tabular}
}
\end{table}
Related
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?
Well I'm a newbie in latex and I want to make a latex Curriculum Vitae.
I want to create a page with two parts
First part: an image from TOP to Bottom, and from left to the middle of the page
Second part: a text zone from from TOP to Bottom, and from middle of the page to the right
I have tried to create two columns but every time one of the columnes are put on the next pages :(
Do you have any advice or tips or answer to give me?
Thank you very much for your help.
For a single-page split-view display, you can set the content in a tabularx structure. The left-hand side contains an image with no height/depth. This allows you put anything in the right-hand side.
\documentclass{article}
\usepackage[margin=1in]{geometry}
\usepackage{graphicx,tabularx}
\usepackage{lipsum}
\setlength{\parindent}{0pt}
\pagestyle{empty}
\begin{document}
\begin{tabularx}{\textwidth}{#{} X X #{}}
\raisebox{\dimexpr-\height+.7\normalbaselineskip}[0pt][0pt]{%
\includegraphics[width=\linewidth,height=\textheight]{example-image}} &
\lipsum[1-3]
\end{tabularx}
\end{document}
There are multiple ways of doing this. It all depends on whether you're stuck with a single page, or want to move to a bigger canvas.
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}
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.
I have a LaTeX document that contains a paragraph followed by 4 tables followed by a second paragraph. I want the 4 tables to appear between the two paragraphs which from what I've read means I should use the [h] option after beginning the table environment (e.g. \begin{table}[h]).
Using this the first two tables appear after paragraph 1 as expected, however paragraph 2 is then displayed with the last two tables appearing on the following page. How can I get the tables to appear in the correct location?
I've tried various things to correct the positioning such as using [h!] however this doesn't seem to have any effect. Using \clearpage after the tables does have the desired effect of making the tables appear before the second paragraph but it then leaves the last two tables on their own page with loads of white-space, when I would prefer to have the second paragraph begin immediately after the tables.
Paragraph 1...
\begin{table}[h]
table1...
\end{table}
\begin{table}[h]
table2...
\end{table}[h]
...
Paragraph 2...
After doing some more googling I came across the float package which lets you prevent LaTeX from repositioning the tables.
In the preamble:
\usepackage{float}
Then for each table you can use the H placement option (e.g. \begin{table}[H]) to make sure it doesn't get repositioned.
Table Positioning
Available Parameters
A table can easily be placed with the following parameters:
h Place the float here, i.e., approximately at the same point it occurs in the source text (however, not exactly at the spot)
t Position at the top of the page.
b Position at the bottom of the page.
p Put on a special page for floats only.
! Override internal parameters LaTeX uses for determining "good" float positions.
H Places the float at precisely the location in the LATEX code. Requires the float package. This is somewhat equivalent to h!.
If you want to make use of H (or h!) for an exact positioning, make sure you got the float package correctly set up in the preamble:
\usepackage{float}
\restylefloat{table}
Example
If you want to place the table at the same page, either at the exact place or at least at the top of the page (what fits best for the latex engine), use the parameters h and t like this:
\begin{table}[ht]
table content ...
\end{table}
Sources: Overleaf.com
At the beginning with the usepackage definitions include:
\usepackage{placeins}
And before and after add:
\FloatBarrier
\begin{table}[h]
\begin{tabular}{llll}
....
\end{tabular}
\end{table}
\FloatBarrier
This places the table exactly where you want in the text.
Here's an easy solution, from Wikibooks:
The placeins package provides the command \FloatBarrier, which can be used to prevent floats from being moved over it.
I just put \FloatBarrier before and after every table.
What happens if the text plus tables plus text doesn't fit onto a single page? By trying to force the typesetting in this way, you are very likely to end up with pages that run too short; i.e., because a table cannot by default break over a page it will be pushed to the next, and leave a gap on the page before. You'll notice that you never see this in a published book.
The floating behaviour is a Good Thing! I recommend using [htbp] as the default setting for all tables and figures until your document is complete; only then should think about fine-tuning their precise placement.
P.S. Read the FAQ; most other answers here are partial combinations of advice given there.
If you want to have two tables next to each other you can use: (with float package loaded)
\begin{table}[H]
\begin{minipage}{.5\textwidth}
%first table
\end{minipage}
\begin{minipage}{.5\textwidth}
%second table
\end{minipage}
\end{table}
Each one will have own caption and number.
Another option is subfigure package.
In my case I was having an issue where the table was not being displayed right after the paragraph I inserted it, so I simply changed
\begin{table}[]
to
\begin{table}[ht]
You may want to add this to your preamble, and adjust the values as necessary:
%------------begin Float Adjustment
%two column float page must be 90% full
\renewcommand\dblfloatpagefraction{.90}
%two column top float can cover up to 80% of page
\renewcommand\dbltopfraction{.80}
%float page must be 90% full
\renewcommand\floatpagefraction{.90}
%top float can cover up to 80% of page
\renewcommand\topfraction{.80}
%bottom float can cover up to 80% of page
\renewcommand\bottomfraction{.80}
%at least 10% of a normal page must contain text
\renewcommand\textfraction{.1}
%separation between floats and text
\setlength\dbltextfloatsep{9pt plus 5pt minus 3pt }
%separation between two column floats and text
\setlength\textfloatsep{4pt plus 2pt minus 1.5pt}
Particularly, the \floatpagefraction may be of interest.
Not necessary to use \restylefloat and destroys other options, like caption placement. just use [H] or [!h] after \begin{table}.