ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

MBXTools

by Dave Rosoff ST2/ST3

A Sublime Text 2/3 package for MathBook XML files.

Details

Installs

  • Total 53
  • Win 26
  • OS X 19
  • Linux 8
Dec 11 Dec 10 Dec 9 Dec 8 Dec 7 Dec 6 Dec 5 Dec 4 Dec 3 Dec 2 Dec 1 Nov 30 Nov 29 Nov 28 Nov 27 Nov 26 Nov 25 Nov 24 Nov 23 Nov 22 Nov 21 Nov 20 Nov 19 Nov 18 Nov 17 Nov 16 Nov 15 Nov 14 Nov 13 Nov 12 Nov 11 Nov 10 Nov 9 Nov 8 Nov 7 Nov 6 Nov 5 Nov 4 Nov 3 Nov 2 Nov 1 Oct 31 Oct 30 Oct 29 Oct 28
Windows 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0
OS X 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Linux 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

Readme

Source
raw.​githubusercontent.​com

MBXTools: a Sublime Text package for MathBook XML

MBXTools is a Sublime Text package designed to assist authors using MathBook XML. It is very experimental and may behave unexpectedly.

The package is inspired by the excellent LaTeXTools package, which I have enjoyed using for many years. I have borrowed very liberally from the LaTeXTools codebase in order to implement the features I thought would be most useful to MBX authors. Please let me know of any bugs you find or any features you would like to include.

Installation

It is recommended to install MBXTools via Package Control. If you have not installed Package Control yet, you should do that first (and restart Sublime Text afterward).

After Package Control is installed, use the Install Package command to search for the MBXTools package, and select it from the Quick Panel to install. This method of installation allows Package Control to automatically update your installation and show you appropriate release notes.

You may also install MBXTools via git. Change directories into your Packages folder. To find the Packages folder, select Browse Packages from the Preferences menu (from the Sublime Text 3 menu on OS X). Make sure you are in the Packages folder and not Packages/User.

Then, run

git clone https://github.com/daverosoff/MBXTools.git

and restart Sublime Text (probably not necessary).

Keybindings

MBXTools is inspired by LaTeXTools, and like that package uses a Ctrl+l prefix for many commands. The Expand Selection to Line command is bound to Ctrl+l by default. MBXTools rebinds that command to Ctrl+l, Ctrl+l. Note that this is a keyboard shortcut consisting of two separate keystroke combinations. Most MBXTools shortcuts are like this.

Usage

You can activate the package features by enabling the MathBook XML syntax. The syntax definition looks for .mbx file extensions, which most of us don't use (yet?). If your MathBook XML files end with .xml, you have several choices.

  1. Use the Preferences menu or the Command Palette to run the command Set MBX File Extensions, and use the input panel to add .xml to the comma-separated list. Sublime will look for a project settings file first, then update user preferences if it doesn't find one. If you have multiple MBX projects, or if you edit XML other than MBX, it is best to start using projects so that you can have project-specific settings.

  2. Add a comment “ to the first line of each file (after the XML declaration).

  3. Enable the syntax manually using the command palette. To enable it manually, open an MathBook XML file and press Ctrl+Shift+P (Cmd+Shift+P on OS X) and type mbx. Select Set Syntax: MathBook XML from the list of options.

You should see the text MathBook XML in the lower right corner if you have the status bar visible (command palette: Toggle Status Bar).

Image of status bar showing MathBook XML active

There are only a few features implemented so far.

  1. If you have some subdivisions (with xml:id) in your MathBook XML file, hit Ctrl+R (Cmd+R on OS X) to run the Goto Symbol command. You should see a panel showing all your available sections. Select one to jump to it in the active view. This tool does not index subdivisions without an xml:id attribute.

Image of quick panel showing sections

  1. Open your entire source folder as a project and use Goto Symbol in Project (Ctrl+Shift+R/Cmd+Shift+R) to see all the xml:id for all the MathBook XML files in the project (must use either .mbx extension or <!-- MBX --> comment in first line of each file for indexing to succeed).

  2. If you have been using xml:id to label your stuff, try typing <xref ref=" (the beginning of a cross-reference). Sublime Text should show you a panel containing all xml:id values along with the elements they go with. Choose one to insert it at the caret and close the xref tag. Alternatively, type ref and hit Tab to activate the xref snippet. Then hit Ctrl+L, X or Ctrl+L, Ctrl+Space to bring up the completions menu. There are several variants of the ref snippet, namely refa, refp, and refpa.

Image of quick panel showing xml id values

  1. If you set an MBX root file, then ref completion as described above will recursively search for xml:id through all your xi:includes starting with the indicated root file. Run the command "Set MBX Root File” from the Preferences menu or the Command Palette. Be sure to use an absolute path name for the value of the setting.

  2. Type chp, sec, ssec, or sssec and hit Tab to activate the subdivision snippets. A blank title element is provided and the cursor positioned within it. As you type, the xml:id field for the subdivision is filled with similar text mirroring the title you are entering.

Known issues

  • The ref snippet does not bring up the quick panel. Should it?
  • Nothing has been tested on OS X or Linux.