Writing (latex) in Atom
Posted 23.05.2015 · 2 min readThese days I am writing my master thesis, which I will deliver in June. It is not easy to produce content all days, so when you have one of those days where the words are hiding it is easy to do something else. Well, yesterday I customized Atom to get a better writing environment for writing latex. Besides, a few of the tweaks is appropriate for general writing in Atom.
First thing first, there are some great packages that should be installed.
language-latex
gives syntax highlighting. make-runner
is great if
you use make to build the document. linter-chktex
checks the syntax of
your latex document.
apm install language-latex make-runner linter-chktex
Secondly, lets make the writing environment more clean with some less styling.
I put the snippet below in my ~/.atom/styles.less
in order to hide the
line-number gutter and to center the text in the editor.
atom-text-editor { &[data-grammar~=latex]::shadow { .gutter-container { display: none !important; }
.lines { min-width: 700px; max-width: 700px; margin-left: auto; margin-right: auto; } }}
Furthermore, I did not want the file treeview to show while editing latex files.
The coffescript below makes sure that the treeview is detached whenever I open
a .tex
-file. It should go in ~/.atom/init.coffee
.
path = require 'path'
atom.workspaceView.eachEditorView (editorView) -> editor = editorView.getEditor() if path.extname(editor.getPath()) is '.tex' try if atom.workspace.panelContainers.left.panels.length atom.workspace.panelContainers.left.panels[0].item.detach() catch e console.log e
Then, it would be great to utilize the Atom's own spell-check. To enable it on
latex files just add text.tex.latex
to the grammars field in the settings of
the spell-check packages.
At last, I have some editor settings for latex files. The snippet below should
be in ~/.atom/config.cson
.
".latex": editor: softWrap: true softWrapAtPreferredLineLength: true preferredLineLength: 80 fontSize: 28