I am using exam document class as my guide in creating my own documentclass but i have encountered a problem.How will i create a command for each of the four texts in a line. here is a sample image:

enter image description here .

the command names that will be created would include commands for each: time, ExamCategory, MaximumMarks, and PassingScore. these when used, will be displayed in one line or horizontally aligned as what was indicated in the image.


Text will align itself to the current baseline by default so you don't need to do anything.


\time{1 hour}
\ExamCategory{Humanities prelim}

\noindent\makebox[\textwidth]{Time: \xtime%
\xExamCategory\ Exam%
Maximum Marks: \xMaximumMarks%
Passing Score: \xPassingScore}
  • Wouldn't \makebox[\textwidth][s]{...} (with \hfil instead of \quad) be a valid alternative? – egreg Mar 11 '13 at 16:42
  • @egreg well perhaps but then the items will touch if they get too big, whereas this way they don't touch (but stick into the margin) – David Carlisle Mar 11 '13 at 16:55
  • @DavidCarlisle: how should I insert this in the class.. I am currently typing on my .tex file this long text argument:: \noindent \uline{Time: 1 hour \hfill\hfill\normalsize\emph{\underline{ Humanities II preliminary Exam }} \hfill \hfill Maximum Marks: 50 \hfill \hfill Passing score: 30} \hfill \hfill \hfill but when the four command will be created, then i will just type: \time{4} \subject{Humanities II Preliminary} \marks{50} \passScore{30} something like this.. but how to create the command for this? – Kayla Mar 12 '13 at 8:03
  • @Kayla well the definition of the four commands is in my answer, then to get the italics and underling just add those commands to the makebox command, which also wants to go in your class at the point you want it to appear. – David Carlisle Mar 12 '13 at 9:15

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.