/texworks-magiccomments

A TeXworks plugin to edit "magic comments" with a friendly user interface.

Primary LanguageJavaScript

Description

This script lets you insert or edit "magic comments" inside TeXworks with a friendly User Interface.

TeXworks Magic comments

As you can see, TeXShop compatibility is also preserved, when possible.

The script supports the following comments:

  • encoding: shows a list of supported encodings, possibly specifying a few aliases for each of them and the associated inputenc's option.
  • program or TS-program (TeXShop syntax): shows a list of processing tools. Starting from TeXworks r1024, this list is built dynamically using the processing tools actually available (those accessible from the drop-down list near to the Typeset button in the main window). On previous versions of TeXworks, it shows a static list containing a set of predefined engines (note that in this case there's no guarantee that the engines in the list are actually recognized by TeXworks).
  • root: shows all files currently opened in TeXworks (using path relative to the current file).
  • spellcheck: shows a list of dictionaries. Starting from TeXworks r962, this list is built dynamically using all installed dictionaries. In older versions of TeXworks, it shows a static list with a few common languages (note that in this case the dictionary is not guaranteed to be recognized by TeXworks).

Of course, you can insert any value you want for magic comments, though provided list aims to contain only recognized values. For a complete list of supported values on your system for each option, you may refer to the TeXworks preferences.

Thanks to Claudio Beccari and Tommaso Gordini, for all suggestions and for the help in finding TeXShop compatibility issues.

Installation instructions

Obtaining required files

Download the following files:

Installing the script

  1. Open TeXworks
  2. Go to menu ScriptsScripting TeXworks
  3. Select Show Scripts Folder: it will open a new window showing the folder in which all scripts reside
  4. Do either one of the following:
    • Copy downloaded files directly into this folder: it will appear a new menu item Edit magic comments... under the Scripts menu
    • Create a new subfolder, for example "Magic comments", and copy downloaded files into it: it will appear a new submenu (with the same name as the subfolder) containing the menu item Edit magic comments...
  5. Go to menu ScriptsReload Script List

Be careful to put all files into the same folder.

Running the script

Using menus:

  • Go to ScriptsEdit magic comments... or Scripts⟨Selected subfolder⟩Edit magic comments...

Via keyboard:

  • Click Ctrl+K,M (that is, hold Ctrl key and press in sequence K and M)

Reporting issues

Please report any issue using the issue tracker.