# Create commands each of the text aligned horizontally?

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:

.

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.

-

## 1 Answer

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

\def\time#1{\def\xtime{#1}}
\def\ExamCategory#1{\def\xExamCategory{#1}}
\def\MaximumMarks#1{\def\xMaximumMarks{#1}}
\def\PassingScore#1{\def\xPassingScore{#1}}

\time{1 hour}
\ExamCategory{Humanities prelim}
\MaximumMarks{50}
\PassingScore{30}

\noindent\makebox[\textwidth]{Time: \xtime%
\quad
\xExamCategory\ Exam%
\quad
Maximum Marks: \xMaximumMarks%
\quad
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