Putting two or three images in two column article in one row - latex

I'm using aps article based LaTeX template and I would like to put two pictures next to each other (with captions) in a two column article, so that they would span across the both columns.
I've used minipage inside figure option (works in one column article) but I cannot get the desired result. I'd like it to look like this:
how I wish that it look
So the example has only one caption, but that's irrelevant. I'd like to put two pictures next to each other so that they would be on top of the page.
Any suggestions? Thanks : )

I assume you're using RevTeX. As #thouis said, you use the \figure* environment to span a figure across the entire page. To put more than one figure, use the subfigure package. It looks something like
\begin{figure}
\centering
\mbox{
\subfigure[<subfigure caption here>\label{subfigure label}]{\includegraphics[scale/width]{<filename>}}\quad
\subfigure[<subfigure caption here>\label{subfigure label}]{\includegraphics[scale/width]{<filename>}}\quad
\subfigure[<subfigure caption here>\label{subfigure label}]{\includegraphics[scale/width]{<filename>}}
}
\caption{<main figure caption here>}
\label{main figure label}
\end{figure}
You can adapt this for the \figure* environment.

\figure*{} doesn't work? This is the usual way to create multi-column spanning figures.

Related

Split long image over two pages

I would like to know what the best way is to split a long image over two pages in latex.
Since it is for a scientific journal I am not really allowed to use external packages.
My idea is currently to create two separate images and add them in latex, with only the last one getting the caption and the first one not included in the numeration.
Is there any way to force the two images to stay close together and not allow any text to be inserted inbetween them? I don't mind having the images placed in some random location but they should obviously not get separated.
Looking forward to some advice.
So I figured out how to do it, based on other answers I found here on stackoverflow:
Caption numbering for continuedfloat
Page Break between images
\begin{figure*}
\centering
\includegraphics[trim={0 41cm 0 0},clip,width=\textwidth]{Images.png}
\phantomcaption
\end{figure*}
\begin{figure*}
\ContinuedFloat
\centering
\includegraphics[trim={0 0 0 64cm},clip,width=\textwidth]{Images.png}
\caption{Lorem Ipsum}
\label{FIG}
\end{figure*}

How to place the figure at the bottom of page in latex?

I am having problem in placing the figure at the bottom of page in latex. When I specify the \begin{figure*}[b], all the figures in my documents goes at the end of document. What I need is just place one specific figure at the bottom of current page or next page.
Please guide me how can I do this?
In order to place a float at the bottom of a two-column document, you can use the dblfloatfix package. From the brief package description:
The pack­age solves two prob­lems: floats in a twocol­umn doc­u­ment come out in the right order and al­lowed float po­si­tions are now [tbp].
So, after \usepackage{dblfloatfix} you can use
\begin{figure*}[btp]
% <your figure here>
\end{figure*}
Like will all floats (especially in a two-column environment), the float may not end up where it is placed. As such, you may have to move around the figure* declaration to achieve the desired location within your document.
stfloats provides a similar functionality.
Reference: Put a table* at the bottom of a page?
Werner's solutions didn't actually work for me.
So I just used this -
\begin{figure*}[b]
% <your figure here>
\end{figure*}
source: https://www.overleaf.com/learn/latex/Positioning_of_Figures
Using \begin{figure*}[!b] worked for me.

How to place a wide figure with subfigures in Latex?

I am trying to write a report and stuck with a wide figure. My document type is PRL using revtex4.1 with two columns. I have a wide figure which consists of 8 subfigures. I am trying to place it bottom of a page but it insists to go next page. Here is code for my wide figure:
\begin{figure*}
\centering
\subfloat[s1]{\label{fig:s1}\includegraphics[width=0.20\textwidth]{s1.png}}\qquad
\subfloat[s2]{\label{fig:s2}\includegraphics[width=0.20\textwidth]{s2.png}}\qquad
\subfloat[s3]{\label{fig:s3}\includegraphics[width=0.20\textwidth]{s3.png}}\qquad
\subfloat[s4]{\label{fig:s4}\includegraphics[width=0.20\textwidth]{s4.png}}\\
\subfloat[s5]{\label{fig:s5}\includegraphics[width=0.20\textwidth]{s5.png}}\qquad
\subfloat[s6]{\label{fig:s6}\includegraphics[width=0.20\textwidth]{s6.png}}\qquad
\subfloat[s7]{\label{fig:s7}\includegraphics[width=0.20\textwidth]{s7.png}}\qquad
\subfloat[s8]{\label{fig:s8}\includegraphics[width=0.20\textwidth]{s8.png}}
\caption{\label{fig:s}Caption}
\end{figure*}
Try also
\begin{figure*}[!hb]
If your figure is too wide, this might help: Centering wide tables or figures.
I don't know whether it will work, but have you tried using placements, ie:
\begin{figure*}[b]
where b stands for bottom?
You could also try using the float package (put this in the preamble, before \begin{document}:
\usepackage{float}
and then using
\begin{figure*}[H]
to specify exactly where you want your figure to be, i.e. put the figure exactly in the position in relation to your text where you want the figure to be placed.
It may be that your figure is just too big and it won't fit there, so you may have to reduce the size of the figures or fiddle with the margins (not recommended, but possible).
Lastly, in 6 days the LaTeX question and answer website will be open to everyone, and you might find it useful.

LaTeX table positioning

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}.

Adding full page figures in Latex, how?

I have a full-page figure that LaTeX keeps putting at the end because of its size.
I would like it to be integrated on a separate page in the flow of text. How can I do it?
\begin{figure}[hbtp]
h = here
b = botom
t = top
p = page of floats
Algorithm will try the current position in document first, then bottom, then top and then on a seperate page. If you just specify 'h' you will force placement where the figure command is in the document. The order is encoded by you -- i.e., you could specify ptbh which would force a reverse order of evaluation.
p.s., I would strongly recomend anyone using latex to use lyx. Its just as powerfull as straight latex but its wysiwyg and you can drop to tex anywhere you want.
If you also want the caption to be rotated, you can also use
\usepackage{rotating}
\begin{sidewaysfigure}
That also eliminates the need for using angle=90 or something like that
\begin{figure*}[tb]
\centering
\makebox[\textwidth]{\includegraphics[width=.9\paperwidth]{./fig/fig5.eps}}
\caption{The SAP data model based on an UML class diagram: classes and relationships.}
\label{fig:Fig5}
\end{figure*}

Resources