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

La​Te​XSmart​Quotes

by r-stein ST3

A Sublime Text Package to insert the quotes in a smart way

Labels latex

Details

Installs

  • Total 2K
  • Win 769
  • OS X 620
  • Linux 385
Jun 25 Jun 24 Jun 23 Jun 22 Jun 21 Jun 20 Jun 19 Jun 18 Jun 17 Jun 16 Jun 15 Jun 14 Jun 13 Jun 12 Jun 11 Jun 10 Jun 9 Jun 8 Jun 7 Jun 6 Jun 5 Jun 4 Jun 3 Jun 2 Jun 1 May 31 May 30 May 29 May 28 May 27 May 26 May 25 May 24 May 23 May 22 May 21 May 20 May 19 May 18 May 17 May 16 May 15 May 14 May 13 May 12 May 11
Windows 0 0 3 2 8 1 1 3 0 0 4 2 2 1 0 0 0 0 0 1 4 3 1 1 1 1 0 1 0 1 1 1 0 5 3 3 0 1 2 0 4 1 0 0 3 1
OS X 0 2 2 1 3 1 0 1 1 0 0 0 2 0 0 0 1 0 1 0 1 0 0 0 1 0 1 0 0 1 1 1 2 0 0 0 2 1 2 0 0 0 0 1 2 2
Linux 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 1 1 3 1 0 1 0 2 0 0 0 1 0 0 2 0 3 0 1 0 0 1 0 0 0 0 0

Readme

Source
raw.​githubusercontent.​com

LaTeX Smart Quotes

The purpose of this Sublime Text Package is to make the quotes in LaTeX “smart”, i.e. insert the quotes you intend to use. It is inspired by the typopunct-mode for Emacs.

To establish this goal it uses:

  • language detection (supported languages: English, German, French)
  • context detection according to the caret position

Usage

Usually you do not have to do anything special and just use LaTeX as always. If you type " or ' this Package will try to extract the language of the document and insert the correct quotation marks.

The language detection is executed the first time you press " or ' and the result will be cached. If you want to rerun it open the command palette (ctrl+shift+p) and insert LaTeX SmartQuotes: Auto Detect Buffer Language, the result will be displayed in the status bar at the bottom. If the detected language is incorrect or you use a multilingual document, you can change the language by executing the command LaTeX SmartQuotes: Set Buffer Language in the command palette. This command will provide you a list with all available languages. If the language ends with -ucs it will use unicode characters.

Hints

  • You can use ctrl+l " or ctrl+l ' (respectively super+l " or super+l ' on OSX) to insert the usual quotation marks instead of the LaTeX and language specific. If you want to disable the special quotes (e.g. in a lstlisting environment), you can set the buffer language to “None”.

  • If you use unicode characters you should have \usepackage[utf8]{inputenc} at the start of your document.

  • The language detection checks for specific packages, hence it does not always work correctly. Nevertheless it should always work with the babel package.

  • To disable the automatic language detection and define a language, which should always be used, you can define it in your user settings. For example you can add "latex_smart_quotes_current_language": "german-ucs" to always use german with unicode support. You might want to do this if you only use one language anyway.
    If you are a native english speaker you might want to add "latex_smart_quotes_current_language": "english" to your settings file.

Options

Options are set in the package settings file, which is as usual available in the menu Prefences>Package Settings>LaTeXSmartQuotes>Settings - User.

  • latex_smart_quotes_default_language The default language, which is used if no language has been detected
  • latex_smart_quotes_use_ucs enables unicode support, i.e. unicode quotations instead of ascii characters

Demonstration

This demonstrates the context detection, i.e. the choice of opening and closing quotes.

LaTeXSmartQuotes context detection

This demo shows some available quotes. The quote types are chosen automatically by the language detection of this package.

LaTeXSmartQuotes all quotes

Issues

If something does not work as you expected or you want support of an additional language, then you can create a pull request or an issue on github. In the case you don't own a github account you can also write in email to r-stein.github@web.de.