subfig - not plotting figures - latex

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}

Related

Align Sub Figures in latex (IEEE paper format)

I want to align three figures in one row. I used the following latex code but got this output. What to change in this code to get these figures in one row? Thank you in advance.
\documentclass[conference]{IEEEtran}
\IEEEoverridecommandlockouts
\begin{document}
\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{figure*}[!h]
\centering
\begin{subfigure}[t]{0.5\textwidth}
\centering
\includegraphics[scale=0.5]{Paper/results.PNG}
\caption{Fig_1} \label{fig1}
\end{subfigure}\hfill
\begin{subfigure}[t]{0.5\textwidth}
\centering
\includegraphics[scale=0.5]{Paper/results.PNG}
\caption{Fig_2} \label{fig2}
\end{subfigure}\hfill
\begin{subfigure}[t]{0.5\textwidth}
\centering
\includegraphics[scale=0.5]{Paper/results.PNG}
\caption{Fig_3} \label{fig3}
\end{subfigure}
\caption{Figures}
\label{fig:my_label}
\end{figure*}
\end{document}
This is a two-column paper
Output I get from the above code
The sum of 3 times .5\textwidth is much bigger than the available space on one line. If you want to fit all three images in a single line, make them smaller:
\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[width=\textwidth]{example-image-duck}
\caption{Fig1} \label{fig1}
\end{subfigure}\hfill
\begin{subfigure}[t]{0.3\textwidth}
\centering
\includegraphics[width=\textwidth]{example-image-duck}
\caption{Fig2} \label{fig2}
\end{subfigure}\hfill
\begin{subfigure}[t]{0.3\textwidth}
\centering
\includegraphics[width=\textwidth]{example-image-duck}
\caption{Fig3} \label{fig3}
\end{subfigure}
\caption{Figures}
\label{fig:mylabel}
\end{figure*}
\end{document}

How to remove automatic numbering of figure in LaTex?

I would like the caption of my figure to be "Figure A". Is there a way to remove the automatic numbering of the figures?
\documentclass[jou]{apa7}
\usepackage{graphicx}
\begin{document}
\begin{figure}
\renewcommand{\figurename}{Figure A}
\centering
\caption{Title}
\includegraphics[width=0.5\textwidth]{test.png}
\end{figure}
\end{document}
With the code above, the caption is "Figure A 1".
Thank you in advance!
Two quick hacks, either you can temporarily remove the number or you can latex do the numbering with capital letters:
\documentclass[jou]{apa7}
\usepackage{graphicx}
\begin{document}
\begin{figure}
\renewcommand{\figurename}{Figure A}
\renewcommand{\thefigure}{}
\centering
\caption{Title}
\includegraphics[width=0.5\textwidth]{example-image-duck}
\end{figure}
\begin{figure}
\renewcommand{\thefigure}{\Alph{figure}}
\centering
\caption{Title}
\includegraphics[width=0.5\textwidth]{example-image-duck}
\end{figure}
\end{document}

How to put and align figures in multicols environment

I write an article, which is divided into two columns separated by a line. I use multicol package. I want to insert figures and align them to the top or to the down of the page in multicols environment. Figures can be inserted by the use of minipage environment by i don't know how to align them up or down. figure environment does not work in multicols environment.
\documentclass{article}
\usepackage{geometry}
\usepackage{multicol}
\usepackage{graphicx}
\usepackage{lipsum}
\usepackage{caption}
\geometry{margin=0.75in}
\begin{document}
\begin{multicols}{2}
\lipsum[1-3]
\vfill
\begin{minipage}{\linewidth}
\centering
\includegraphics[width=\linewidth]{beta_glucan.png}
\captionof{figure}{Figure caption}
\end{minipage}
\lipsum[1-3]
\end{multicols}
\end{document}
Any help will be appreciated cause I have been loosing time at it since friday.
Non-multicols solution:
\documentclass[twocolumn]{article}
\usepackage{geometry}
%\usepackage{multicol}
\usepackage{graphicx}
\usepackage{lipsum}
\usepackage{caption}
\usepackage{float}
\geometry{margin=0.75in}
\setlength{\columnseprule}{0.4pt}
\begin{document}
% \begin{multicols}{2}
\lipsum[1-3]
\begin{figure}[tb]
\centering
\includegraphics[width=\linewidth]{example-image}
\caption{Figure caption}
\end{figure}
\lipsum[1-3]
% \end{multicols}
\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}

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