0

Here is my Preamble:

\documentclass[letterpaper, 10 pt, conference]{ieeeconf}  
\overrideIEEEmargins
\usepackage{graphics}
\usepackage{graphicx}
\usepackage[spanish]{babel}         % spanish
\selectlanguage{spanish}
\usepackage[utf8]{inputenc}
\usepackage{float}

and here the problematic part of the code...

\begin{figure}[H]
\begin{center}
    \includegraphics[width=\columnwidth]{4LevelInverter}
    \caption{Inversor multinivel de 4 niveles medio puente para cada nivel de nivel nivel nivel}
    \label{fig:4-level-example}
\end{center}
\end{figure}

Literally, when I add more characters to the caption I have the compile error because this next part of code works perfectly:

\begin{figure}[H]
\begin{center}
    \includegraphics[width=\columnwidth]{4LevelInverter}
    \caption{Inversor multinivel de 4 niveles medio puente para cada nivel}
    \label{fig:4-level-example}
\end{center}
\end{figure}

I tried this several times, I am pretty sure by now that adding a longer caption results in the error. The error is the following:

Argument of \language@active@arg~ has an extra }.
<inserted text> 
                \par 
l.198 ...ra cada nivel nvie deni adniue jdaisn ds}

They asked me for a complete example so here it goes:

\documentclass[letterpaper, 10 pt, conference]{ieeeconf}  
\overrideIEEEmargins
\usepackage{graphics}
\usepackage{graphicx}
\usepackage[spanish]{babel}
\selectlanguage{spanish}
\usepackage[utf8]{inputenc}
\usepackage{float}

\title{\LARGE \bf
Title
}

\author{
    authors
}


\begin{document}
\maketitle
\thispagestyle{empty}
\pagestyle{empty}


\begin{figure}[H]
\begin{center}
    \includegraphics[width=\columnwidth]{figure_name}
    \caption{Inversor multinivel de 4 niveles medio puente para cada nivel}
    % This example works good until I make the caption longer in characters. 
\end{center}
\end{figure}

\end{document}
  • Don't show only snippets, make a complete example (and replace the graphic by e.g. a rule or a word). – Ulrike Fischer May 26 '18 at 15:02
  • Ok, done, I attached a complete example at the end. – Agustin Barrachina May 26 '18 at 15:21
2

Some general remarks: If you load graphicx, you do not have to load graphics. You also do not need \selectlanguage{spanish} if you loaded babel with the spanish option. Additionally \bf is deprecated, use \bfseries instead.

To your actual question: The version of ieeeconf you use is not compatible with the shorthands defined by babel for the spanish language. You can fix this by patching \@makecaption:

\documentclass{ieeeconf}
\usepackage[spanish]{babel}

\makeatletter
% Almost exactly copied from ieeeconf.cls
\long\def\@makecaption#1#2{%
  \ifx\@captype\@IEEEtablestring
    \begin{center}{\footnotesize #1}\\{\footnotesize\scshape #2}\end{center}%
    \@IEEEtablecaptionsepspace
  \else
    \@IEEEfigurecaptionsepspace
    \setbox\@tempboxa\hbox{\footnotesize #1.~~ #2}%
    \ifdim \wd\@tempboxa >\hsize
    \setbox\@tempboxa\hbox{\footnotesize #1.~~\relax}% <-- The \relax has been added here to make bebel happy
    \parbox[t]{\hsize}{\footnotesize \noindent\unhbox\@tempboxa#2}%
  \else
    \ifcenterfigcaptions \hbox to\hsize{\footnotesize\hfil\box\@tempboxa\hfil}%
    \else \hbox to\hsize{\footnotesize\box\@tempboxa\hfil}%
  \fi\fi\fi
}
\makeatother

\begin{document}

\begin{figure}
  \rule{2cm}{2cm}
  \caption{hhhhhhhhhhhhhhhhh hhh Inversor multinivel de 4 niveles medio puente para cada nivel}
\end{figure}

\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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