以下是我的序言:
\documentclass[letterpaper, 10 pt, conference]{ieeeconf}
\overrideIEEEmargins
\usepackage{graphics}
\usepackage{graphicx}
\usepackage[spanish]{babel} % spanish
\selectlanguage{spanish}
\usepackage[utf8]{inputenc}
\usepackage{float}
这是代码中有问题的部分...
\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}
从字面上看,当我在标题中添加更多字符时,我出现了编译错误,因为下一部分代码运行完美:
\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}
我试了好几次,现在我确信添加更长的标题会导致错误。错误如下:
Argument of \language@active@arg~ has an extra }.
<inserted text>
\par
l.198 ...ra cada nivel nvie deni adniue jdaisn ds}
他们要求我提供一个完整的示例,因此示例如下:
\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}
答案1
一些一般性说明:如果您加载了graphicx
,则不必加载。如果您使用 选项加载了graphics
,则也不需要。此外已弃用,请改用。\selectlanguage{spanish}
babel
spanish
\bf
\bfseries
针对您的实际问题:您使用的版本与西班牙语ieeeconf
定义的简写不兼容。您可以通过修补来修复此问题:babel
\@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}