Sign up ×
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.

Possible Duplicate:
Adding C++ code in Latex

I am trying to upload the code into my latex document.Please let me know how can I do that.My code is as below.


%My C code goes here
share|improve this question

marked as duplicate by lockstep, Marco Daniel, percusse, doncherry, Lev Bishop Sep 21 '12 at 6:48

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

You can add it with the package listings for example. You know this package? If not, please try texdoc listings in your command line. – Kurt Sep 16 '12 at 20:16
I am supposed to use only appendix.Is it possible only with \appendix tag? – Vutukuri Sep 16 '12 at 20:17
@Vutukuri It is not clear what you want. In the appendix you use the usual sectional unit commands for creating entries in the appendix: \chapter, \section, ... (but they get numbered differently). To include a listing, you must provide the LaTeX commands. @Kurt recommened the listings package to do this. (I'd recommend the lstlistings package.) – Marc van Dongen Sep 16 '12 at 20:20

1 Answer 1

up vote 2 down vote accepted

You can try using listings package for proper source code formating, or you can just use \verbatim environment.

share|improve this answer
should be "verbatim", not "verbatium" – walkmanyi Sep 16 '12 at 20:50
@walkmanyi If you have enough reputation, you can edit the answer and improve it. – Marc van Dongen Sep 16 '12 at 20:59
@Marc van Dongen: I tried, but the system refused to accept a trivial edit changing just a single character. – walkmanyi Sep 16 '12 at 21:45
@walkmanyi It worked for me (the minimal edit). – Marc van Dongen Sep 17 '12 at 3:57
@walkmanyi, thank you for correcting my mistake – GKalnytskyi Sep 22 '12 at 15:52

Not the answer you're looking for? Browse other questions tagged or ask your own question.