Among its many other features, TEXworks also include syntax highlighting. This means that certain things like LATEX commands, environments, or comments are coloured, underlined, or highlighted in some other way. TEXworks also provides the ability to switch between di erent highlighting schemes1, and to de ne your own ones. This is useful if you often work with types of les for which no highlighting scheme is provided by default, or if you want to adjust the highlighting schemes to better match your system's colour scheme.
To modify the highlighting schemes, you have to edit the plain-text le <_resources>_/con guration/syntax-_patterns.txt. This le can contain any number of individual sections, each de ning a single highlighting scheme to be displayed in the menu structure of TEXworks. To de ne a section, just write the name enclosed in square brackets on a line of its own. Naturally, these names should not include the ] character. By default, the following two sections are de ned:
In addition, you can add comments to the le by starting a line with #. Empty lines are ignored.
Each section consists of an arbitrary number of styling rules. Each such instruction consists of three parts: a formatting instruction, a spell-check ag, and a regular expression2 de ning what part of a text to match. These parts must all be on the same line, and separated by whitespaces (e.g., spaces or tabstop characters). Take for example the following line from the default LaTeX section:
The rst part, red, de nes the format (in this case, a red foreground colour is speci ed). The second part, Y, de nes that spellchecking should be enabled for text that matches this particular rule. Sometimes, it is useful to put N here to disable spellchecking. For example, if spellchecking would be enabled for LATEX commands, most documents would be ooded with red underlines indicating misspelled words when in fact they are only special commands. Finally, the third part speci es that this rule should be applied to all text preceded by %.
Let us take a closer look at the three parts of each rule. In its most general form, the rst part the format instruction looks like
The
Each colour can either be speci ed by an SVG
name3 or by a hexadecimal
value (#rrggbb4)
similar as in web documents. The
Examples of valid formatting instructions are:
The use of keyboard shortcuts greatly facilitates typing in and the management of the source and the preview windows. Their use is much more e ective than the use of buttons for frequently-used actions.
Below, you'll nd the shortcuts for source and preview windows. Note that on Mac OS X, Ctrl actually refers to the Command key, which is the usual modi er for keyboard shortcuts. Although the keyboard shortcuts are speci ed with Ctrl, this will appear as the Command-key symbol in menus. (To refer to the actual Control key on the Mac, the shortcut le should use the name Meta).
Note that the shortcuts listed below are the default shortcuts for the English interface of TEXworks. Di erent languages may use di erent shortcuts.
All the shortcuts can be rede ned either to create new shortcuts or to modify the existing ones to match personal uses or change shortcuts not adapted to one particular keyboard layout. The list of possible actions to associate with shortcuts is given after the prede ned shortcuts.
To de ne your own shortcuts, put a le named shortcuts.ini in the <_resources>_/con guration folder, next to auto-_indent-_patterns.txt, delimiter-_pairs.txt, …, texworks-_con g.txt.
For example, this le could contain:
The rst line de nes that using Shift *F3 should open the hardwrap dialogue box in the source window; the second (CtrlEnd) should bring you to the last page and CtrlHome (third line) should take you to the rst page; with F3 you want to wrap/unwrap lines in the source, with F4 you will show/hide line numbers and with F9 you intend to select the text between corresponding delimiters in the source.
For working in the source window:
Shortcut | Action |
|
|
Ctrl+' | Go to Preview |
Ctrl+= | Show Selection |
Ctrl+A | Select All |
Ctrl+Alt+S | Save All |
Ctrl+B | Balance Delimiters |
Ctrl+C | Copy |
Ctrl+E | Copy to Find |
Ctrl+F | Find... |
Ctrl+G | Find Again |
Ctrl+H | Find Selection |
Ctrl+L | Go to Line... |
Ctrl+N | New |
Ctrl+O | Open... |
Ctrl+Q | Quit TeXworks |
Ctrl+R | Replace... |
Ctrl+S | Save |
Ctrl+Shift+E | Copy to Replace |
Ctrl+Shift+N | New from Template... |
Ctrl+Shift+R | Replace Again |
Ctrl+Shift+S | Save As... |
|
|
Ctrl+Shift+Z | Redo |
Ctrl+Shift+[ | Uncomment |
Ctrl+Shift+] | Comment |
Ctrl+T | Typeset |
Ctrl+V | Paste |
Ctrl+W | Close |
Ctrl+X | Cut |
Ctrl+Z | Undo |
Ctrl+[ | Unindent |
Ctrl+\ | Hide Output Panel |
Ctrl+] | Indent |
|
|
|
|
|
Moving the cursor (hold Shift * to select):
Shortcut | Action |
|
|
! | 1 character right |
Ctrl+! | 1 word right |
| 1 character left |
Ctrl+ | 1 word left |
" | 1 line up |
# | 1 line down |
PgUp | 1 screen up |
PgDown | 1 screen down |
Home | Begin of line |
Ctrl+Home | Begin of document |
End | End of line |
Ctrl+End | End of document |
|
|
|
|
|
For working in the preview window:
Shortcut | Action |
|
|
Ctrl+' | Go to Source |
Ctrl++ | Zoom In |
Ctrl+- | Zoom Out |
Ctrl+1 | Actual Size |
Ctrl+2 | Fit to Width |
Ctrl+3 | Fit to Window |
Ctrl+Backspace | Clear |
Ctrl+C | Copy |
Ctrl+F | Find... |
Ctrl+G | Find Again |
Ctrl+J | Go to Page... |
Ctrl+N | New |
Ctrl+O | Open... |
Ctrl+Q | Quit TeXworks |
Ctrl+Shift+F | Full Screen |
Ctrl+Shift+N | New from Template... |
Ctrl+Shift+Z | Redo |
Ctrl+T | Typeset |
Ctrl+V | Paste |
Ctrl+W | Close |
|
|
Ctrl+X | Cut |
Ctrl+Z | Undo |
End | Last Page |
Home | First Page |
PgDown | Next Page |
PgUp | Previous Page |
|
|
|
|
|
actionAbout_Scripts |
actionPaste |
actionAbout_TW |
actionPlace_on_Left |
actionActual_Size |
actionPlace_on_Right |
actionApply_to_Selection |
actionPreferences |
actionAutoIndent_None |
actionPrevious_Page |
actionAuto_Follow_Focus |
actionQuit_TeXworks |
actionBalance_Delimiters |
actionRedo |
actionClear |
actionRemove_Aux_Files |
actionClose |
actionReplace |
actionComment |
actionReplace_Again |
actionCopy |
actionRevert_to_Saved |
actionCopy_to_Find |
actionSave |
actionCopy_to_Replace |
actionSave_All |
actionCut |
actionSave_As |
actionFind |
actionScroll |
actionFind_Again |
actionSelect_All |
actionFind_Selection |
actionSelect_Image |
actionFirst_Page |
actionSelect_Text |
actionFit_to_Width |
actionSettings_and_Resources |
actionFit_to_Window |
actionShow_Hide_Console |
actionFont |
actionShow_Scripts_Folder |
actionFull_Screen |
actionShow_Selection |
actionGoToHomePage |
actionSide_by_Side |
actionGo_to_Line |
actionSmartQuotes_None |
actionGo_to_Page |
actionStack |
actionGo_to_Preview |
actionSyntaxColoring_None |
actionGo_to_Source |
actionTile |
actionHard_Wrap |
actionTo_Lowercase |
actionIndent |
actionTo_Uppercase |
actionLast_Page |
actionToggle_Case |
actionLine_Numbers |
actionTypeset |
actionMagnify |
actionUncomment |
actionManage_Scripts |
actionUndo |
actionNew |
actionUnindent |
actionNew_from_Template |
actionUpdate_Scripts |
actionNext_Page |
actionWrap_Lines |
actionNone |
actionWriteToMailingList |
actionOpen |
actionZoom_In |
actionOpen_Recent |
actionZoom_Out |
|
|
|
|
|
Edit
| |
actionBalance_Delimiters |
actionRedo |
actionClear |
actionSelect_All |
actionCopy |
actionTo_Lowercase |
actionCut |
actionTo_Uppercase |
actionNone |
actionToggle_Case |
actionPaste |
actionUndo |
actionPreferences |
|
File
| |
actionClose |
actionRemove_Aux_Files |
actionNew |
actionRevert_to_Saved |
actionNew_from_Template |
actionSave |
actionOpen |
actionSave_All |
actionOpen_Recent |
actionSave_As |
actionQuit_TeXworks |
|
Format
| |
actionApply_to_Selection |
actionLine_Numbers |
actionAutoIndent_None |
actionSmartQuotes_None |
actionComment |
actionSyntaxColoring_None |
actionFont |
actionUncomment |
actionHard_Wrap |
actionUnindent |
actionIndent |
actionWrap_Lines |
Help
| |
actionAbout_TW |
actionSettings_and_Resources |
actionGoToHomePage |
actionWriteToMailingList |
Scripts
| |
actionAbout_Scripts |
actionShow_Scripts_Folder |
actionManage_Scripts |
actionUpdate_Scripts |
Search
| |
actionCopy_to_Find |
actionGo_to_Line |
actionCopy_to_Replace |
actionReplace |
actionFind |
actionReplace_Again |
actionFind_Again |
actionShow_Selection |
actionFind_Selection |
|
Typeset
| |
actionTypeset |
|
Window
| |
actionAuto_Follow_Focus |
actionShow_Hide_Console |
actionGo_to_Preview |
actionSide_by_Side |
actionPlace_on_Left |
actionStack |
|
|
actionPlace_on_Right |
actionTile |
|
|
|
|
|
Edit
| |
actionClear |
actionPreferences |
actionCopy |
actionRedo |
actionCut |
actionUndo |
actionPaste |
|
File
| |
actionClose |
actionOpen |
actionNew |
actionOpen_Recent |
actionNew_from_Template |
actionQuit_TeXworks |
Help
| |
actionAbout_TW |
actionSettings_and_Resources |
actionGoToHomePage |
actionWriteToMailingList |
Scripts
| |
actionAbout_Scripts |
actionShow_Scripts_Folder |
actionManage_Scripts |
actionUpdate_Scripts |
Search
| |
actionFind |
actionFind_Again |
Typeset
| |
actionTypeset |
|
View
| |
actionActual_Size |
actionLast_Page |
actionFirst_Page |
actionNext_Page |
actionFit_to_Width |
actionPrevious_Page |
actionFit_to_Window |
actionZoom_In |
actionFull_Screen |
actionZoom_Out |
actionGo_to_Page |
|
Window
| |
actionGo_to_Source |
actionSide_by_Side |
actionPlace_on_Left |
actionStack |
actionPlace_on_Right |
actionTile |
|
|
|
|
|
In addition to the static actions listed above, there are also actions for scripts.
These are dynamic in nature, as they are created on-the- y for the available
scripts (which may change when you install scripts, remove them, or change some
settings). All of these actions are of the form Script:
We give here the keywords for auto-completion as they are supplied by TEXworks. They are given in the les tw-_basic.txt, tw-_context.txt (initially empty) and tw-_latex.txt in the <_resource>_\completion folder.
We give them in three columns: the rst two show the keywords, the third the (LA)TEX code produced. In some cases there is only the code, this means that you can start to enter the (LA)TEX code and try to complete it with