Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I use following code for nonfloat figures..

\begin{minipage}[c]{\textwidth}
\centering
    \includegraphics[width=3.0in]{myimage.eps}
    \captionof{figure}{Caption for image}
    \label{fig:sample_figure}
\end{minipage}

I want caption as

Caption for image

and for float figures

   \begin{figure}
    \includegraphics[width=3.0in]{myimage.eps}
    \caption{Caption for image}
    \label{fig:sample_figure2}
   \end{figure}

Here i want caption as

Figure 1.1 Caption for image

How to achieve this?

share|improve this question
    
Instead of using captionof{figure} you can define a new float-environment with your request style definition and then using captionof with this new environment name. So the counter is independently. BTW: A small MWE is useful. –  Marco Daniel Mar 2 '13 at 10:49
    
Do you not want to count the non-floats? (It seems so from your example.) If so, can't you just not use \captionof at all, but write the caption directly? –  Torbjørn T. Mar 2 '13 at 10:51
    
yes I do not want to count non-floats –  sandu Mar 2 '13 at 10:52
    
@sandu: Do you want an entry in the list of figures? –  Marco Daniel Mar 2 '13 at 10:56

1 Answer 1

To get an unnumbered caption you can use the starred version of the command \captionof. Please note that the starred version doesn't provide an entry in the list of ...

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{caption}
\usepackage{mwe}

\begin{document}
\listoffigures
\section{foo}
\blindtext

\begin{minipage}[c]{\textwidth}
\centering
    \includegraphics[width=3.0in]{example-image-a}
    \captionof*{figure}{Caption for image}
    \label{fig:sample_figure}
\end{minipage}

\blindtext

\begin{figure}
    \includegraphics[width=3.0in]{example-image-b}
    \caption{Caption for image}
    \label{fig:sample_figure2}
\end{figure}

\blindtext

\end{document}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.