Consecutive Tables in LaTeX - latex

I wonder how to place several tables consecutively in LaTeX?
The page with the text right before the first table has a little space but not enough for the first table, so the first table is to be placed on the top of the next page, although I use \begin{table}[!h] for it.
The second table does not fit into the place in the rest of the page of the first table, so I think I might use longtable for it to span the rest of the page and the top of the next page. Similarly, I use longtable for the third table.
The LaTeX code is as follows:
... % some text
\begin{table}[!h]
\caption{Table 1. \label{tab:1}}
\begin{center}
\begin{tabular}{c c}
...
\end{tabular}
\end{center}
\end{table}
\begin{center}
\begin{longtable}{ c c }
\caption{Table 2. \label{tab:2}}\\
...
\end{longtable}
\end{center}
\begin{center}
\begin{longtable}{ c c }
\caption{Table 3. \label{tab:3}}\\
...
\end{longtable}
\end{center}
... % some text
In the compiled pdf file it turns out that the order of the tables is messed up. The first table is placed behind the second and third one, and the second one spans the page with text before the tables and the next page with the third one following it.
I would like to know how I can make the three tables appear consecutively in order, and there are no space left blank between them and between the text and the tables?
Or if what I hope is not possible, what is the best strategy then?
EDIT:
Removing [!h] does not make improvement, the first table is still behind the second and the third.
EDIT:
As suggested by one of the following replies, using [H] works for me. Out of curiosity, what is the difference between the effects of [H] and [!h]?

Try to remove [!h]
The thing is that \begin{table} ... \end{table} defines a floating insertion. This insertion appears on one of the following pages. \begin{longtable} defines non-floating table. Longtable appears immediately.
You should to remove \begin{table} ... \end{table} to make first table appears immediatly. [!h] does not make table to be non-floation.

I forget if it's the array or float package that gives you [H], but this has always worked for me:
\begin{table}[H]
...
\end{table}

Related

LaTeX: Table of contents

I am trying to generate a table of contents using latex and I succeeded but I want to edit it at which the whole table is written in capital as in the figure attached
I tried this code:
%To make the sections in uppercase
\makeatletter
\patchcmd{\l#section}{#1}{\MakeUppercase{#1}}{}{}% Sections use UPPERCASE in ToC
\makeatother
But it produced an error.
Is there any alternative to do that? Your help is appreciated

LaTeX one column title and index in a two column document

I'm trying to write a document using the twocolumn option but I found that the title and the index are formatted in the same way as the text. How can I have a twocolumn document with the title and the index onecolumn?
I've tried #twocolumn false and the abstrack package but the first gives me a one column half page long and the second do not allow me to span the index fr multiple pages.
This should do the trick
\documentclass[twocolumn]{article}
\usepackage{multicol}
\twocolumn[
\begin{#twocolumnfalse}
\begin{center}
...complicated research title here....
\end{center}
\end{#twocolumnfalse}
]

Can I make the entire "Table 1" clickable as a reference in Latex?

In my document, I'm using the label function to label tables and figures:
\label{}
Then I use the \ref{} function to refer to the table or figure. in my text.
The problem that I have is that in my text I write this:
As can be seen in Table \ref{table1}.
It will output my text as:
As can be seen in Table 1.
However only the number "1" is clickable and leads up to the table. I want the "Table" part to be clickable as well, so you can click on any part of "Table 1" and get referred up to the table.
I've tried different ways by using \phantomsection\label{} and then \hyperref[]{}, but this doesn't output the table or figure number dynamically.
Use \autoref.
\autoref creates a reference with text depending on the type.
A picture will tell more then thousand words:
Example code:
\documentclass[a4paper]{article}
\usepackage[english]{babel}
\usepackage{graphicx}
\usepackage[colorlinks=true, allcolors=blue]{hyperref}
\begin{document}
\textbackslash ref to the Figure \ref{fig:example}
\textbackslash autoref to the \autoref{fig:example}
\textbackslash nameref to the figure \nameref{fig:example}
\begin{figure}
\centering
\includegraphics[width=0.3\textwidth]{example-image-a}
\caption{\label{fig:example}Example image}
\end{figure}
\end{document}
To change the text inserted by \autoref for e.g. a table:
\renewcommand{\tableautorefname}{bettertablename}
See the hyperref manual for all options.

Subfloat figures in latex

I am inputting a bunch of figures in Latex using
\begin{figure}[h]
\centering
\subfloat
etc.
How do I get the subfloat figures to go to the next page? What I mean is, I'm inputting a ton of figures so it'll definitely be more than one page but if I do separate figures for each the a, b, c, d, etc. for the captions will change, so ideally I'd like one enormous figure with a bunch of subfloats a through z on different pages - how do you do that? Right now, I simply can't see the subfloat figures that stretch over the page, so I'll need to get another page somehow.
Separate the figures into batches that fit on one page and in the figure environments after the first put
\addtocounter{figure}{-1}
which will decrease the figure counter making it the same as for the previous bunch and then also add
\addtocounter{subfigure}{N}
where N is the number of subfigs that you have already placed, which will start the subfig counter from the correct value.
More on the subfigure package here (PDF).

How to display a content in two-column layout in LaTeX?

I am writing an article in LaTeX and I would like to display some content in two column layout. In the left column a matrix and in the right column a list of items. I have tried with tabular environment but it does not work as I want.
My question is how to create a two column area in a LeTeX document (or something similar) and be able to put certain content to left and right column? I do not want to create a two-column layout for whole document, only for part of it.
Load the multicol package, like this \usepackage{multicol}. Then use:
\begin{multicols}{2}
Column 1
\columnbreak
Column 2
\end{multicols}
If you omit the \columnbreak, the columns will balance automatically.
Use two minipages.
\begin{minipage}[position]{width}
text
\end{minipage}

Resources