Insert programming code in a Lyx document

后端 未结 3 1621
暖寄归人
暖寄归人 2021-01-30 00:04

What is the best way of inserting python/C++ code in a Lyx document? The code is small examples less than 20 lines.

My Lyx document is using the Book document class.

3条回答
  •  自闭症患者
    2021-01-30 00:37

    The insert->Program Listing feature works great. I just want to add that if you are on Mac, and try to directly paste, using command+V or right-click+paste, a block of code into the program listing, the whitespace will not be preserved, and you have to manually insert the whitespace by typing tabs, returns, etc.

    A very easy way to get around this is is to paste using shift+command+V. This preserves all the whitespace of your original source code.

提交回复
热议问题