How do I make my captions both for table and figures left aligned. I tried using \usepackage[justification=justified,singlelinecheck=false]{caption}
.
But the caption is aligned with the page and not with the figure or table.
\documentclass[journal]{IEEEtran}
\usepackage{algorithmic}
\usepackage{graphicx}
\usepackage{algorithm}
\usepackage[justification=justified,singlelinecheck=false]{caption}
\begin{document}
\begin{figure}[h!]
\centering
\includegraphics[height=2.1in,width=3.3in]{FPR_PpuCmpr}
\caption{False Positive Rate (FPR) Vs $P_{pu}$ (Majority Rule) }
\label{figureFPR_PpuCmpr}
\end{figure}
\end{document}
Best Answer
When using the
caption
package with theIEEEtran
class you receive the following package warning:So let's not use
caption
.You can set the image-and-caption inside a
minipage
of fixed width. This fixed width would match what you want the image width to be, and then setwidth=\linewidth
for your\includegraphics
. This will ensure that the image is the same width as the width specified for theminipage
:When working with a table that you want the same to happen, you could use the
varwidth
package'svarwidth
environment; use\columnwidth
as your "fixed-width specification". It's similar tominipage
, but will shrink if the contents is narrower than specified.