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)?
Related
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}
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}
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}
Although i have tried many code of a footnote in a caption of a figure , it doesn't work , really , where is the problem here
\documentclass[a4paper,12pt]{report}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{fancyhdr}
\makenomenclature
\usepackage[nottoc]{tocbibind}
\pagenumbering{Roman}
\usepackage{lipsum}
\setcounter{tocdepth}{5}
\setcounter{secnumdepth}{4}
\begin{document}
\begin{figure}
\centering
\includegraphics[width=0.8\textwidth{images/frog.jpg}
\caption[frog]{frog \footnotemark }
\label{fig:pic1}
\end{figure}
\footnotetext{frog}
\end{document}
Two problems:
you can't have the \makenomenclature macro in your code with a package which defines it, e.g. nomencl
the ] after the optional argument of your graphic is missing
With the split between \footnotetext and \footnotemark there is always the risk that the floating figure and the footnote will end up on different pages. You can lessen the risk by using [htbp] as floating specifier for your figure, this way you at least allowed the figure to be placed where the footnote is.
\documentclass[a4paper,12pt]{report}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{fancyhdr}
%\makenomenclature
\usepackage[nottoc]{tocbibind}
\pagenumbering{Roman}
\usepackage{lipsum}
\setcounter{tocdepth}{5}
\setcounter{secnumdepth}{4}
\begin{document}
\begin{figure}[htpb]
\centering
\includegraphics[width=0.8\textwidth]{example-image-duck}
\caption[frog]{frog \footnotemark }
\label{fig:pic1}
\end{figure}
\footnotetext{frog}
\end{document}
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}