I am writing a Thesis and there are sections that require me to add fragments of code or a complete code. Should this be classified as a figure, table,listing or snippet ?


Insert it as a listing. The convention is to print code verbatim in monospace font. If you're writing in LaTeX, the listings package exists for this purpose.

  • 1
    While this is helpful for LaTeX users, it doesn't tell @beginningperl how to label it. – Bill Barth May 26 '14 at 15:56
  • 5
    @BillBarth Yes it does. It is a listing - that is what it is called. You can have listings labelled 1.1, 1.2, 2.1 etc just like figures, and a List of Listings (or perhaps Code Listings) in the TOC. – Moriarty May 26 '14 at 15:58
  • 1
    Withdrawn. You're right. I hadn't used that feature before. Not sure how I missed it. +1 – Bill Barth May 26 '14 at 16:03
  • 1
    One quick addition, you'll probably want to use \lstlistoflistings to produce an appropriate Table of Listings at the front of your document. The optional arguments label=someAwesomeLabel and caption={This is my caption} are also very helpful. – Bill Barth May 26 '14 at 16:47
  • 1
    @beginningperl Might I add that if you are writing a thesis about software, there is no reason to stick to Word. The learning curve of LaTeX is shallower than that of HTML, and the advantages outweigh the cost of learning it. – Jonathan Landrum May 26 '14 at 18:00

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.