Latex Colors Help
Name:Latex Colors
Version:0.6
Last update:2019-10-17 13:28:33






This package provides additional color support for TeX mode. You can turn it on by selecting Alpha ↣ TeX Mode Setup ↣ Features and clicking on the checkbox for LaTeX Colors.
Click here to display the TeX Mode Features Preferences and activate this package.

Description

Once this package has been turned on, two new items can now be found in the TeX Menu ↣ LaTeX Utilities submenu, named which are described below. These items will add/remove colors and styles to the {contents} of select commands.

Color Window

The first item (TeX Menu ↣ LaTeX Utilities ↣ Color Window) opens a dialog in which you can specify up to four different LaTeX items to which you would like different colors to be added. All text in braces following the field name will then be colored, as in
\footnote{
   This is text that would be colored
}
and
{\footnote This will also work}
The list of items available for colorizing can be found in the TeX mode preference for Colorizable Items once this package has been turned on. Items in this preference can be regular expressions if desired. Click here to display the TeX Mode Preferences.
All settings are saved between editing sessions.
Pressing the TeX mode keyboard shortcut which has been defined for Refresh LaTeX Colors as described below will first remove and then add all of the colors and styles using the saved settings.

Remove Colors

The second item (TeX Menu ↣ LaTeX Utilities ↣ Remove Colors) will remove all of the colors which have been added by the first item. They will be re-applied the next time you use the keyboard shortcut for Refresh or Center Refresh until you have either turned this package off or reset all values in the Color Window dialog to their empty default values.

Keyboard Shortcuts

If you edit the text within the colored environments, you might find that the text colors or styles are not consistently rendered. This package defines two different configurable keyboard shortcuts to help clean up the active window.
Refresh LaTeX Colors⌃⌥L
Refresh LaTeX Colors Center⌃L
The default values for these shortcuts are the same as Refresh and Center Refresh that are used in all other Alpha windows. Pressing Control-Option-L (⌃⌥L) will update the colors for you in the active window using the saved settings, while Control-L (⌃L) will also center the window using the cursor location. Click here to display the TeX Mode Preferences.

Testing

Want to test this package? Click here to open the LaTeX Example.tex example window. This will temporarily activate this package for this editing session, and offer the dialog for TeX Menu ↣ LaTeX Utilities ↣ Color Window. To turn this package on permanently, you can adjust your TeX Mode Features Preferences .

Limitations

This feature is exploiting some of the window coloring options that are made available by various Alpha core commands. In some cases we run into some interference encountered with normal keyword colorizing routines, as explained below.
If you want these colors to be automatically applied when you first open a .tex window, you need to turn this package on globally. Click here to display the Features Preferences dialog and activate this package.
Technical note 1: Automatic colorizing with this package can result in a considerable delay when .tex windows are first opened. Perhaps we need a preference to decide if colors should be automatically applied.
Technical note 2: if the feature is only turned on for TeX mode, the colors are only applied if the mode of the active window is TeX _before_ the new window is opened. The [openHook] procedure is deregistered when switching out of TeX mode, and by the time it is re-registered because TeX mode features are re-activated the window has already been opened and the hook won't be called... We hope to address this better in a future release, perhaps by always registering the [openHook] and checking to see this package is still active, or making use of a package's off script.

Known problems

Please report any problem or bug you encounter to Alpha's Bug Tracker.

License and Disclaimer

Copyright (c) 2003-2019, Craig Barton Upright.
All rights reserved.
The latexColors package is free software and distributed under the terms of the new BSD license:
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CRAIG BARTON UPRIGHT BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.