Smart Braces & Advanced LaTeX Auto-Pair, IDE-like-Grade Editing for Anki (similar to VSCode Bracket Handling)
Writing detailed flashcards - especially those containing LaTeX / MathJax equations, or code - involves frequent redundant typing, closing, and clearing of brackets and delimiters.
Braces++ brings modern code-editor intelligence (similar to VSCode) directly into Anki's card editor. It handles automatic bracket closing, selection wrapping, overtyping, bracket replacement, and auto-completing of specialised LaTeX expressions such as \left...\right.
Key Features
- Automatic Pair Completion: Automatically inserts matching closing pairs for parentheses
(), square brackets [], curly braces {}, pipes ||, double quotes "", and single quotes '', positioning your cursor squarely in the center of the new brackets.
- Wrap Selected Text: Highlight any text and press a bracket or quotation key to instantly enclose it.
- Bracket Switching & Replacement: Highlight already-bracketed text (e.g.,
(sample) or \{sample\}) and type a new bracket to swap the outer delimiters in one stroke.
- Delimiter Stripping (Delete Key): Highlight bracketed text like
(sample) and hit Delete to remove the enclosing brackets while preserving the text inside.
- Intelligent Overtyping / Skip-Over: When typing next to an existing closing bracket or quote, and input the closing bracket key, the cursor steps smoothly past it instead of inserting unwanted duplicates.
- Pair-Aware Backspace: Pressing
Backspace inside an empty pair (e.g., (|)) deletes both the opening and closing brackets at once.
- Context-Aware Safeguards: Built-in detection prevents auto-closing after colons (allowing you to type emoticons like
:) freely) and ignores contractions/possessives (such as don't or card's).
- Word-Boundary Padding: Automatically adds a trailing space when opening a bracket directly against an existing word to avoid accidental text collisions.
Specialized LaTeX & MathJax Support
- Auto-Close
\left...\right: Typing an open bracket immediately after \left automatically generates the matching \right delimiter (matching the chosen bracket) and repositions your cursor inside. This also contains advanced error handling, such as automatically adding the \ key if the user forgets it when entering { after \left.
- Calculus / Physics Evaluation Bar: Typing a period
. right after \left automatically expands to \left. \right|_ for definite integrals and evaluated-at notation.
- LaTeX Escaped Braces: Typing
{ after a backslash automatically produces \{\} with the cursor positioned inside.
- Environment Auto-Completion: Typing the closing brace on any
\begin{name} automatically generates \end{name} and centers your cursor.
- Piecewise Function Generator: Typing
\begin{cases+} expands a fully formatted piecewise template complete with alignment tabs: &\text{if } a \\ b &\text{else} inside \begin{cases}...\end{cases}.
- MathJax Delimiter Deletion: Pressing
Backspace inside an empty MathJax inline equation \(\) deletes all four characters at once.
- MathJax Jump Navigation: Pressing
Left Arrow or Right Arrow across MathJax delimiters \( or \) steps over both characters simultaneously, preventing your cursor from getting trapped in backslashes.
Examples
Wrap Text:
β’ Highlight formula and press ( β (formula)
β’ Highlight (formula) and press [ β [formula]
β’ Highlight (formula) and press Delete β formula
LaTeX Delimiters:
β’ Type \left( β expands to \left( \right)
β’ Type \left. β expands to \left. \right|_
β’ Type \{ β expands to \{\}
LaTeX Environments:
β’ Type \begin{matrix} β expands to \begin{matrix} \end{matrix}
β’ Type \begin{cases+} β generates a piecewise function skeleton ready for values
Symmetric Deletion:
β’ Cursor inside (|) + Backspace β removes both brackets
β’ Cursor inside \(|\) + Backspace β removes all 4 MathJax characters
Installation & Limitations
β’ Configuration: Ready to use immediately upon installation! :)
β’ Limitations: This add-on is at its best when used directly in the card editor, rather than in the MathJax code pop-up - most features work in the latter case, but cursor placement can be corrupted (ie: the cursor placement on the screen differs from where the MathJax pop-up thinks it is. It's best to, in cases where the add-on attempts to move the cursor, to manually move the cursor to the correct place with the LEFT/RIGHT arrow keys.