Scite

From Wiki
Jump to navigation Jump to search

< Text Editors

Nota bene

This page is outdated and describes the old installation and set of files. There is an updated manual: scite-context-readme.pdf. This file as well as all files needed are also part of the ConTeXt distribution.

There's also a newer and more detailed wiki page on how to install ConTeXt and SciTe on a machine that doesn't use other TeX distribution: http://wiki.contextgarden.net/Windows_Installation:_ConTeXt_Suite_with_SciTe.

Also have a look at Textadept, a SciTE descendant that already includes the Lua Lexers and is also available for OSX. A Textadept module for ConTeXt is being developed at ta-context-latex.

Introduction

SciTE is a Scintilla based text editor for Linux and Windows. Originally built to demonstrate Scintilla, it has grown to be a generally useful editor with facilities for building and running programs. The ConTeXt distribution includes files which can be used to configure SciTE for editing and building ConTeXt documents.

See also the manual mcite.pdf for details of ConTeXt support. A non-native MacOS X version of SciTE is available via MacPorts.

Installing SciTE for ConTeXt

Installing on Windows

Note. If you are installing ConTeXt and SciTe simultaneously and do not have any other TeX related systems on your Windows, you may prefer to follow the Windows_Installation:_ConTeXt_Suite_with_SciTe instructions instead.

The following procedure has been found to work, assuming that the current ConTeXt distribution is installed in the folder C:\tools\context.

  • Download the SciTE Windows binaries from SciTEDownload to a suitable location on the target machine, e.g. C:\Tools\scite.
  • Copy the contents of C:\tools\context\texmf-context\context\data\scite to C:\tools\scite\wscite.
  • Create a batch file C:\Tools\scite\cscite.bat for use with SciTE. This runs setuptex.bat before launching SciTE. The contents of this batch file should be:
rem Use to start SciTE for ConTeXt
@echo off
c:
cd \tools\context
call setuptex
cd \tools\scite\wscite
start scite.exe %1%
  • After initial installation, add the following to the SciTEGlobal.properties.
import context
  • Local settings are defined in SciTEUser.properties.

Building a ConTeXt document is as simple as opening it in the editor and pressing [F7].


Configuring SciTe with ConTeXt on Windows

Building ConTeXt documents using MKII

SciTE builds pdf using MKIV (luatex) by default, to change to MKII (pdftex) alter the file context.properties as follows: Replace the line

name.context.texexec=$(name.context.mtxrun) --script context $(name.texexec.flag.pdfopen)

with the line

name.context.texexec=$(name.context.mtxrun) --usekpse texexec $(name.texexec.flag.pdfopen)

Using [Cntrl-2] (Change PDF viewer)

The default behaviour for [Cntrl-2] is to open a PDF using GhostView, to get it to use Acrobat Reader, proceed as follows:

  • Edit the file context.properties to include the line:
name.context.acrobat=acrord32.exe

then edit the lines beginning "command.2" as follows:

command.2.$(file.patterns.context)=$(name.context.acrobat) $(FileDir)\$(FileName).pdf
command.2.$(file.patterns.metafun)=
command.2.$(file.patterns.example)=$(name.context.acrobat) $(FileDir)\$(FileName).pdf
  • Make sure that the PATH environment variable includes the directory of the Acrobat executable (e.g. C:\Program Files\Adobe\Reader 8.0\Reader).

Spell checking

The spell checker can be configured as follows.

  • First, construct a word list, which is just a file containing all the valid words in your language! For English, a suitable word list can be constructed from files at wordlist.sourceforge.net, e.g. concatenating all the files starting with english* and british* up to level 70 from the Scowl-6 group is one option.
  • Copy this new file to a suitable location, e.g. C:\tools\spell\spell-uk.txt
  • The automatic language detection does not seem to work, so edit scite-ctx.properties, replace the line:
ctx.spellcheck.language=auto

with this one

ctx.spellcheck.language=uk
  • Add the environment variable CTXSPELLPATH and make it point to the location of the word lists (e.g. C:\tools\spell).
  • Restart SciTE, open a .tex file and press [Cntrl-B] to spell check the file. New words can be added to the word list, but you need to restart SciTE after each change.

Using Latin Modern fixed-width font as SciTE display font

The default font in SciTE is a variable-width sansserif (Arial or similar). If you prefer to use a fixed-width font while coding, the minimal distribution comes with a neat Latin Modern font for this purpose. You can find the font at

\yourcontextmainfolder\texmf-context\fonts\truetype\hoekwater\lm\lmtypewriter10-regular.ttf

The only thing you need to do is to install the font as you'd install any TrueType font in your Windows. If you SciTE is otherwise correctly set up, it'll automatically start using the new font.

NB. It seems that this font doesn't have any Cyrillic, so add the font only if using just Roman letters.

Forcing SciTE to use UTF-8 as default encoding

If you plan to use SciTE only for ConTeXt or if all your files are in UTF-8 anyway, you can make UTF-8 as your default encoding. Especially if you start "from scratch", this is recommended!

To change the encoding setting, open SciTE and go to Options and there to Open Global Properties. Find Internationalisation in the settings file:

# Internationalisation
# Japanese input code page 932 and ShiftJIS character set 128
#code.page=932
#character.set=128
# Unicode
#code.page=65001
code.page=0
#character.set=204

Now uncomment #code.page=65001 (i.e. remove the hash sign) and comment code.page=0 (i.e. add a hash in front of the line. Now your internationalisation settings should look like this:

# Internationalisation
# Japanese input code page 932 and ShiftJIS character set 128
#code.page=932
#character.set=128
# Unicode
code.page=65001
#code.page=0
#character.set=204

Now save the settings file, close it, then close SciTE. When you restart SciTE, UTF-8 should be the default encoding.

Installing on Unix

Assuming you installed SciTE successfully and followed the instruction in the manual in order to enable ConTeXt support, there may be a problem in correctly using the Tools (like compiling and building from within SciTE). The launcher inside your Applications menu may be unaware of your $PATH variable, which might lead to an error like

>mtxrun --autogenerate --script context --pdf myfile.tex
sh: mtxrun: not found
>Exit code: 127

To correct this you need to create your own launcher, which executes a script (call it runscite) running SciTE whilst ensuring the $PATH variable is correctly set. You can achieve this by following the code

cat <<'EOF' > /tmp/runscite 
#!/bin/bash 
export PATH=/usr/local/texlive/2010/bin/x86_64-linux:$PATH
exec scite $@ 
EOF

chmod +x /tmp/runscite

sudo cp /tmp/runscite /usr/local/bin

where the PATH needs to point to your mtxrun (and context) scripts. Then you can have your launcher use the command /usr/local/bin/runscite and then you should be able to build your *.tex files from within SciTE by pressing [F7].