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 all,
Vanilla are planning an update to the site on April 24th (next Wednesday). It is a major PHP8 update which is expected to boost performance across the site. The site will be down from 7pm and it is expected to take about an hour to complete. We appreciate your patience during the update.
Thanks all.

Inserting C++ code (as reference) into LyX

Options
  • 20-10-2011 1: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,791 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,791 Mod ✭✭✭✭oscarBravo


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


  • Registered Users 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,791 Mod ✭✭✭✭oscarBravo


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


  • Registered Users 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