[Tex/LaTex] What does “You have requested package `foo’, but the package provides `foo’.” mean

moderncvpackageswarnings

I know what this message means in general ("do not add path names in package names"), and my question is not a duplicate of You have requested package `include/foo' but the package provides `foo', where the two names differ (by the path name). In my case the package names are really identical (without path name in both cases)!

I'm working on MiKTeX 2.9, with latest updates (I refreshed FNDB). I get this with the latest moderncv package (version 2.0), MWE:

\documentclass{moderncv}
\moderncvtheme{classic}
\name{Foo}{Bar}
\begin{document}
\end{document}

where I get

You have requested package `moderncvheadi', but the package provides `moderncvheadi'.
You have requested package `moderncvbodyi', but the package provides `moderncvbodyi'.

What does trigger this warning in this case and how can I solve it? Is it a bug in moderncv? The official source on https://github.com/xdanaux/moderncv looks fine to me.

Best Answer

its a bug in the class, looks like a recent change in the github log, can't test here, no tex, but the package name constructed by

\expandafter moderncv\romannumeral

which doesn't do the right thing \expandafter does nothing there, you can ignore the warning until it's fixed.

Lines 315 to 333 of moderncv.cls should be changed into

% loads a header variant
% usage: \moderncvhead[<optional head option>]{<header variant number>}
\newcommand*{\moderncvhead}[2][]{%
  \begingroup\edef\x{\endgroup
    \noexpand\RequirePackage[#1]{moderncvhead\ifcase#2\or i\or ii\or iii\or iv\or v\fi}%
  }\x 
}

% loads a body variant
% usage: \moderncvbody[<optional body option>]{<body variant number>}
\newcommand*{\moderncvbody}[2][]{%
  \begingroup\edef\x{\endgroup
    \noexpand\RequirePackage[#1]{moderncvbody\ifcase#2\or i\or ii\or iii\or iv\or v\fi}%
  }\x 
}

% loads a footer variant
% usage: \moderncvfoot{<footer variant number>}
\newcommand*{\moderncvfoot}[1]{%
  \begingroup\edef\x{\endgroup
    \noexpand\RequirePackage{moderncvfoot\ifcase#1\or i\or ii\or iii\or iv\or v\fi}%
  }\x
}

but it's not possible to add this code in a document, because the macros are already used by the class itself.