Tools

Working on several projects I devoloped some helpfull tools:

Frequently asked questions:

A Makefile for better LaTeX support for FTE

Download the Makefile and copy it to the directory were your LaTeX document resides.

The Makefile can produce several outpu formats:

  • .ps: A simple postscriptfile produced by dvips
  • .pdf: A simple postscriptfile produced by dvipdf
  • .ps.gz: A postscriptfile which can be print as booklet
  • .bdf: A pdf-file wjich can be print as booklet

If your LaTeX distribution is correctly installed you cann immediatly start working. Assuming you have a helloword.tex file, you can do:

  • make helloworld will produce the .ps file
  • make helloworld.ps will produce the .ps file
  • make helloworld.ps.gz will produce the .ps.gz file
  • make helloworld.pdf will produce the .pdf file
  • make helloworld.bdf will produce the .bdf file

To use make without arguments (simple make) you have to change the Makefile and add your preferred targets, e.g.:
TARGET = helloworld.pdf helloworld.ps.gz

The Makefile takes care of calling latex and bibtex in the correct order and calles it the correct times.

All standard output is suppressed. But the Makefile offers the following features compiling your document:

  • The first latex call makes make fail if an error occures. Only these errors are printed in a style which is understood by FTE (see below)
  • The return code of bibtex is ignored for convinience. Check its Warning and Error output.
  • The output of the second call to latex is redirected to /dev/null
  • When latex is called the third time everything should be Ok. Therfor Warnings will now make make fail. This makes sure that you correct all Warnings before the final document is crated (e.g. missing references)

If your are still interested in the full logging output have a look into helloworld.log automatically created by latex.

Implementation of the Makefile into FTE.

Using FTE you can always compile your document simple by running make using Compile... (F9) or Run... (Ctrl-F9). But if a tex-document is opened the default for Compile... is to start latex. This behaviour can be overwritten replacing (in main.fte)

eventmap TEX : PLAIN {
   key [F9] { Compile "latex " }
}

by

eventmap TEX : PLAIN {
   key [F9] { Compile "make " }
}

to compile always all your project which are set as targets in your Makefile or having the plain Makefile without any change:

eventmap TEX : PLAIN {
   key [F9] { Compile "make " . $FileNameBase }
}

to compile only the default project (calling make with the current file name without its extension will produce the default ps-file) or

eventmap TEX : PLAIN {
   key [F9] { Compile "make " . $FileNameBase . ".pdf" }
}

to create other kind of documents as default.

A similar change can be done by replacing
eventmap PLAIN {
   key [A+C+Enter] { noumlaut; RunProgram "latex " . $FileNameBase }
}

accordingly to start make without further user intercation, but this will start the job in a new terminal.

Don't forget to compile the configuration. If you have started make from FTE all messages will be shown in its Message Window (to change back to you document use Alt+CursorRight, Alt+CursorLeft or Alt+0). It should look like:
helloworld.tex:721: undefined control sequence
Go to this line and press Enter. FTE will jump to this location in your file. The error message still will be displayed in the status line. If there are more than one error you can jump backward and forward using F11 and F12.

Let FTE accept characters like space in filenames when evaluating Messages.

If you use the message windoe extensively (ispell, make, etc.) you might have realised the this works only for filenames without special characters like spaces. To change this behaviour you have to change the regular expressions determin the filename from the message. You can, for example, replace (global.fte):

# grep -n
   CompileRx = { 1, 2, 3, /^([\w:._\-\/\\]#):(\d+):/ };
# GCC
   CompileRx = { 1, 2, 3, /^([\w:._\-\/\\]+):(\d+):\s(.*)$/ };

by

# grep -n
   CompileRx = { 1, 2, 3, /^([\w:._\-\/\\\ ]#):(\d+):/ };
# GCC
   CompileRx = { 1, 2, 3, /^([\w:._\-\/\\\ ]+):(\d+):\s(.*)$/ };

(Yes, the difference is reall really small! Just an additional backslash-space.

Recompile your configuration and it should work.

Add a Mark Block feature to FTE

Mark-Block is a nice feature to mark a block between two parenthesis ()[]{}. First you must change the configuration and compile it. Add

item "Mark &Block" {
   BlockUnmark; BlockMarkStream;
   MatchBracket; BlockMarkStream;
   SavePos; MoveBlockEnd;
   2:MoveNext; ?MoveLeft;
   BlockEnd; MoveSavedPos;
}
item "Mark Wor&d { BlockSelectWord }

into the section Block in ui_m_fte.fte. Into the appropriate menu. Keybindings can be defined in ui_k_fte.fte. Compile your Configuration, place the courson on top of a word and choose Mark Word from the menu. Place your corsor on top of a parenthesis in a source file and choose Mark Block.

Hiliting the &-character in FTEs TeX-Mode

To hilit the &-character (usefull in tables) replace the section

h_state 0 { 'Normal' }
[...]

in m_tex.fte by

h_state 0 { 'Normal' }
h_trans { 1, '', '\\begin{verbatim}', 'Quotes' }
h_trans { 0, '', '\\\\', 'Comment' }
h_trans { 2, '', '\\', 'Special' }
h_trans { 0, 's', '{}', 'Special' }
h_trans { 4, '', '$', 'Function' }
h_trans { 5, '', '$$', 'Function' }
h_trans { 3, '', '%', 'Comment' }
h_trans { 0, 's' , '@^&_', 'Comment' }

This also makes sure, that the \\ at the end of each line appear in a unique color.

Don't forget to compile the configuration.

Better support for ispell for FTE.

Download the three files:

Put the files in your path, e.g. /home/[yourname]/bin and make them executable by, e.g.
chmod u+x myspell

Make sure that ispell and sed is properly installed.

Now add two new Tools-menu entries to your FTE configuration ui_m_fte.fte:

item "ISepllGer" { Compile "myspell \"".$FileName.\"" german"; }
item "ISepllEng" { Compile "myspell \"".$FileName.\"" american"; }

If you want to save your file before starting ispell automatically add FileSave; in front of it. Clearing the messages automatically might also be helpfull by ClearMessages;

Don't forget to compile the configuration. If you have started ispell from your menu all messages will be shown in its Message Window (to change back to you document use Alt+CursorRight, Alt+CursorLeft or Alt+0). It should look like:
helloworld.tex:721: Unknownword
for a totally unknown word and
helloworld.tex:721: Txst: Test Taste
if ispell made suggestions. Go to a line and press Enter. FTE will jump to this location in your file. The error message still will be displayed in the status line. If there are more than one error you can jump backward and forward using F11 and F12.

There are additonal features:

  • http-links of the form http://* are not checked
  • The arguments between [] in tex-commands like \begin{figure}[htp] are not checked.
You have some control on the behaviour of ispell from your TeX-file:

If your line looks like
"%* Testword" (%* must be the first two characters in the line!)
the word is added to your personal dictionary (eg. .ispell_deutsch)

To accept a word but do not add it to the dictionary use
"%@ Testword" (%* must be the first two characters in the line!)
This is usefull for short words.

If you start a comment with %> instead of % the following text is not checked.

Where do I find the configuration files of FTE?

In unix systems they are normally in /etc/fte. Because you won't have write access you have to make a copy of this tree.

How do I compile the configuration of FTE

After any change you must recompile the configuration by
cfte [path]/main.fte ~/.fterc


Thomas Bretz.