1

I would like to know how to use a specific font (Arial, for example) in a program listing.

The idea is to insert in my document a part of code in a 'program listing'. I found a way to insert some parameters like the frame and the language code but I was not able to change the font.

1
  • A minimum working example will help. For example, is XeTeX an option, or only plain latex? The answer depends on the options. – Nigel Jan 17 '15 at 8:35
4

As long as using XeTeX or LuaTeX instead of pdfLaTeX is an option, you can use basically whichever font you have installed in your system.

  1. Document --> Settings --> Fonts. Check the box for Use non-TeX fonts (via XeTeX/LuaTeX) at the top:

    enter image description here

  2. Move down to the LaTeX preamble panel, add

    \newfontfamily\mylistingsfont{<name of font>}
    

    enter image description here

  3. If you want the setting to be global, for all listings, move up to the Listings-panel (still in the Document settings), add

    basicstyle=\mylistingsfont
    

    to the options.

    enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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