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'm using moderncv and I want to add a caption to an inserted graphic. I'm currently using this code

\begin{minipage}{.5\textwidth}
  \centering
  \includegraphics[width=0.5\textwidth]{fixed_button_settings.png}
  \captionof{figure}{Some figure}           
\end{minipage}

and this is the result

fixed_button_settings.png

For further notice, this line of code

\captionof{figure}{Some figure} 

results in an error: Package caption Error: No float type 'figure' defined.

I have added this in the main.tex preamble

\usepackage{float}
\usepackage{caption}

What should I do to make the caption appear as: "Figur 1: Some figure"? ("Figur" is not a typo, it's Swedish.)

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

Your problem is that class moderncv has no floating environment figure implemented. So you have two possibilities:

  1. copy all the code needed for figure into an own local new class mymoderncv.cls or
  2. do not use figure and make it by your own. You can use minipage, and write the heading by your own, because in a cv you need no list of figures, I guess?

A solution for point 2 could be (I used the image from package mwe, that must be installed, but must not be loaded):

\documentclass[%
  11pt
 ,a4paper
 ,sans
]{moderncv}

\moderncvstyle{classic}
\moderncvcolor{blue}

\usepackage[scale=0.75]{geometry}
%\usepackage[english,ngerman]{babel}

% Personal Data
\firstname{John}
\familyname{Doe}
\title{Resume title}
\address{street and number}{postcode city}{country}\mobile{+1~(234)~567~890}
\phone{+2~(345)~678~901}
\fax{+3~(456)~789~012}
\email{john@johndoe.com}
\homepage{www.johndoe.com}
\extrainfo{additional information}
\quote{Some quote from a well known person}

\begin{document}

\makecvtitle

\section{Education}
\cventry{year--year}{Degree}{Institution}{City}{\textit{Grade}}{Description}
\cventry{year--year}{Degree}{Institution}{City}{\textit{Grade}}{Description}

\section{Master thesis}
\cvitem{title}{\emph{Title}}
\cvitem{supervisors}{Supervisors}
\cvitem{description}{Short thesis abstract}

\begin{minipage}{\textwidth}
  \centering
  \includegraphics[width=0.5\textwidth]{example-image-a} \\
  Figure 1: heading of figure.
\end{minipage}

\end{document}

with the result:

enter image description here

share|improve this answer
    
I used your minipage example and went for manual captioning. Thanks a lot! –  emmgust91 Oct 6 '13 at 11:13
    
@emmgust91 Glad that I was able to help you. –  Kurt Oct 6 '13 at 11:15
add comment

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.