TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm adding Go code to my document via 'Insert->Program Listing' in Lyx. The language Go is not available in the language dropdown in the settings. Is there an easy way to add Go syntax highlighting/parsing to Lyx?

share|improve this question

migrated from stackoverflow.com Jul 16 '12 at 13:27

This question came from our site for professional and enthusiast programmers.

up vote 5 down vote accepted

You can get the lstlang0.sty file from here. You need to copy it into the listings directory (something like /usr/local/share/texmf/tex/latex/listings) and use it like this:


Of course in lyx you want insert program listing and right click and select settings to set the language however, this does not work as the language list seems to be fixed. So it's better just insert tex code and use the code above.

share|improve this answer
For some reason Lyx doesn't pick up lstlang0.sty, it does look in /usr/local/share/texmf/tex/latex/listings and reads lstlang[1-3].sty. So I added the Go language definition to the end of lstlang3.sty. In Lyx you can than right click on the program listing box, go to settings and under the advanced tab you can add 'language=Go' and check the box Bypass Validation. – Cyberroadie Aug 1 '12 at 8:17

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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