# moderncv user variable in section

How can I use a variable (e.g. a first name) in \cvitem?

\firstname{Firstname}
\begin{document}
\makecvtitle % Print the CV title
\section{Personal Data}
\cvitem{}{\firstname}

-

If you look at \meaning\firstname, you'll see that it just means

\def\@firstname{#1}


To get the functionality you want, you'll have to say

\firstname{Firstname}
\begin{document}
\makecvtitle % Print the CV title
\section{Personal Data}
\cvitem{}{\makeatletter\@firstname\makeatother}


(Remembering, of course, that you can make a macro to do the dirty work for you if you plan to do this a lot: \makeatletter\newcommand\myfirstname{\@firstname}\makeatother.)

-
yes i saw my mistake, but if i use \cvitem{}{\makeatletter\@firstname\makeatother} There are several problems at this line: -Missing } inserted. ...tem{}{\makeatletter\@firstname\makeatother} (followed by: ) -You can't use `\spacefactor' in internal vertical mode. ...tem{}{\makeatletter\@firstname\makeatother} (followed by: ) -Extra }, or forgotten $. ...tem{}{\makeatletter\@firstname\makeatother} (followed by: ) -Missing$ inserted. ...tem{}{\makeatletter\@firstname\makeatother} (followed by: ) – NewGuest Mar 5 '14 at 17:17
ok declared a new command \newcommand*{\usefirstname}{\@firstname} – NewGuest Mar 5 '14 at 17:24
Did this fix your issue? Don't forget you can 'accept' this answer to mark your issue as resolved :) (see How do you accept an answer?) – Sean Allred Mar 5 '14 at 17:28
ok thanks for the tip ;) – NewGuest Mar 5 '14 at 20:52