3

Is there way to make TeXstudio ignore the contents of a \directlua command when performing syntax highlighting? Currently, it ends up causing highlighting like:

bad highlighting example

Which is distracting when scanning the file, but worse still, depending on what the contents are, it can lead the highlighting for later sections being changed as well (as in the image). There currently appears to be an (old) issue open for allowing Lua syntax highlighting. Of course, having the appropriate highlighting would be best, but without that, is there a way I can have TeXstudio just ignore the entire contents of the \directlua's braces (noting that there may be braces within its braces)? Thank you for your time.

  • Are you using magic comments? – user36296 Aug 8 '17 at 13:10
  • @samcarter, not that I know of. But I don't know much about them, so I'm not sure if the style or a package I'm using might be including them. – golmschenk Aug 8 '17 at 13:17
  • Never mind, the idea I had in mind does not work as expected :( – user36296 Aug 8 '17 at 13:24
  • This is an open issue and not easily to solve. Related: sourceforge.net/p/texstudio/bugs/2162 – Tim Hoffmann Aug 13 '17 at 14:52
  • 1
    IMO it's best to get into the habit of putting all the Lua code in a separate file (say foo.lua), and in the TeX file have just \directlua{dofile('foo.lua')}. – ShreevatsaR Aug 13 '17 at 19:24

Your Answer

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

Browse other questions tagged or ask your own question.