Giter Site home page Giter Site logo

latex_snippets's Introduction

Latex Snippets for Visual Studio Code

Common snippets to write faster LaTeX

Installing

  • Install the HyperSnips extension.
  • Open the HyperSnips directory (Ctrl + Shift + P, "HyperSnips: Open Snippets Directory") and copy there the file hsnips/latex.hsnips
  • From the VSCode menu (Ctrl + Shift + P) go to "Preferences: Configure User Snippets" and select "latex". Copy there the content of vscode/latex.json
  • Set keybindings with Ctrl + Shift + P, and "Preferences: Open Keyboard Shortcuts (JSON)". Copy there the content of vscode/keybindings.json
  • You may also install the LaTeX Workshop extension, but some snippets may conflict. You can disable the snippets from that extension thanks to another extension: Control Snippets.

Usage

Simply open a .tex file and start typing. All "static" snippets are contained in latex.json, and are expanded by typing their "prefix" and pressing Tab (or Enter, if they appear in the IntelliSense menu). You can navigate between fixed placeholders with Alt + LeftArrow and Alt + RightArrow.

There are also "dynamic" snippets, that automatically expands after typing a certain trigger. For example:

  • mk expands in $ $ . Note that the final space is automatically removed if you type certain characters (e.g. -?:,) after the last $.
  • An alphabetical character repeated two times is automatically converted to the corresponding greek letter: e.g. aa becomes \alpha. This does not conflict with words with repeated letters (e.g. letters) or with other commands (e.g. \ddot).
  • Type M3x3 and a space to obtain a 0-filled 3x3 matrix. Dimensions can be changed dynamically: M2x6 works too. If you type a d instead of the final space, the resulting matrix will have navigable placeholders only on the diagonal.
  • Type dfdx and a space to write a partial derivative. Use a capital D at the start if you want the usual derivative.
  • Vectors can be set by typing a character (or word) followed by ., or ,. (just press the two keys at the same time, as their order does not matter). Similar commands automatically convert strings like p-hat, pbar, Pcal (to \mathcal{P}). For \mathbb{P} use P#.
  • Many more! Look at latex.hsnips for all the implementations.

latex_snippets's People

Contributors

einlar avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.