How To Activate Spell Check In Latex For Mac



Highlights misspelling in Atom and shows possible corrections.

I have an NSTextField that I would like to enable 'as-you-type' spell checking. When I load my application I can do this from the Menu Bar Edit Spelling and Grammar Check Spelling While Typing. I would like this option to be enabled by default.

  1. Spell check using aspell Close the editor for the file, otherwise the file cannot be updated. Type aspell -mode=tex -c filename in the terminal — so in this example type aspell -mode=tex -c check.tex. The programme will show the typos one by one.
  2. Spell-checking and Word Counting. If you want to spell-check your document, you can use the command-line aspell, hunspell (preferably), or ispell programs. Ispell yourfile.tex aspell -mode=tex -c yourfile.tex hunspell -l -t -i utf-8 yourfile.tex All three understand LaTeX and will skip LaTeX commands.

Use cmd-shift-: for Mac or ctrl-shift-: for Windows or Linux to bring up the list of corrections when your cursor is on a misspelled word.

By default spell check is enabled for the following files:

  • Plain Text
  • GitHub Markdown
  • Git Commit Message
  • AsciiDoc
  • reStructuredText

You can override this from the Spell Check settings in the Settings View (cmd-,). The Grammars config option is a list of scopes for which the package will check for spelling errors.

To enable Spell Check for your current file type: put your cursor in the file, open the Command Palette(cmd-shift-p for Mac or ctrl-shift-p for Windows or Linux), and run the Editor: Log Cursor Scope command. This will trigger a notification which will contain a list of scopes. The first scope that's listed is the one you should add to the list of scopes in the settings for the Spell Check package. Here are some examples: source.coffee, text.plain, text.html.basic.

Changing the dictionary

Except for Mac, Atom needs to know what language to use to perform spell-checking. To list these, set the 'Locales' configuration option to the IETF tag (en-US, fr-FR, etc). More than one language can be used, simply separate them by commas.

If no locale is given, then Atom will attempt to infer the language based on environment variables and settings.

If any value is given for the 'Locales', then Atom will not automatically add the browser language. So, if your browser is United States English (en-US), leaving this blank will still do US English checking. However, if it the 'Locales' is set to French (fr-FR), then the checker will only check French. If the 'Locales' is set to en-US, fr-FR, then both languages will be checked.

Missing Languages

This plugin uses the existing system dictionaries. If a locale is selected that is not installed, a warning will pop up when a document that would be spell-checked is loaded. To disable this, either remove the incorrect language from the 'Locales' configuration or clear the check on 'Use Locales' to disable it entirely.

To get the search paths used to look for a dictionary, make sure the 'Notices Mode' is set to 'console' or 'both', then reload Atom. The developer's console will have the directory list.

Mac

On the Mac, checking 'Use System' will use the operating system's spellchecking library. This uses all of the user's loaded dictionaries and doesn't require any customization within Atom.

Checking 'Use Locales' and providing locales would use Hunspell as additional dictionaries. Having 'Use Locales' checked but no locales given will do nothing.

Windows 8 and Higher

For Windows 8 and 10, this package uses the Windows spell checker, so you must install the language using the regional settings before the language can be chosen inside Atom.

If your Windows user does not have Administration privileges, you'll need to do an extra step once the language has been added to enable the spell checker. To do so, you need to install the 'Basic typing' language option by following the next steps (you'll be asked for your administrator password):

Once the additional language is added, Atom will need to be restarted and configured to use it. Add the IEFT tag into the 'Locales' setting for the language to be set.

If a Hunspell dictionary is found on a path (see below), it will be used in favor of the Windows API.

Linux

For all Linux-based operating systems, 'Use System' does nothing. It can remained checked but has no impact. 'Use Locales' is required for spell-checking.

How To Activate Spell Check In Latex For Mac Osx

Debian, Ubuntu, and Mint

On Ubuntu, installing 'Language Support' may solve problems with the dictionaries. For other distributions (or if Language Support doesn't work), you may use apt to install the dictionaries.

On RedHat, the following should work for Italian:

You can get a list of currently installed languages with:

Atom may require a restart to pick up newly installed dictionaries.

Arch Linux

A language may be installed by running:

For the time being, a soft link may be required if the dictionary provided is 'large'.

Hunspell Dictionaries

For all platforms, a Hunspell-compatible dictionary is also supported. To use this, a .dic and .aff need to be located in one of the default search directories or in a directory entered into 'Locale paths' (multiples may be entered with commas separating them). If the appropriate files are found for the locale and 'Use Locales' is checked, then the dictionary will be used.

For example, if the following is set, then /usr/share/hunspell/en_US.dic will be used:

  • Use Locales: checked
  • Locales: en-US
  • Locale Paths: /usr/share/hunspell

If 'Locales' is not provided, then the user's current language will be inferred from environmental settings.

In addition to what is provided, the following paths are checked:

  • /usr/share/hunspell (Linux only)
  • /usr/share/myspell (Linux only)
  • /usr/share/myspell/dicts (Linux only)
  • / (Mac only)
  • /System/Library/Spelling (Mac only)
  • C: (Windows only)

Dictionaries can be downloaded from various sites (such as wooorm's repository or LibreOffice's), but the file has to be renamed locale.dic and locale.aff.

Example locations to download are not an endorsement.

It’s been a while since I updated my series on Atom + <something>, but here comes a good one: how to set up Atom as a LaTeX editor.When I first migrated to Atom, I found that LaTeX support was a bit subpar, at least when compared to Sublime’s.However, I’ve tried lots of packages and configurations, and I believe the combination described below makes Atom a solid LaTeX editor.

I’m assuming you already have Atom up and running.If you haven’t, go to https://atom.io/ to download and install it.

Atom, like other text editors, works in such a way that it provides a lean, solid foundation to build on top of.This means that it doesn’t come with LaTeX support out-of-the-box, which has to be added by us, in the form of packages.Each package (typically) adds one additional feature: syntax highlighting, compiling, PDF preview, etc.The good news is that it is very easy to add these, and while there are several options for each feature, I’ve tested (almost?) all of them.

Installing a package

Latex

In what follows we will install several packages.To find and download a package within Atom, go to the Settings View with Ctrl+Comma (or under Edit > Preferences).Look for the Install tab in the left, and in there just search for the package in question (wording has to be exact to get the intended package as first result).

The first thing we’ll want to do is to have syntax highlighting for .tex files.If you open a LaTeX document right now, it should look like plain text, ie. the left panel in the image below.We want to have something like the right panel.

We’ll use language-latex, which works great out of the box.To install it, open the Settings View with Ctrl+Comma and in the Install tab look for language-latex.It should start working right away.If it doesn’t, double check that the document you have open is recognized as a LaTeX file (it should say ‘Latex’ on the bottom right corner).You can also explicitly set a language for any open document with Ctrl+Shift+l (or Cmd+Shift+l on a Mac).

How To Activate Spell Check In Latex For Mac Download

Writing LaTeX is slightly different from normal coding, so for this specific language I like to turn on soft wrapping.To do so, just go to the Settings View with Ctrl+Comma and in the ‘Packages’ tab look for our newly installed package, language-latex.Open its settings and make sure the ‘Soft Wrap’ option is checked.

Soft wrap and other tweaks

WTF is soft wrap?, you may ask.Soft wrap basically breaks very long lines into multiple ones, without actually inserting a real line break.Since in LaTeX you’re basically writing text, lines tend to be longer than your average Python statement, so if you want to avoid vertical scrolling this is what’s best.A stolen GIF is worth a thousand images:

I also like to be able to scroll past the end of the document, so I’m not permanently focusing on the very bottom of the screen.This feature can be activated for LaTeX in the language-latex configuration page, but I actually like this feature for all my documents, so if you also prefer that, you have to check the option in the in the ‘Editor’ tab of the general Settings View.

So here is where you have most options, but after some testing I’ve decided that the latex package is what works best (for me).After installing, it should work out of the box if you’ve installed TeXLive (or MacTeX in Mac) or MiKTeX (although I tend to avoid MiKTeX, and it is also less tested with this package).

To test it out, you can create a new file like test.tex with something like

The easiest way to compile (build) is by using Ctrl+Shift+B.If no errors are found, it should automatically open the resulting PDF in your system’s default PDF viewer (more on that below).We will also tweak some settings after installing pdf-view (below).

After a successful build, the latex package should automatically invoke your default PDF viewer for preview in a separate window.In some situations this is fine, but when I want a preview I usually prefer it side by side inside the editor itself.This behavior can be easily achieved by installing the pdf-view package.

If it doesn’t work for you after installing, go to latex package settings and be sure to select pdf-view as Opener.You can find these settings by opening the ‘Settings View’ with Ctrl+Comma and then selecting the ‘Packages’ tab on the left.Look for the latex package and click on the ‘Settings’ button.The ‘Opener’ option is near the end.

Now that you have the latex settings open, I would also recommend to check the Enable SyncTeX option.Take this opportunity to further customize the settings.For instance, you can build on each save, change the default logging levels (I would advice against changing the default though) and enable shell escape, if you need to do so.

How To Activate Spell Check

Spell check

How

Finally, since my native language is not english, I usually prefer to write documents with a spell checker.Unfortunately, spell check is one of the most poorly developed LaTeX tools in Atom.For the time being I went with the basic spell-check, which comes by default with Atom.Make sure the package is installed (it should) and enabled.Then go to the package’s settings and add text.tex.latex at the end of the list of Grammars, like in the bottom right of the screenshot below.

After doing this, you should get spell checking in your LaTeX document.However, something that annoyed me is that you also get corrections for obviously-LaTeXy commands, like documentclass.I discovered you can exclude certain parts of the document with the ‘Exlude Scopes’ option, and I added these scopes to that list.You can add each scope in spell-check settings as comma separated names, or you can paste the following code directly in your config.cson file (Edit > Config...):