Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

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,863 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,863 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,863 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