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.

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.

share|improve this question

1 Answer 1

up vote 3 down vote accepted

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

 
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.