# How to fix figure caption while using lmodern

To remove the warnings,

Font shape OT1/cmss/m/n' in size <4> not available(Font) size <5> substituted Size substitutions with differences(Font) up to 1.0pt have occurred.

I used the package lmodern, as stated here. However, it does create some problems in figure and sub-figure captions.

MWE:

\documentclass{article}

\usepackage{lmodern, subfigure}

\begin{document}
\begin{figure}

\subfigure[$A$-−$B$-−$C$-−$D$-−$A$-−$C$]{
}
\caption{$A$-−$B$-−$C$-−$D$-−$A$-−$C$}
\end{figure}
\end{document}


Screenshot:

How to fix that?

You hae an unicode character at -−. The second one is an ndash. This works:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{lmodern, subfigure}
\usepackage[utf8]{inputenc}

\begin{document}
\begin{figure}
\subfigure[$A$---$B$---$C$---$D$---$A$---$C$]{foo}
\caption{$A$---$B$---$C$---$D$---$A$---$C$}
\end{figure}
\end{document}


Alternetively define a new unicode char:

\documentclass{article}
\usepackage{lmodern, subfigure}
\usepackage[utf8]{inputenc}
\usepackage{newunicodechar}
\newunicodechar{−}{--}% First one is an n-dash not a hyphen!
\begin{document}
\begin{figure}

\subfigure[$A$-−$B$-−$C$-−$D$-−$A$-−$C$]{}
\caption{$A$-−$B$-−$C$-−$D$-−$A$-−$C$}
\end{figure}
\end{document}

• This works for this MWE, but not for my original code. :-( – xxx--- Jun 10 '14 at 5:52
• In your example the second − is not a hyphen, it is a n-dash which is in TeX notation --. Delete all those -− and replace them with ---` – user2478 Jun 10 '14 at 6:21