Giter Site home page Giter Site logo

ac-math's Introduction

NOTE: Ac-math users are encouraged to switch to company-math. company-mode is a better framework and solves a number of notorious issues in auto-complete.


This add-on defines three ac-sources for the auto-complete package:

  • ac-source-latex-commands - input latex commands

  • ac-source-math-latex - input math latex tags (by default, active only in math environments)

    symbols

  • ac-source-math-unicode - input of unicode symbols (by default, active everywhere except math environments)

    math

Start math completion by typing the prefix "" key. Select the completion type RET (ac-complete). Depending on the context the unicode symbol or latex \tag will be inserted.

Activation

You must have auto-complete package installed.

Ac-math is available thorough MELPA repository. You can also download ac-math.el directly and put it into your load-path directory.

This is an example of how to activate the 'ac-math' in latex-mode:

(require 'ac-math) ; This is not needed when you install from MELPA

(add-to-list 'ac-modes 'latex-mode)   ; make auto-complete aware of `latex-mode`

(defun ac-latex-mode-setup ()         ; add ac-sources to default ac-sources
  (setq ac-sources
     (append '(ac-source-math-unicode ac-source-math-latex ac-source-latex-commands)
               ac-sources)))

(add-hook 'TeX-mode-hook 'ac-latex-mode-setup)

If you are using 'flyspell' you might want to activate the workaround:

(ac-flyspell-workaround)

Unicode Input

By default unicode input (ac-source-math-unicode) is not activated in latex math environments. In order to activate it, do

(setq ac-math-unicode-in-math-p t)

Unicode input is not restricted to LaTeX modes and is particularly useful in org-mode (with it's powerful exporting facilities), or web development tools where unicode is crucial.

Suppose you want it for mode XXX:

(add-to-list 'ac-modes 'XXX-mode)

(defun ac-XXX-mode-setup ()
   (add-to-list 'ac-sources 'ac-source-math-unicode))

(add-hook 'XXX-mode-hook 'ac-XXX-mode-setup)

Custom sources

You can use symbols lists to define your own ac sources.

Make math symbol completion work everywhere in LaTeX documents (default, ac-source-math-latex works only in math mode):

(defvar ac-source-math-latex-everywhere
'((candidates . ac-math-symbols-latex)
  (prefix . ac-math-prefix)
  (action . ac-math-action-latex)
  (symbol . "l")))

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.