I have a class resume which I use in a .tex file as



but I also want to define some variables in my .tex document to be used in my class.

How can I, for instance, use the variables/properties that I set in


\name{John Doe}
\address{Street 10}
\phone{No phone}


in my class?

  • Did you write resume.cls? Or is this some other class that already provides \name, \address and \phone? – Werner Dec 10 '15 at 7:14
  • I write resume.cls myself, so I guess I have to define some placeholders in my class and overwrite them with \name{...} in my .tex file. – Jamgreen Dec 10 '15 at 7:22
  • 1
    Oh please, not another resume class. There are already a bunch of them out there. – Johannes_B Dec 19 '15 at 14:12
  • I am confused. Normally you create commands in the .cls that you can access/use in your .tex file. But you seem to be asking to create commands in your .tex file that will be accessed/used in the .cls, which does not make sense (or, probably, I can't see the sense of what this is supposed to accomplish). – jon May 20 '16 at 2:15
  • How can we help if this uses a custom class we don't have access to? Confused. – cfr May 20 '16 at 2:44

Well, only defining commands \name etc. is only the first step. You need to define where should it be printed, for example inside \maketitle, how to layout the cv, font, fontsize etc.

That is at all not so easy as it seems you think.

With \newcommand{\name}{Firstname lastname} you can define a command \name printing "Firstname Lastname" where it is used. With \renewcommand{\name}{John Doe} you can change the placeholder to an (perhaps) real name.

If you are realy interested in learning writing own classes please read and study first clsguide.pdf. You can read it with typing texdoc clsguide into your console/terminal. Then there are some questions here about classes, for example Pass parameter to class or creating a class or package etc.

Be prepared it would take a little bit time (or more) to learn what you have to do. Look into other classes what they do.

Or look for example on CTAN for existing classes to create an CV, for example moderncv.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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