Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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}
share|improve this question

1 Answer 1

up vote 1 down vote accepted

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.)

share|improve this answer
    
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 at 17:17
1  
ok declared a new command \newcommand*{\usefirstname}{\@firstname} –  NewGuest Mar 5 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 at 17:28
    
ok thanks for the tip ;) –  NewGuest Mar 5 at 20:52

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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