A Text Editor (powerful and user-friendly)

not only for TeX/LaTeX

Among plain-text editors NEdit is said to be one of the very best for word processing and programming. It is a multi-purpose programme, available under Linux, Macintosh, and Windows. It is easy to learn, has a good Online-Help, syntax highlighting for more than 20 language modes.
This page intends to guide you from the first step to final print out of a compiled TeX-file. It is a mix of graphical and command-line use.
 
How to start
Terminal command:  nedit
When you put the icon of the running application into your desktop 'dock' then you can start it in the future by double click on the icon. When the programme is closed this icon shows 3 embossed dots (as known from the NeXt machine).
To open a file draw the document icon out of your file viewer on the NEdit dock icon.

Appearance, preferences, and window

This is not cosmetics but essential to use NEdit as editor for TeX-files (i.e.: fixed-space font like Courier, enumerated lines, automatic linebreaks, etc). So, please, reserve some time to save the following changes as defaults:
 
Window height and width:
-->Preferences -->Default settings --->Initialize window size
A width of 79 characters corresponds to the window width of the Edit programme on a NeXt machine. 30 lines down enable a good overview.
Statistics line
-->Preferences -->Statistics Line
The activated statistics bar will appear in the window heading and shows the present cursor position, document path, and total bytes.
Select Text Font
-->Preferences -->Default settings --->Text Fonts ...
To use NEdit for TeX- or HTML-code a non-proportional font like  courier(adobe) is necessary.
Enumerate lines
-->Preferences -->Show line numbers
Activate this option, line numbers will be shown at the left border in light gray (incorrect TeX commands shown in the terminal refer to these line numbers).
Automatic linebreak
->Preferences -->Wrap -->continuous
Sequences of text without carriage return will be counted as one line.
Save Changes in Defaults
->Preferences -->Default Settings -->selection
To set the changes as global: save ->Preferences -->Save Defaults otherwise these changes are only valid for your present session/window.

Spell check

NEdit offers a spell check (default: German) which is not the first choice to check .tex-files. It is better to add the ispell-programme which ignores the TeX-code. For this modification change the default settings:
->Preferences-->Default Settings--->Customize Menus---->Shell Menu.
A window pops up displaying the name of the commands installed (spell, sort, wc, etc.) and 'Menu Entry', 'Accelerator', 'Mnemonic' and 'Shell command to execute'.
How to add ISPELL
To not destroy your defaults first copy the menu item 'spell', then adjust
- Menu Entry from 'spell' --> to ispellTexAmerican (an example)
- Accelerator --> erace 'Alt A' or insert a keystroke not colliding with system keystrokes.
- Mnemonic 'g' --> to 'A' (the A in ispellTexAmerican)
- Shell command to execute, that is most important:
cat>ispellTmp; xterm -e ispell -t -damerican -x ispellTmp; rm ispellTmp.
Explanation of this line:
Ispell generates a temporary file Tmp; the xterm (shell) executes the ispell, '-t' stands for TeX/LaTeX and '-damerican' for the dictionary used, finally the ispell tmp-file is removed.

Search

Either:    Ctrl+f  opens a small window and offers search forward/backward for character sequences or 'regular expression', case sensitive, and for whole words.
Or:   the 'incremental search line' (--> Preferences)
The 'Find' bar is placed under the menu bar and offers nearly the same options as  Ctrl+f.
To search: enter a word into the input field and leave the cursor there:  Ctrl+g  means forward,
search backward: Ctrl+Shift+g (leave the cursor in the input field)

Compile a file.tex

        Be sure that the defaults are set to:
  1. Fixed-spacing Font, Size 14pt
    (No proportional font!) "-adobe-courier-medium-r-normal--14-100-100-100-m-90-iso8859-14"
    When you select -->Preferences-->Default settings--->Text Fonts ... a large window opens, where you can change the font by 'browsing' the primary font. The a.m. font is listed there as   courier(adobe,iso8859,14), select 'medium' as Style and '14' as Size. For 'Fonts for Syntax Highlighting' select italic, bold, and bold italic font respectively.
  2. Language mode = plain
    From file-extensions like .tex .html .css .c and the first 200 characters of a file NEdit determines its type and highlights the syntax. Languages are to be found ->Preferences -->language mode.
  3. Tabulator set to "1"
    ->Preferences --> Default settings --->tabs 'Tabspacing' (for hardware tab characters). "1" is equivalent to one character. Deactivate 'Use tab characters in padding and emulated tabs'.
  4. Further default settings
    'auto indent' = off
    'wrap' = continuous
    'tag collisions' = for programmers
  5. How to check incorrect brackets:
    'delimiter' in ->Preferences -->show matching (...) highlights opened and closing brackets, this preference is available after restart of the programmme. On selecting 'range' in ->Preferences -->show matching (...) the sequence within brackets (...) is highlighted. It is not a good idea to set this option as default, please read the 'Help'!
    "Syntax highlighting is CPU intensive, and under some circumstances can affect NEdit's responsiveness. If you have a particularly slow system, or work with very large files, you may not want to use it all of the time."
  6. NEdit starts each line quite left when 'auto indent' is deactivated and tabulator set to 1 character. The lines of a paragraph are not indented according the indent of its first line!
What you need else:
You need a terminal (or more correctly a shell)! Default directory is your 'home'. You can choose among You find a list in the Debian-Menu (cursor on the desktop, right mouse button) -->XShells.
 
Configure your Gnome-Terminal
->Settings -->Preferences:
'General': Font: -*-fixed-medium-r-normal--14-*-*-*-*-*-*-*,*-r-*,
'Enable multibyte support' and 'Ipen IM (input mode)
'Meta modifiers = 'Mod1 (Alt)'.
'Image' = None,
'Colors' 'Fore/Background Color' = black on white,
'Scrolling' = scrollbar position left or right, scrollback lines = 100 or less/more.
With 'Apply' and 'OK' your changes are saved.
 
How is the .dvi-Datei created?
This is done by terminal command. First move into your working directory where your .tex file is. As example:
Type cd publications/chaos   (cd=change directory). When your directory structure is complex with subsubdirectories you may better change by mouse click:
When using a graphical 'File Viewer' your present directory position is shown in its 'location'-bar. Highlight this document path with the left mouse button then click into the terminal window, type cd and insert the path by middle-button mouse click. Do not forget the space between cd and path!
 
In contrast to Strg+c this insert command works in all applications under Linux!
 
How to get correct preview and printout:

The very first thing you have to do is to create (using 'Nedit' if you like) 2 files named .dvipsrc and .gv and save them in your /local directory.

.dvipsrc put in the 2 lines: p + psfonts.cmz
p + psfonts.amz
Why? that gives LaTeX access to the fonts needed for a correct preview.
.gv put in the 13 lines:
follow the correct syntax:
gv.antialias: True
gv.watchFile: True
gv.watchFileFrequency: 500

gv.scale: -1
gv.scaleBase: 1
gv.fallbackOrientation: Portrait
gv.orientation: Portrait
gv.fallbackPageMedia: A4
gv.pageMedia: Automatic
gv.swapLandscape: False
gv.autoResize: True
gv.ignoreEOF: True
gv.respectDSC: True
Why?
The command gv dateiname.ps & (explanation below) forces the 'gv'-programme to actualize the active gv-window after each 'dvips'-run. (If you forget the & 'dvips' will open a new gv-window each time you run the command 'dvips'.)

Starting your TeX session you have to type these three commands, which are explained below.

latex filename.tex compilation
dvips filename.dvi Creates a PS-file displayed by a viewer like Ghostview.
gv dateiname.ps & ----> only once on first start of Ghostview (gv).
You need not remember and retype the commands each time! ----> By Arrow-Up and Arrow-Down keys you can scroll through the commands you already put in to select the one you need by carriage return.

The terminal-command-->    latex filename.tex    -->creates   filename.dvi.
'TeX' reports on what it is actually doing into your terminal window. Error messages, displaying the line numbers out of your .tex-document are also written into the terminal window.
When TeX refuses to compile stop the run by 'x', otherwise your directory will be filled with x.log-files and you have to remove them by hand!
After corrections rerun TeX. The way described below leads you to the best printable result:
Create a PostScript-file:   dvips filename.dvi    (make PS out of a dvi-file), then
gv dateiname.ps &  starts the Ghostview programme to display the PostScript file.
Do not forget the "&": This forces GhostView after each actualization of TeX to redisplay the PS-file in the same window. Without the "&" you start GhostView after each rerun of TeX!
 
Print your file from GhostView:
Mark all pages you want to print (they get a red vertical banner), then pull down the 'File'-menu and select   
print marked pages ... (meanwhile printing should work without marking the pages first).

For further study

editors compared (in German)
an introduction and useful hints (in German)
a guide to use macros
a good support page

 
 
   back  Theoretical Physics Impressum     last change April 23, 2009