laTex/minipage/captionof command - latex

I am using LaTeX to write my project report and am using minipage to insert multiple pictures and also am trying to add caption to every picture but whenever I run my code only the pictures appear without the caption. Below is the code I used
\begin{minipage}[t]{0.5\textwidth}
\centering
\includegraphics[width=\textwidth]{yearly1}
\captionof{figure}{example1}
\label{fig:figure}
\end{minipage}
\begin{minipage}[t]{0.5\textwidth}
\centering
\includegraphics[width=\textwidth]{yearly2}
\captionof{figure}{example2}
\end{minipage}
\begin{minipage}[t]{0.5\textwidth}
\centering
\includegraphics[width=\textwidth]{yearly3}
\captionof{figure}{example3}
\end{minipage}
\begin{minipage}[t]{0.5\textwidth}
\centering
\includegraphics[width=\textwidth]{yearly4}
\captionof{figure}{example4}
\end{minipage}
\begin{minipage}[t]{0.5\textwidth}
\centering
\includegraphics[width=\textwidth]{yearly5}
\captionof{figure}{example5}
\end{minipage}
\begin{minipage}[t]{0.5\textwidth}
\centering
\includegraphics[width=\textwidth]{yearly6}
\captionof{figure}{example6}
\end{minipage}

Related

change subfigure configuration in latex

I use the following example code to create a subfigure in my latex document.
\usepackage{caption}
\usepackage{subcaption}
\begin{figure}
\centering
\begin{subfigure}[b]{0.3\textwidth}
\centering
\includegraphics[width=\textwidth]{Figures/F1.png}
\caption{}
\label{fig:1}
\end{subfigure}
\hfill
\begin{subfigure}[b]{0.3\textwidth}
\centering
\includegraphics[width=\textwidth]{Figures/F2.png}
\caption{}
\label{fig:2}
\end{subfigure}
\hfill
\begin{subfigure}[b]{0.3\textwidth}
\centering
\includegraphics[width=\textwidth]{Figures/F3.png}
\caption{}
\label{fig:3}
\end{subfigure}
\caption{Values}
\label{fig:three graphs}
\end{figure}
And I get the following output configuration
But the sub-figures are too small on the page. So I want to change it to the following configuration and make the figure a bit larger and centered. How to modify this code to change the Figure configuration?
\documentclass{article}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{graphicx}
\begin{document}
\begin{figure}
\centering
\begin{subfigure}[b]{0.45\textwidth}
\centering
\includegraphics[width=\textwidth]{example-image-duck}
\caption{}
\label{fig:1}
\end{subfigure}
\quad
\begin{subfigure}[b]{0.45\textwidth}
\centering
\includegraphics[width=\textwidth]{example-image-duck}
\caption{}
\label{fig:2}
\end{subfigure}
\begin{subfigure}[b]{0.45\textwidth}
\centering
\includegraphics[width=\textwidth]{example-image-duck}
\caption{}
\label{fig:3}
\end{subfigure}
\caption{Values}
\label{fig:three graphs}
\end{figure}
\end{document}

Latex: how to align subcaptions on the top left and caption to the right of the figures

I am using LaTeX to write a report and I'm going crazy to get a result like
with subcaptions (a), (b), (c) align to the top left of the subfigures and caption on the right of the figure.
I've already tried with floatrow and subcaption, but I've never obtained the result I want.
MWE:
\documentclass{article}
\usepackage[demo]{graphicx}
\usepackage{floatrow}
\usepackage{subfig}
\floatsetup[figure]{style=plain,subcapbesideposition=top}
\begin{figure*}
\ffigbox[\FBwidth]
{\begin{subfloatrow}
\sidesubfloat[]{\includegraphics[width=.5\linewidth]{image1}\label{fig:a}}%
\sidesubfloat[]{\includegraphics[width=.5\linewidth]{image2}\label{fig:b}}%
\end{subfloatrow}}
{\caption{Two figures}\label{}}
\end{figure*}
\end{document}
Here some starting point with the subcaption package (the exact dimensions might need some tweaking to nicely align with the surrounding text)
\documentclass{article}
\usepackage{graphicx}
\usepackage{subcaption}
\captionsetup[subfigure]{font={bf,small}, skip=1pt, margin=-0.7cm, singlelinecheck=false}
\begin{document}
\begin{figure*}
\hfill
\begin{minipage}[b]{.63\textwidth}
\begin{subfigure}{\textwidth}
\subcaption{}
\includegraphics[width=\linewidth]{example-image-duck}
\end{subfigure}\par
\begin{subfigure}{\textwidth}
\subcaption{}
\includegraphics[width=\linewidth]{example-image-duck}
\end{subfigure}
\end{minipage}
\quad
\begin{minipage}[b]{.3\textwidth}
\caption{some caption with aligns at the bottom}\label{key}
\end{minipage}
\end{figure*}
\end{document}

subfig - not plotting figures

I would like to refresh this thread: Subfigs of a figure on multiple pages.
I am struggling with reproduction. I have used suggestions on this post and I have used subfig docs. Unfortunately, neither works.
%Packages which I am using:
\usepackage{graphicx}
\usepackage{caption}
\usepackage{subfig}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\begin{figure}
\centering
\subfloat[]{figures/fig1.pdf}
\qquad
\subfloat[]{figures/fig2.pdf}
\caption{Caption nr 1.}
\label{fig:figure1_2}
\end{figure}
\begin{figure}
\ContinuedFloat
\centering
\subfloat[]{figures/fig3.pdf}%
\qquad
\subfloat[]{figures/fig4.pdf}
\caption[]{Caption nr 2}
\label{fig:fig3_4}
\end{figure}
\end{document}
The output of it is a page with directories of figures displays accordingly without a figure itself.
Please let me know if something I missed.
You need to include the images with \includegraphics:
\documentclass{article}
%Packages which I am using:
\usepackage{graphicx}
\usepackage{caption}
\usepackage{subfig}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\begin{figure}
\centering
\subfloat[]{\includegraphics[width=5cm]{example-image-duck}}
\qquad
\subfloat[]{\includegraphics[width=5cm]{example-image-duck}}
\caption{Caption nr 1.}
\label{fig:figure1_2}
\end{figure}
\begin{figure}
\ContinuedFloat
\centering
\subfloat[]{\includegraphics[width=5cm]{example-image-duck}}%
\qquad
\subfloat[]{\includegraphics[width=5cm]{example-image-duck}}
\caption[]{Caption nr 2}
\label{fig:fig3_4}
\end{figure}
\end{document}

Beamer : overlayarea inside a figure?

in my Beamer presentation, I would like to dynamically switch images in a figure environnement.
More precisely, my figure contains 9 subfloats presented 3x3 and each of them should switch between two images during the presentation.
In order to avoid some "tilting" between the different elements, I thought that it would be a good idea to use an overlayarea inside each subfloat.
Sadly, when used in an figure environment, the overlayarea seems to behave very odd : every thing I put in it appear outside the overlayarea ??
Here is a very short example :
\documentclass[9pt, aspectratio=43]{beamer}
\usepackage [francais]{babel}
\usepackage [T1]{fontenc}
\usepackage [utf8]{inputenc}
\usepackage[position=top]{subfig}
\usepackage{pdfpages}
\begin{document}
\begin{frame}
%% This works fine : 123 appears INSIDE the overlayarea
\fbox{\begin{overlayarea}{3cm}{2cm}
\fbox{123}
\end{overlayarea}}
%% This looks odd : 456 appears OUTSIDE the overlayarea
\begin{figure}
\fbox{\begin{overlayarea}{3cm}{2cm}
\fbox{456}
\end{overlayarea}}
\end{figure}
\end{frame}
\end{document}
Perhaps I mis-use this environnement ?
Thanks a lot :)
BR
Donut
Quick workaround: warp your subimages in minipages of fixed height:
\documentclass[9pt, aspectratio=43]{beamer}
\begin{document}
\begin{frame}
\begin{figure}
\begin{minipage}[c][.3\textheight][c]{.3\textwidth}
\centering
\includegraphics<1>[width=\textwidth,height=.3\textheight,keepaspectratio]{example-image-9x16}%
\includegraphics<2>[width=\textwidth,height=.3\textheight,keepaspectratio]{example-image-duck}%
\end{minipage}%
\hfill
\begin{minipage}[c][.3\textheight][c]{.3\textwidth}
\centering
\includegraphics<2>[width=\textwidth,height=.3\textheight,keepaspectratio]{example-image-9x16}%
\includegraphics<1>[width=\textwidth,height=.3\textheight,keepaspectratio]{example-image-duck}%
\end{minipage}%
\hfill
\begin{minipage}[c][.3\textheight][c]{.3\textwidth}
\centering
\includegraphics<1>[width=\textwidth,height=.3\textheight,keepaspectratio]{example-image-9x16}%
\includegraphics<2>[width=\textwidth,height=.3\textheight,keepaspectratio]{example-image-duck}%
\end{minipage}%
\begin{minipage}[c][.3\textheight][c]{.3\textwidth}
\centering
\includegraphics<2>[width=\textwidth,height=.3\textheight,keepaspectratio]{example-image-9x16}%
\includegraphics<1>[width=\textwidth,height=.3\textheight,keepaspectratio]{example-image-duck}%%
\end{minipage}%
\hfill
\begin{minipage}[c][.3\textheight][c]{.3\textwidth}
\centering
\includegraphics<2>[width=\textwidth,height=.3\textheight,keepaspectratio]{example-image-9x16}%
\includegraphics<1>[width=\textwidth,height=.3\textheight,keepaspectratio]{example-image-duck}%
\end{minipage}%
\hfill
\begin{minipage}[c][.3\textheight][c]{.3\textwidth}
\centering
\includegraphics<2>[width=\textwidth,height=.3\textheight,keepaspectratio]{example-image-9x16}%
\includegraphics<1>[width=\textwidth,height=.3\textheight,keepaspectratio]{example-image-duck}%
\end{minipage}%
\begin{minipage}[c][.3\textheight][c]{.3\textwidth}
\centering
\includegraphics<1>[width=\textwidth,height=.3\textheight,keepaspectratio]{example-image-9x16}%
\includegraphics<2>[width=\textwidth,height=.3\textheight,keepaspectratio]{example-image-duck}%
\end{minipage}%
\hfill
\begin{minipage}[c][.3\textheight][c]{.3\textwidth}
\centering
\includegraphics<2>[width=\textwidth,height=.3\textheight,keepaspectratio]{example-image-9x16}%
\includegraphics<1>[width=\textwidth,height=.3\textheight,keepaspectratio]{example-image-duck}%
\end{minipage}%
\hfill
\begin{minipage}[c][.3\textheight][c]{.3\textwidth}
\centering
\includegraphics<1>[width=\textwidth,height=.3\textheight,keepaspectratio]{example-image-9x16}%
\includegraphics<2>[width=\textwidth,height=.3\textheight,keepaspectratio]{example-image-duck}%
\end{minipage}%
\end{figure}
\end{frame}
\end{document}

Ordering subfigures in LaTex

I have this code in LaTex:
\begin{figure}[h!]
\centering
\subfigure[]{\includegraphics[width=50mm]{katua.jpg}}
\subfigure[]{\includegraphics[width=60mm]{txakurren_balioak.png}}
\subfigure[]{\includegraphics[width=60mm]{katuen_balioak.png}}}
\label{fig:eb3}
\end{figure}
and I get this:
And I want to put the images in two columns. In the column of the left the image of the cat and in the right the two histograms. How it is possible to do this?
Instead of \centering you could use \hfill to do the centering, see the example below:
\documentclass{report}
\usepackage{graphicx}
\usepackage{subfigure}
\begin{document}
\begin{figure}[h!]
\hfill
\subfigure[]{\includegraphics[width=50mm]{example-image-a}}
\hfill
\subfigure[]{\includegraphics[width=60mm]{example-image-b}}
\hfill
\hfill
\subfigure[]{\includegraphics[width=60mm]{example-image-c}}
\end{figure}
\end{document}

Resources