I use a composed figure that contains two subfigures implemented via subfloats. Example code:  \begin{figure}     \centering      \subfloat[Workload = 1,000]{         \includegraphics[width=0.45\linewidth]{img/fib-1k-dyn.eps}         \label{subfig:fib1k}     }     \qquad     \subfloat[Workload = 20,000]{         \includegraphics[width=0.45\linewidth]{img/fib-20k-dyn.eps}         \label{subfig:fib20k}     }      \label{fig:fib}     \caption{Fibonacci benchmark with fixed workload, dynamic scheduling} \end{figure}   When I refer to the first subfigure via \ref{subfig:fib1k} the really pretty text is displayed such as 5.1a or 5.1b in the analogous reference.  However, sometimes I need to refer to the whole image, i.e. \ref{fib}. In that case I'd expect 5.1 (without the letter of course). Instead, unknown reference is presented ??.  How can I refer to it properly? I use pdflatex and \usepackage{subfig} package.
31
\documentclass{article} \usepackage{algorithm}  \begin{document} \setcounter{section}{54} \section{A section with no label} \begin{algorithm} \label{myalg} \caption{An algorithm with the label `myalg'.} \end{algorithm} Reference to myalg: \ref{myalg}. \end{document}   With this code, the reference givens 55 (the section number); if I move the label after the caption command, I get the correct reference (1).  Why should this be the case? I find it confusing: when thinking about an algorithm as an environment, you expect to be able to label it right after you began it. At the very least I would expect some kind of error or "??" to appear, rather than the previous environment or reference-able entity being used.
106439
The reference to my sub caption doesn't work  \documentclass{article}  \usepackage{mwe} \usepackage{subcaption} \usepackage{cleveref}  \begin{document}  \section{Section} \begin{center} \captionsetup{type=figure} \begin{subfigure}{0.4\textwidth} \includegraphics[width=\textwidth]{example-image-a.pdf} \caption*{Text 0} \end{subfigure} \begin{subfigure}{0.4\textwidth} \includegraphics[width=\textwidth]{example-image-b.pdf} \caption*{Text 1\label{here}} \end{subfigure} \captionof{figure}{Description} \end{center}  Look at \Cref{here}. \end{document}   Output:   Maybe also see     UPDATE:  It should produce Look at Text 1  Actually it's always the same text, so I would really like a solution where my counter is 0,1, ... at the and of the caption. Or (maybe to use with \caption{\empty} where my counter is Text 0, Text 1, ...
5586
I have two images that I would like to appear on the same page. Each figure should appear as a separate figure with its own caption.  My problem is that LaTeX sometimes places the figures on separate pages.  I currently have achieved this by putting two \psfragfig commands consecutively within the same figure environment. This seems a simple and succesful approach, but I wonder if I am not using the figure environment correctly by doing this. Should I use the subcaption package instead?
40956
I am new to LaTeX. I am not sure how to frame my question. But I will frame it so that it is understandable.  I would like to make a subfigure, but the caption must be   caption of subfigure a-1                caption of subfigure a-2      caption of subfigure b-1      caption of subfigure b-2                    `caption  of entire figure`   I  tried using subfigure, but I am getting continuously a,b,c,d, but i need to name them as as mentioned above (a-1, a-2, b-1, b-2).  In my situation, there are chances that the sub figures might be in different pages.
100146
Possible Duplicate:          I'm having a problem with referencing figures in LaTeX. I have the following text:  \begin{figure}[H] \center \label{fig:enn1015} \includegraphics[scale=0.40]{imagens/outputs/ENN_10_15.eps} \caption{ENN unbalanced 10\%} \end{figure}  The figure \ref{fig:enn1015} (...)   For some reason, the figure caption is:  Figure 3.5 Enn unbalanced 10%   But the text is:  The figure 3.2.1 (...)   Instead of:  The figure 3.5   It is printing the chapter.section.subsection the figure is in, and not the figure. Can anybody help me?
119827
I want to place three figures like this on the page:  (a) (b)   (c)   How do I achieve this using subfloat or any other method in LaTeX? The three figures need to have a common caption and label.  I have tried this:  \begin{figure}[h] \centering \begin{tabular}{c c} \subfloat[] { \includegraphics[scale=0.4]{1.pdf} } &amp; \subfloat[] { \includegraphics[scale=0.4]{2.pdf} } \\ \multicolumn{2}{c} \subfloat[] { \includegraphics[scale=0.6]{3.pdf} } \end{tabular} \caption{Some caption} \label{some-label} \end{figure}   But, this is displaying [] for the third figure instead of (c). Also it displays [] to one side of the page instead of center.
104764
I use \newcommand to quickly include figures. But combined with endfloat, it throws an error. Any ideas how to send floats to end when included this way?  \documentclass{article} \usepackage{graphicx} %\usepackage{endfloat}  % this causes an error  \newcommand{\addfig}[1]{  \begin{figure}[htbp]  % when float environment is included here \centering    \includegraphics[width=\textwidth]{#1}   \end{figure}  }   \begin{document} \addfig{fig1} \end{document}
120077
I'm writing an article using the revtex4 document class, but it appears to be incompatible with subfig (which also seems to be loading caption). How can I title some subfigures in my revtex4 document?  The following minimal example shows how just loading subfig breaks the formatting of figures as defined by the document class.  \documentclass[twocolumn]{revtex4} % Uncomment the following line to see the problem %\usepackage{subfig}  \begin{document} \begin{figure} \centering   \framebox[5cm]{\raisebox{3cm}{}} \caption{Some dummy title for my figure which should be long enough           to occupy at least a couple of lines, and maybe even a bit          more. That's good.} \end{figure} \end{document}   Furthermore, the caption package complains with the following warning  Package caption Warning: \caption will not be redefined since it's already (caption)                redefined by a document class or package which is (caption)                unknown to the caption package. See the caption package documentation for explanation.   So the question is, how could I solve this problem? Is there an alternative to subfig which I could use together with revtex4?
9123
I am writing my master thesis using Memoir. I want all subfigures to have their labels in the top left corner. I have so far done this with tikz, but I would like to find a more elegant solution as my current solution has flaws.  I would like to be able to automatically reference figures in the text, without having to manually specify the subfigure. This means each figure needs to have a label. Yet if I label the subfigure, said label invariably appears underneath the figure, and I am not sure how to move it, change its color and so on.  Anyway, an mwe and images of current and desired solution:  \documentclass{memoir}  \usepackage{tikz,siunitx,mwe} \newsubfloat{figure}  \newcommand{\scalebarimg}[6]{   \begin{tikzpicture}     \draw node[name=micrograph] {\includegraphics[width=#2\textwidth]{#1}}; %I fetch the image     \draw[ultra thick,#6] (micrograph.south west)++(0.03*0#2\textwidth,0.035*0#2\textwidth)--++(#2*#3\textwidth,0)node[above,midway]{#4 \si{\micro\meter}}; %I draw the scalebar     \draw  (micrograph.north west)  node[anchor=north west,yshift=-1,#6]{\textbf{\small{(#5)}}}; %I draw the image label   \end{tikzpicture} }  \begin{document} \begin{figure} \centering \subbottom[\label{fig:one}]{     \scalebarimg{example-image}{.45}{0.33933}{50}{a}{black} }\subbottom[\label{fig:two}]{     \scalebarimg{example-image}{.45}{0.33933}{50}{b}{white} } \caption{Figures (a) and (b) should not be doubly labeled.} \end{figure}    See Figure~\ref{fig:one} and \subcaptionref{fig:two}.  \end{document}   which yields  but I want   Is there a way of letting LaTeX position the label where I want it to relative the top left corner of the image? Or at least hide the caption for each individual subfigure while still labelling it?
112192
If I want to print multiple figures in figure, I'm using subfigure in the figure environment. This work quit well and is looking smart, if all figures have the similar height. Now there is this figure which is more than two times higher than the other ones. I would like to order the subfigures like its shown in the following picture:     But I don’t know how to get this into Latex.   My regular code for four subfigures:  \begin{figure} \centering \begin{subfigure}{0.32\textwidth}    \centering    \includegraphics[width=\textwidth]{highone}    \caption{}    \label{fig:a} \end{subfigure} \begin{subfigure}{0.32\textwidth}     \centering     \includegraphics[width=\textwidth]{b}     \caption{}     \label{fig:b} \end{subfigure} \begin{subfigure}{0.32\textwidth}     \centering     \includegraphics[width=\textwidth]{c}     \caption{}     \label{c} \end{subfigure} \begin{subfigure}{0.32\textwidth}     \centering     \includegraphics[width=\textwidth]{d}     \caption{}     \label{fig:d} \end{subfigure} \caption{Blabla.} \label{fig:abcd} \end{figure}   Thank you for your help!
26614
When using the scrbook document class in combination with the subcaption  package, the numbering of subfigures seems broken. Consider:  \documentclass{scrbook} \usepackage{xcolor} \usepackage{caption} \usepackage{subcaption} \captionsetup{%   format=hang,%   font=small,%   labelfont={sf,bf},%   aboveskip=0.2\normalbaselineskip,%   position=top } \pagestyle{empty}  \begin{document} \begin{figure}   \caption{Black}   \label{fig1}   \centering \rule{2cm}{2cm} \end{figure}  \begin{figure}   \caption{More figures}   \label{fig2}   \centering   \begin{subfigure}{.3\textwidth}     \centering     \caption{Blue}     \label{fig2a}     \color{red}\rule{2cm}{2cm}   \end{subfigure}   \begin{subfigure}{.3\textwidth}     \centering     \caption{Green}     \label{fig2b}     \color{green}\rule{2cm}{2cm}   \end{subfigure}   \begin{subfigure}{.3\textwidth}     \centering     \caption{Blue}     \label{fig2c}     \color{blue}\rule{2cm}{2cm}   \end{subfigure} \end{figure}  Figure \ref{fig1} shows a black box. Figure \ref{fig2} shows colored boxes, where Figure \ref{fig2a} shows a red box, Figure \ref{fig2b} shows a green box, and Figure \ref{fig2c} shows a blue box. \end{document}   This results in the following display:    Clearly, the figure numbering in the text references is off by one for the subfigures. Instead, if I change the document class to article, it looks fine:     Why does this happen, and how can I prevent it?
57451
I'm trying to a large number of figures. The code is  \begin{figure} \includegraphics[scale=0.5]{m2T4.pdf} \caption{M2T, Problem Size 513} \end{figure}   I'm not able to compile, I get the error  ! LaTeX Error: Too many unprocessed floats. See the LaTeX manual or LaTeX Companion for explanation. Type H &lt;return&gt; for immediate help. ... l.113 \includegraphics [scale=0.5]{m2T4.pdf} You've lost some text. Try typing &lt;return&gt; to proceed. If that doesn't work, type X &lt;return&gt; to quit. ! Undefined control sequence. \@float@Hx ...ltovf \fi \global \setbox \@currbox \color@vbox \normalcolor \... l.113 \includegraphics [scale=0.5]{m2T4.pdf} The control sequence at the end of the top line of your error message was never \def'ed. If you have misspelled it (e.g., `\hobx'), type `I' and the correct spelling (e.g., `I\hbox'). Otherwise just continue, and I'll forget about whatever was undefined. ! Missing number, treated as zero. &lt;to be read again&gt; \vbox l.113 \includegraphics [scale=0.5]{m2T4.pdf} A number should have been here; I inserted `0'. (If you can't figure out why I needed to see a number, look up `weird error' in the index to The TeXbook.) pdfTeX warning: pdflatex (file ./m2T4.pdf): PDF inclusion: found PDF version &lt;1 .5&gt;, but at most version &lt;1.4&gt; allowed &lt;m2T4.pdf, id=1121, 538.28104pt x 212.1526pt&gt; File: m2T4.pdf Graphic file (type pdf) &lt;use m2T4.pdf&gt;
72002
I need a layout similar to the following image. However I want only the 3 images on the right side to be subfigures (2a, 2b, 3c), But the big red image on the left should be numbered as Figure 1.    Currently I am using minipage and the 3 blue images are not caaptioned as subfigures.  \begin{figure} %   \centering     \begin{minipage}{0.8\textwidth}         \includegraphics[width=\textwidth]{merge-scenario}         \caption{Merge Scenario}         \label{fig:merge-scenario}     \end{minipage}%     \begin{minipage}{0.15\textwidth}         \includegraphics[width=\textwidth]{case_a}         \caption{State A}          \label{fig:case-a}         \includegraphics[width=\linewidth]{case_b}         \caption{State B}          \label{fig:case-b}         \includegraphics[width=\linewidth]{case_c}         \caption{State C}          \label{fig:case-c}     \end{minipage} \end{figure}
25722
I want to add an image to my paper but I have a problem.  When I add the image with just \includegraphics[]{} tag, everything works fine, and the picture shows up when I compile my document.  When I use \begin{figure} \includegraphics[]{} \end{figure} - syntax the image does not appear in the compiled document.   The relevant part of my header include is :   \usepackage{graphicx}  \graphicspath{ {pics/} }   And later on I add the image with this block:  %This does not work  \begin{figure}   \centering     \includegraphics[width=.4\textwidth]{generalPolya}   \label{generalPolya} \end{figure}    %This works  \includegraphics[width=.4\textwidth]{generalPolya}   I guess it's some sort of issue in the graphics package, but I've copied the setup from a previous paper I had, so it should work. Any ideas on what's wrong? Thanks in advance.  Edit:  Thanks for all the responses. I created a minimal working example. Apparently multicols messes with the figure tag:  \documentclass[]{article} \usepackage{multicol} % Used for the two-column layout of the document \usepackage{amsmath} \usepackage{graphicx} \graphicspath{ {pics/} } \title{\vspace{-15mm}\fontsize{24pt}{10pt}\selectfont\textbf{Lorem ipsum}} % Article title \begin{document} \maketitle % Insert title \begin{multicols}{2} % %This does not show up \begin{figure}[h]     \includegraphics[width=.4\textwidth]{generalPolya} \end{figure} %This shows up. \begin{center}         \includegraphics[width=.5\textwidth]{chair} \end{center} \end{multicols} \end{document}   What shows up after compiling the document is this    What is wrong with this syntax?
75865
I found an asnwered question concerning this topic already here:  Copying \captionsetup[subfigure]{justification=centering} doesn't help me thought for I am using different packages.  I would like my Captions and Subcaptions to be justified as the text below. Just under my pictures. Any suggestions?  Thanks a lot  \documentclass{article} \usepackage{subfig} \usepackage[labelfont=bf, justification=justified]{caption} \usepackage[demo]{graphicx}% Remove demo option in real document  \begin{document}     \begin{figure} %   \captionsetup[subfigure]{justification=centering}     \centering       \subfloat[Subcaption one \newline including a linebreak ]   {     \includegraphics[width=0.2\textwidth]{image1}     }     \hspace{1cm}     \subfloat[Subcaption two \newline including a linebreak]     {     \includegraphics[width=0.2\textwidth]{image2}     }        \caption{Figure caption \newline with additional text right here} \end{figure}  \begin{center} This is correctly justified Text \\ including a longer linebreak than blabla. \end{center} \end{document}
56636
How can I reduce the gap between the subfloat and its caption? I tried to use   \captionsetup[subfigure]{aboveskip=0pt}    but it doesnt work for me. Below is the snippet i have and the output  \begin{figure} \captionsetup[subfigure]{labelformat=empty} \captionsetup[subfigure]{aboveskip=0pt}     \centering     \subfloat[Ground Truth]{{\includegraphics[width=\textwidth]{ood-ms/ood-1-gt.png} }}     \\ \vspace{-1\baselineskip}     \subfloat[Recurrent Neural Network]{{\includegraphics[width=\textwidth]{ood-ms/ood-1-rnn.png} }}     \\ \vspace{-1\baselineskip}     \subfloat[]{{\includegraphics[width=\textwidth]{ood-ms/ood-1-vrnn.png} }}     \\ \vspace{-0.5\baselineskip} \noindent\rule{14cm}{0.4pt}     \subfloat[]{{\includegraphics[width=\textwidth]{ood-ms/ood-3-gt.png} }}     \\ \vspace{-1\baselineskip}     \subfloat[]{{\includegraphics[width=\textwidth]{ood-ms/ood-3-rnn.png} }}     \\ \vspace{-1\baselineskip}     \subfloat[]{{\includegraphics[width=\textwidth]{ood-ms/ood-3-vrnn.png} }}     \\ \vspace{-0.5\baselineskip} \noindent\rule{14cm}{0.4pt}         \subfloat[]{{\includegraphics[width=\textwidth]{ood-ms/ood-1-gt.png} }}     \\ \vspace{-1\baselineskip}     \subfloat[]{{\includegraphics[width=\textwidth]{ood-ms/ood-1-rnn.png} }}     \\ \vspace{-1\baselineskip}     \subfloat[]{{\includegraphics[width=\textwidth]{ood-ms/ood-1-vrnn.png} }}     \\ \vspace{-0.5\baselineskip} \noindent\rule{14cm}{0.4pt}     \subfloat[]{{\includegraphics[width=\textwidth]{ood-ms/ood-3-gt.png} }}     \\ \vspace{-1\baselineskip}     \subfloat[]{{\includegraphics[width=\textwidth]{ood-ms/ood-3-rnn.png} }}     \\ \vspace{-1\baselineskip}     \subfloat[]{{\includegraphics[width=\textwidth]{ood-ms/ood-3-vrnn.png} }}     \\ \vspace{-1\baselineskip}     \caption{}     \label{fig:ms} \end{figure}   Here is the output
61041
I'm trying to understand why I cannot effectively reference figures or equations that I have defined with labels.  For example:  \begin{figure}   \label{fig:area_Treasuries}   \caption{Treasuries as a portion of total financial flows.}   \centering   \includegraphics[width=0.75\textwidth]{graphs/Area_Treasuries.png} \end{figure}  \paragraph{} Figure~\ref{fig:area_Treasuries} presents Treasuries (both flowing into and out of the United States) as a share of total financial flows.  From 1985 to 2010, Treasuries account for, on average, 53.2\% of total financial flows.   With the above code, I get this warning:      LaTeX Warning: Reference `fig:area_Treasuries' on page 37 undefined on   input line 477.   The result is "Figure ?? presents Treasuries..."  Why is this happening?  Related, I don't understand why I can't reference, say, an equation before (I mean physically above in the text) the actual equation.  Isn't this what compiling multiple times and cross references is supposed to take care of?