Lugaru's Epsilon
Programmer's
Editor 14.00

Context:
Epsilon User's Manual and Reference
   Commands by Topic
      . . .
      Changing Text
         Inserting and Deleting
         Killing Text
         Clipboard Access
         . . .
         Hex Mode
      Language Modes
         . . .
         Shell Mode
         Tcl Mode
         TeX and LaTeX Modes
         VHDL Mode
         Visual Basic Mode
      More Programming Features
         Navigating in Source Code
         Pulling Words
         Accessing Help
         Context-Sensitive Help
         Commenting Commands
      . . .

Previous   Up    Next
Tcl Mode  Commands by Topic   VHDL Mode


Epsilon User's Manual and Reference > Commands by Topic > Language Modes >

TeX and LaTeX Modes

Epsilon automatically enters either TeX or LaTeX mode when you read a file with an extension of .tex, .ltx, .sty, or (in most cases) .cls. (By default it enters LaTeX mode, but see the tex-force-latex command below.) TeX and LaTeX modes are almost identical, and will be described together.

Keys in TeX/LaTeX mode include Alt-i for italic text, Alt-Shift-I for slanted text, Alt-Shift-T for typewriter, Alt-Shift-B for boldface, Alt-Shift-C for small caps, Alt-Shift-F for a footnote, and Alt-s for a centered line.

Alt-Shift-E prompts for the name of a LaTeX environment, then inserts \begin{env} and \end{env} lines for the one you select. You can press ? to select an environment from a list. (The list of environments comes from the file latex.env, which you can edit by copying it from Epsilon's install directory to your Epsilon customization directory.) Alt-Shift-Z searches backwards for the last \begin{env} directive without a matching \end{env} directive. Then it inserts the correct \end{env} directive at point.

For most of these commands, you can highlight a block of text first and Epsilon will insert formatting commands to make the text italic, slanted, etc. or you can use the command and then type the text to be italic, slanted, etc.

By default, Epsilon inserts the appropriate LaTeX 2e/3 command (such as \textit for italic text). Set the variable latex-2e-or-3 to 0 if you want Epsilon to use the LaTeX 2.09 equivalent. (In the case of italic text, this would be \it.)

The keys "{" and "$" insert matched pairs of characters (either {} or $$). When you type \( or \[, TeX/LaTeX mode will insert a matching \) or \], respectively. But if you type "{" just before a non-whitespace character, it inserts only a "{". This makes it easier to surround existing text with braces.

The keys <Comma> and <Period> remove a preceding italic correction \/, the " key inserts the appropriate kind of doublequote sequence like `` or '', and Alt-" inserts an actual " character.

Some TeX mode commands are slightly different in LaTeX than in pure TeX. Set tex-force-latex to 1 if all your documents are LaTeX, 0 if all your documents are TeX, or 2 if Epsilon should determine this on a document-by-document basis. In that case, Epsilon will assume a document is LaTeX if it contains a \begin{document} statement or if it's in a file with an .ltx, .sty, or .cls extension. By default, Epsilon assumes all documents use LaTeX.

When the cursor is on a delimiter character like (, ), {, }, [, or ], Epsilon will try to locate its matching character and highlight them both. If the current character has no match, Epsilon will not highlight it. Set the variable auto-show-tex-delimiters to zero to disable this feature.

Set the variable tex-look-back to a bigger number if you want TeX mode to more accurately syntax highlight very large paragraphs but be slower, or a smaller number if you want recoloring to be faster but perhaps miscolor large paragraphs. You can customize syntax highlighting using the variables latex-display-math-env-pat, latex-math-env-pat, and latex-non-text-argument.

You can use the list-definitions command to see a list of LaTeX labels in the current file and move to one. The tagging commands (see Tags) also work on labels. See the latex-tag-keywords variable if you want to make these work on cite tags too, or make other tagging customizations.

In LaTeX mode, the spell checker uses the latex-spell-options variable. Also see the latex-non-text-argument variable to control how the spell checker treats the parameter of LaTeX commands like \begin that can take keywords. In TeX mode, the spell checker uses the tex-spell-options variable.

Running TeX

The compile-buffer command (normally on Alt-F3) uses the compile-tex-cmd variable in TeX mode and the compile-latex-cmd variable in LaTeX mode. (We'll just say "TeX" from now on, but we mean either TeX or LaTeX or any comparable program like pdfLaTeX or XeTeX.) You may need to set these if the version of TeX you use takes some different flags. By default Epsilon uses flags that keep TeX from prompting for input on errors, display error messages in a format other programs can read, and enable SyncTeX and source specials for integrating a viewer with Epsilon. You could also use a definition that runs TeX and then displays the resulting output file, but the details depend on which viewer you want to use.

If your TeX system uses a compatible DVI previewer, or you have a PDF viewer that works with the SyncTeX system, then you can configure your viewer and Epsilon to work together, jumping from any line in your .tex source file to the resulting TeX output in your viewer (forward sync), or jumping from a spot in your viewer back to the .tex code that produced it (reverse sync). This requires some setup. We'll describe reverse sync first.

For SyncTeX, add the flag -synctex=1 to your TeX command line (by adding it to compile-latex-cmd, for example), or put \synctex=1 in your .tex file. Then install a PDF viewer that understands SyncTeX files. On Windows, SumatraPDF can do this. In its configuration file, use these settings:

EnableTeXEnhancements = true
InverseSearchCmdLine = "C:\Program Files\Eps14\bin\epsilon.exe" -add +%l "%f"

The above setting lets you double-click on text in your PDF and have Epsilon display the corresponding TeX file and line that produced it.

Similarly, to link a DVI previewer to Epsilon, you must first instruct TeX or LaTeX to include "source specials" in your DVI file; these let your DVI viewer know which parts of the DVI file correspond to particular .tex file names and line numbers. Most versions of TeX understand flags like --src-specials or -src to do this. With others, your TeX source file can input srctex.sty (or srcltx.sty) to include this information.

Once you've set up TeX to use source specials, as above, you can configure your DVI viewer to run Epsilon, showing the source file and line corresponding to a certain spot in your DVI file. The details depend on your DVI viewer, but a command line like epsilon -add +%l "%f" is typical.

For yap, use the View/Options/Inverse Search command to set the command line as above. You may need to include the full path to Epsilon. Double-click in yap to have Epsilon display the source file that generated the DVI text you're viewing.

For xdvi, you can run it with its -editor flag, or set the XEDITOR environment variable, so it contains epsilon -add +%l:%c %f. Ctrl-click in xdvi to have Epsilon display the corresponding source file.

In Epsilon, forward sync (jumping from your .tex source file to the corresponding TeX output in your DVI or PDF viewer) uses the jump-to-dvi command on Alt-Shift-J. Or you can hold down Ctrl and left-click the mouse on your TeX source. First, enable source specials or SyncTeX support, respectively, as explained above. Then you'll need to configure Epsilon. Set the jump-to-dvi-extension variable to either ".dvi" or ".pdf". Then set the jump-to-dvi-command variable. It contains the command line to run your DVI or PDF viewer and instruct it to go to a particular TeX source file and line within the output file. For xdvi, use xdvi -sourceposition %l%f %d or xdvi -sourceposition %l%b.tex %d. For yap, use yap -1 -s %l%f %d. For SumatraPDF, use SumatraPDF -forward-search %f %l %d". You might need to add the full path, so a complete setting in your einit.ecm file might look like this:

+jump-to-dvi-command char array variable: 4096
   "\"C:\\Program Files\\SumatraPDF\\SumatraPDF.exe\" -forward-search %f %l %d"
+jump-to-dvi-extension char array variable: 4096 ".pdf"

(We've split the first line above because it's so long, but it's really one long line.)

Once both those Epsilon variables have been set appropriately, you can use TeX mode's jump-to-dvi command via Alt-Shift-J or Ctrl-left-click to view the DVI or PDF output resulting from the current line of TeX or LaTeX.

(Under Windows, Epsilon can also communicate with Y&Y's old "DVIWindo" previewer, version 2.1.4 and later, using DDE. For this option, jump-to-dvi-command must be empty. When jump-to-dvi uses DVIWindo, it doesn't prompt; instead, it assumes that if the current TeX source file has no corresponding DVI file, the DVI file is already loaded in DVIWindo.)

For documents made from multiple TeX files, Epsilon can't always determine the ultimate DVI or PDF file name by examining one of the component TeX files. You can add a line like "% mainfile: somefilename.tex" or "% !TeX root = somefilename.tex" within 3 lines of a TeX file's start or end, and Epsilon will assume that somefilename.dvi (or somefilename.pdf, based on the jump-to-dvi-extension variable) is the file your viewer should open. If your document doesn't include a mainfile declaration, Epsilon will look for a corresponding .dvi or .pdf file with the same base name. Otherwise, it prompts for the .dvi (or .pdf) file name. It uses that file name from then on, even if some other TeX file has a mainfile declaration or corresponding .dvi or .pdf file.

If this command displays the wrong DVI or PDF file, run jump-to-dvi with a numeric prefix argument, which forces it to ask for the correct file name again. An empty response makes Epsilon return to checking separately for each .tex file, as above.

Standard bindings:

  Alt-i  tex-italic
 Alt-Shift-I  tex-slant
 Alt-Shift-T  tex-typewriter
 Alt-Shift-B  tex-boldface
 Alt-Shift-C  tex-small-caps
 Alt-Shift-F  tex-footnote
 Alt-s  tex-center-line
 Alt-Shift-E  tex-environment
 Alt-Shift-Z  tex-close-environment
 {  tex-left-brace
 $  tex-math-escape
 <Comma>, <Period>  tex-rm-correction
 "  tex-quote
 Alt-"  tex-force-quote
 \(  tex-inline-math
 \[  tex-display-math
   tex-mode
   latex-mode
 Alt-Shift-J, Ctrl-M-<Left>  jump-to-dvi
 



Previous   Up    Next
Tcl Mode  Commands by Topic   VHDL Mode


Lugaru Epsilon Programmer's Editor 14.00 manual. Copyright (C) 1984, 2020 by Lugaru Software Ltd. All rights reserved.