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.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to typeset some computing class algorithms like:

 Accept Roll_Number
If (the Roll Number has already been added to the absent list) then 
 Prompt”You have already added the roll number to the absent list”
         Continue with the adding process
End if
         Connect to the Student’s table of Malpi’s database
Search for the match of Roll_Number
If (the match is found) Then
         Display Student’s firstname,middlename,lastname,guardianname,contactnumber
         Don’t Display Anything
End If
Until (all the absent students have been added to the absent list)
Open the absent file where the records are to be added
         If (the student has already been added to the file for that day) Then
                  Prompt” The student has already been added to the file”
         End if
Until (All the Roll_Number in the list have been checked)
Get the record number of the last record in the absent file
Open the absent file where the records are to be added
        Add 1 to the record number
        Save the student’s absent details to the file
Until (the records of all the students are saved in the absent file)

What is the best way to represent this in XeTeX ? I tried using \verbatim package but it seems to break margins ? Is there any good to present this ?

share|improve this question
I realise these are dumb questions, however their answers are bound to help us understand your problem. A) what's holding you back from rearranging your text into shorter lines? B) what's the problem with typesetting your text in a smaller font size? C) Why can't you typeset your text in tt and issue successions of \quad's or \qquad's for indentation without dropping into \verb et al? – Geoffrey Jones Sep 6 '10 at 23:49
Thanks. I will try to rearrange them into shorter lines. – Ujjwol Sep 7 '10 at 5:45
up vote 1 down vote accepted

Why not use “normal” text instead of \verbatim? A list (enumerate) would be well suited, I think. I don’t think \verbatim really offers any advantage here and I wouldn’t necessarily choose a typesetting font here, either: it’s an algorithm, not source code.

Alternatively, you could try one of the pseudo-code typesetting packages.

Personally, I prefer flowchart diagrams to display algorithms but I don’t know a good way of typesetting them in LaTeX (besides using TikZ or PSTtricks, of course).

share|improve this answer
I am also adding flowcharts with this. After checking out TikZ and PSTtricks. I am simply draw and use high-res images. There is no ant LaTeXy way for flowchart. – Ujjwol Sep 7 '10 at 10:07

Your Answer


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.