Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Inserting C++ code (as reference) into LyX

  • 20-10-2011 12:20pm
    #1
    Closed Accounts Posts: 5,132 ✭✭✭


    Hey there,

    I'm writing a report using LyX and I'd like to insert a couple of lines of C++ code (from Dev-C++) into an Appendix, just for reference.

    I've tried exporting the C++ to HTML and then converting the HTML to a jpeg file and then insert it into the LyX document but it's very small and looks quite messy.

    Does anyone know of another way to do this?


Comments

  • Technology & Internet Moderators Posts: 28,831 Mod ✭✭✭✭oscarBravo


    Can't you just format it with TT font for fixed space? Or is there another type of formatting you want to preserve?

    eta: the listings package looks like what you want in LaTeX; you should be able to use it with ERT in LyX.


  • Technology & Internet Moderators Posts: 28,831 Mod ✭✭✭✭oscarBravo


    Actually, I just checked and LyX incorporates the listings package. Under the Insert menu, you'll find "Program Listing".


  • Registered Users, Registered Users 2 Posts: 26,578 ✭✭✭✭Turtwig


    Perhaps, I'm missing something here but surely verbatim is the environment to use?(Tag it if needs be.)


  • Technology & Internet Moderators Posts: 28,831 Mod ✭✭✭✭oscarBravo


    The "listings" package is aware of language syntax and marks up source code quite nicely.


  • Registered Users, Registered Users 2 Posts: 26,578 ✭✭✭✭Turtwig


    oscarBravo wrote: »
    The "listings" package is aware of language syntax and marks up source code quite nicely.

    I'll have me my humble pie now. . .:o
    (Didn't cop the listings bit.)


  • Advertisement
  • Closed Accounts Posts: 5,132 ✭✭✭Killer Pigeon


    Alright, thanks guy!


Advertisement