# Different stuff

### Latex with SciTE

I am using the editor SciTE to edit latex documents. This page is devoted to settings, scripts, lexer for SciTE which help working with latex.

To begin with I just put here a bunch of files from my scite directory. Just unzip these files to the directory where your SciTE installation resides and it should work. Note that it overwrites the following files:

SciLexer.dll – this contains the new latex lexer which is more ‘clever’ than the previous one and supports folding.

tex.properties – this contains settings needed for the new lexer to work. Also it installs ‘compile’, ‘build’, ‘run’ commands for latex and several useful scripts which are accessible from the menu ‘Tools’ or via hotkeys.

SciTEStartup.lua – this contains the macro extension SciteExtMan which is required to make my scripts working.

SciTEGlobal.properties – this one is just a bunch of settings for Scite. If you prefer to keep your own settings just copy the last 20 lines from it to your own SciTEGlobal.properties. This is needed for the scripts to work

scripts/myscript.lua - this contains the actual scripts.

If you only need the lexer, only SciLexer.dll and tex.properties are necessary.

Source file for the lexer LexTeX.cxx

Here is a screenshot about how this should look like:

1. Hi!
Great Work. It works fine for the latest Version 1.74. I have never written a Lexer for Scite, so have you compiled Scite? I asked because I wrote a Plugin for Scite for Ruby and I can only compile the Version 1.72 under Windows and with Mingw. It seems that the Lexer does not work problery under this Version.
When you compiled the latest Version can you tell me how? Iam not really good in fixing Makefiles.
best regards Hartwig.

Comment by Hartwig — November 2, 2007 @ 1:10 pm

2. Hi, as I remember I just downloaded the sources of Scite, latest version (1.74). It included some project files for visual studio, so I compiled it with Visual Studio Express 2005 (it is a free version, you can download it from http://msdn2.microsoft.com/en-us/express/aa975050.aspx). I don’t remember any problems (it was 2 month ago when i set it all up), but if you have any – post them here, I will try to help. For changing the lexer I needed to modify only one file – LexTex.cxx.

Of course it would be nicer to make this lexer as a plugin in a separate dll, but I didn’t try to find out how to do it. I’ve heard it is possible.

Comment by Anton — November 2, 2007 @ 1:24 pm

3. Found a bug with this lexer – using \verb|$| the$ still starts up Math Mode

Comment by Steve — November 7, 2007 @ 4:16 pm

4. Oops, thank you for this remark. Actually I never used \verb and verbatim environment, so I did not expect this. Now I am wondering if there are other ‘special’ commands and environments that change meaning of $and/or other special symbols. Any suggestions how to deal with them? To make another style and hard code this ‘\verb’ ? It actually has quite complicated semantics since you can use any delimiter. Comment by Anton — November 7, 2007 @ 8:12 pm 5. I’m not a Scite god, but couldn’t you sort of hack it by using “\verb[regex or something]” and “[end regex]” as the start and end of a “comment” or make it behave like “…” does in regular languages (C or something). Comment by Steve — November 8, 2007 @ 9:45 pm 6. Ok, I was not so lazy today and I did this \verb. At least it seems to work on my computer. I didn’t do \begin{verbatim}..\end{verbatim}. Maybe I’ll just wait for another complaint. I’ve replaced the old version with the new one on the server. Actually the only modified files are SciLexer.dll and tex.properties. The latter contains now new style ‘verbatim’ which I set to be the same as the comments style: # Verbatim style.tex.11=$(style.tex.7)
style.tex.27=$(style.tex.11) And a new keyword: # verbatim command keywords7.$(file.patterns.latex)=verb

Comment by Anton — November 10, 2007 @ 12:49 am

7. Yeah, that’s nice thanks

Comment by Steve — November 11, 2007 @ 9:08 pm

8. Hello,
I would like to know how you add your Lexer to the DLL (I begin to use C++) ? Wath is the way to change the DLL ? Can I use a free software to do that ?

My purpose is to add my own Lexer so as to use it with PyQt.

Thanks.

Comment by rambc — August 30, 2008 @ 11:34 am

Theme: Rubric. Blog at WordPress.com.