latex subfigures not centered - latex

This latex code:
\begin{figure}[H]
\setlength{\figW}{5cm} % determines the width of the images
\begin{subfigure}[b]{0.5\textwidth}
\input{images/eigw_kegel_0.5.tex}
\caption{}
\end{subfigure}
\begin{subfigure}[b]{0.5\textwidth}
\input{images/eigw_kegel_0.05.tex}
\caption{}
\end{subfigure} \\
\begin{subfigure}[b]{0.5\textwidth}
\input{images/eigv_norm_kegel_0.5.tex}
\caption{}
\end{subfigure}
\begin{subfigure}[b]{0.5\textwidth}
\input{images/eigv_norm_kegel_0.05.tex}
\caption{}
\end{subfigure}
\caption{(a) and (b): $\lambda_1(\VM{\omega})$ and
$\lambda_2(\VM{\omega})$ with $\omega_1 = 0.5$ (left) and $\omega_1 =
0.05$ (right), (c) and (d): norm of $\pderiv{\VM{x}_1(\VM{\omega})}
{\omega_2}$ with $\omega_1= 0.5$ (left) and $\omega_1= 0.05$ (right)}
\end{figure}
gives me the following output:
I would like to have the following output (made it using paint). How to adapt the latex-code so that I get this result?

I fixed this issue myself. You just need to add
\hspace{0.8cm} to move the figures to the right.
\begin{figure}[H]
\setlength{\figW}{5cm} % determines the width of the images
\begin{subfigure}[b]{0.5\textwidth}
\hspace{0.8cm}
\input{images/eigw_kegel_0.5.tex}
\caption{}
\end{subfigure}
\begin{subfigure}[b]{0.5\textwidth}
\hspace{0.7cm}
\input{images/eigw_kegel_0.05.tex}
\caption{}
\end{subfigure} \\
\begin{subfigure}[b]{0.5\textwidth}
\input{images/eigv_norm_kegel_0.5.tex}
\caption{}
\end{subfigure}
\begin{subfigure}[b]{0.5\textwidth}
\input{images/eigv_norm_kegel_0.05.tex}
\caption{}
\end{subfigure}
\caption{(a) and (b): $\lambda_1(\VM{\omega})$ and
$\lambda_2(\VM{\omega})$ with $\omega_1 = 0.5$ (left) and $\omega_1 =
0.05$ (right), (c) and (d): norm of $\pderiv{\VM{x}_1(\VM{\omega})}
{\omega_2}$ with $\omega_1= 0.5$ (left) and $\omega_1= 0.05$ (right)}
\end{figure}

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}

Numbering of the subfigures are not centered with the figure in LATEX

The numbering (a,b,c) in the subfigures is a little off-center with the subfigures. I keep \caption inside the subfigure section empty because I do not want any captions but if I remove it, the numbering will go away. Is there any way to keep the numbering and make it centers with subfigures?
\documentclass[conference]{IEEEtran}
\IEEEoverridecommandlockouts
\usepackage{cite}
\usepackage{amsmath,amssymb,amsfonts}
\usepackage{algorithmic}
\usepackage{graphicx}
\usepackage{textcomp}
\usepackage{xcolor}
\usepackage{algorithm}
\usepackage{amsmath,amssymb}
\usepackage{subcaption}
\usepackage{url}
\usepackage{hyperref}
\begin{document}
\begin{figure*}[!h]
\centering
\begin{subfigure}[t]{0.3\textwidth}
\centering
\includegraphics[scale=0.3]{Paper/results.PNG}
\caption{} \label{fig1}
\end{subfigure}\hfill
\begin{subfigure}[t]{0.3\textwidth}
\centering
\includegraphics[scale=0.3]{Paper/results.PNG}
\caption{} \label{fig2}
\end{subfigure}\hfill
\begin{subfigure}[t]{0.3\textwidth}
\centering
\includegraphics[scale=0.3]{Paper/results.PNG}
\caption{} \label{fig3}
\end{subfigure}
\caption{Figures}
\label{fig:my_label}
\end{figure*}
\end{document}

How to set the picture title locally small in latex?

I have been stuck trying to change the local size of a picture title.
The picture is like this. The "EnlightenGAN" is just too long. I would want to make "EnlightenGAN" smaller only.
This is the picture
the code is here:
\begin{figure}[!htb]
\label{fig:example}
\begin{subfigure}{.194\textwidth}
\centering
\includegraphics[width=\textwidth]{figures/exdark/原图/2015_00001.png}
\caption{输入图片}
\end{subfigure}
\begin{subfigure}{.194\textwidth}
\centering
\includegraphics[width=\textwidth]{figures/exdark/dupe/2015_00001.png}
\caption{Deep-UPE\upcite{DUPE}}
\end{subfigure}
\begin{subfigure}{.194\textwidth}
\centering
\includegraphics[width=\textwidth]{figures/exdark/lime/2015_00001.jpg}
\caption{LIME\upcite{LIME}}
\end{subfigure}
\begin{subfigure}{.194\textwidth}
\centering
\includegraphics[width=\textwidth]{figures/exdark/mir/2015_00001.jpg}
\caption{MIRNet\upcite{MIRNet}}
\end{subfigure}
\begin{subfigure}{.194\textwidth}
\centering
\includegraphics[width=\textwidth]{figures/exdark/retinex/2015_00001.jpg}
\caption{RetinexNet\upcite{retinexnet}}
\end{subfigure}
\begin{subfigure}{.194\textwidth}
\centering
\includegraphics[width=\textwidth]{figures/exdark/ssien/2015_00001.jpg}
\caption{SSIEN\upcite{ssien}}
\end{subfigure}
\begin{subfigure}{.194\textwidth}
\centering
\includegraphics[width=\textwidth]{figures/exdark/zeroDCE/2015_00001.jpg}
\caption{Zero-DCE\upcite{zero}}
\end{subfigure}
\begin{subfigure}{.194\textwidth}
\centering
\includegraphics[width=\textwidth]{figures/exdark/enlightenGAN/2015_00001.png}
\small
\caption{EnlightenGAN\upcite{enlightengan}}
\end{subfigure}
\begin{subfigure}{.194\textwidth}
\centering
\includegraphics[width=\textwidth]{figures/exdark/kind/2015_00001.jpg}
\caption{KinD\upcite{KinD}}
\end{subfigure}
\begin{subfigure}{.194\textwidth}
\centering
\includegraphics[width=\textwidth]{figures/exdark/mine/2015_00001.png}
\caption{本文}
\end{subfigure}
\caption{增强结果}
\end{figure}
I would be grateful if anyone could help me with this problem!

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}

LaTeX: Indent subcaption in figure environment

See this MWE:
% !TeX spellcheck = en_US
\documentclass[12pt]{article}
\usepackage[onehalfspacing]{setspace}
\usepackage[a4paper, margin=2.5cm]{geometry}
\usepackage{mathptmx}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage[hang]{caption}
\usepackage{subcaption}
\usepackage[bottom]{footmisc}
\usepackage{dcolumn} %makes r output work
\usepackage{tabularx}
\newcolumntype{L}[1]{>{\raggedright\arraybackslash}p{#1}}
\newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}}
\newcolumntype{R}[1]{>{\raggedleft\arraybackslash}p{#1}}
\newcommand{\possessivecite}[1]{\citeauthor{#1}'s (\citeyear{#1})}
\usepackage{pdfpages}
\usepackage{hyperref}
\usepackage{pdflscape}
\usepackage{xcolor}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}
\begin{landscape}
\setcapmargin[2cm]
\begin{figure}[]
\captionsetup{justification=centering}
\caption{Main Caption. }
\label{fig:val_efcts}
\begin{subfigure}{0.55\textwidth}
\caption{X}
\includegraphics[width=\textwidth] {example-image-a}
\end{subfigure}
\begin{subfigure}{0.55\textwidth}
\caption{Y}
\includegraphics[width=\textwidth] {example-image-b}
\end{subfigure}
\begin{subfigure}{0.55\textwidth}
\caption{Z}
\includegraphics[width=\textwidth] {example-image-c}
\end{subfigure}
\captionsetup{justification=raggedright} \subcaption*{This subcaption is supposed to be ragged right and intented by 4 cm. \\ This is in a new line.}
\end{figure}
\end{landscape}
\end{document}
It should be self-explanatory, mostly. I'd like the last subcaption below the picture to be ragged right, but indented 2 cm. I tried to use \setcapmargin, but that does not work, creating the "undefined control sequence" error (so it's an unknown command).
Since you're writing a caption without numbering, set it in a \parbox where you have some more control over the placement and alignment:
\documentclass{article}
\usepackage{graphicx}
\usepackage[hang]{caption}
\usepackage{subcaption}
\begin{document}
\begin{figure}[]
\captionsetup{justification=centering}
\caption{Main Caption. }
\label{fig:val_efcts}
\begin{subfigure}{0.3\textwidth}
\caption{X}
\includegraphics[width=\linewidth] {example-image-a}
\end{subfigure}\hfill
\begin{subfigure}{0.3\textwidth}
\caption{Y}
\includegraphics[width=\linewidth] {example-image-b}
\end{subfigure}\hfill
\begin{subfigure}{0.3\textwidth}
\caption{Z}
\includegraphics[width=\linewidth] {example-image-c}
\end{subfigure}
\hspace*{4cm}%
\parbox{\dimexpr\linewidth-8cm}{\raggedright
\strut This subcaption is supposed to be ragged right and indented by 4cm. \\
This is in a new line.\strut%
}
\end{figure}
\end{document}
Note the use of \struts to support correct baseline alignment when dealing with text inside \parboxes. For more on this, see How to keep a constant baseline skip when using minipages (or \parboxes)?

Resources