Use Atom to Write Your LaTeX Article in macOS

Use Atom to Write Your LaTeX Article in macOS_第1张图片

I used to use Sublime text 3 to type LaTeX, but in this summer I change it into Atom, a editor developed by Github.

TeX Environment

Like usual, we need to download the TeX package. You can use TeXLive, MacTeX. As I have mentioned before, MacTeX is the Mac version of TeXLive.

“We recommend using the native MacTEX installer instead of the TEXLive installer on Mac OS X, because the native installer makes a few Mac-specific adjustments, in particular to allow easily switching between the various TEX distributions for Mac OS X”
from: http://www.tug.org/mactex/

This is the basic environment.

Atom Environment

Just install the support package:LaTeX and pdf-view, these package can help you compile the LaTeX files and
generate the pdf files.

You can install these package by two ways:

  1. command line mode:
    apm install language-latex

  2. GUI
    If you prefer installation via GUI, you can go to Atom > Settings > Install, search the name in Packages tab and install it.

Use Atom to Write Your LaTeX Article in macOS_第2张图片
Screenshot 2018-10-15 at 00.19.00.png

Remember, if you want to compile Chinese LaTeX in atom. DO NOT CHOOSE pdflatex! Please use xelatex!
Just like this pic:

Use Atom to Write Your LaTeX Article in macOS_第3张图片
Screenshot 2018-10-15 at 00.19.10.png

Use Atom to Write Your LaTeX Article in macOS_第4张图片
Screenshot 2018-10-15 at 00.19.28.png

Also, you can download a package called language-latex this package can help you syntax highlighting and snippets for LaTeX in atom.

Use Atom to Write Your LaTeX Article in macOS_第5张图片
Screenshot 2018-10-15 at 00.38.02.png

%!TEX program = xelatex
\documentclass[11pt]{article}
\usepackage{ctex}
\author {Terence Lau}
\title {LaTeX Files}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{color}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{listings} %插入代码
\usepackage{xcolor} %代码高亮
\lstset{language=r,
  basicstyle=\ttfamily,
  keywordstyle=\color{blue},
  commentstyle=\color{darkgreen},
  stringstyle=\color{red}}
\begin{document}
\maketitle
\date
  \section{LaTeX Files}
   This is the R code:
  \\
  \begin{lstlisting}[language ={R}]
  x <- c(52.0,66.0,44.5,37.7,73.5,37.5,56.7,35.6)
  y <- c(2.35,4.95,3.10,2.50,5.11,3.10,2.90,1.75)
  \end{lstlisting}
  \begin{align*}
     \frac{1}{2} + \frac{1}{2} &= 1 \\
     \frac{2}{4} &= \frac{1}{2}
\end{document}

This is the test code, copy it in atom and press: control + option + b you can compile the .tex file:

Use Atom to Write Your LaTeX Article in macOS_第6张图片
Screenshot 2018-10-15 at 00.56.48.png

If you edit the files, just double click the command + S and you can see the new pdf.

I hope this article can help you. If you have any question or comments, please pull the issue or email me: terencelau#terencelau.xyz (change # to @)

你可能感兴趣的:(Use Atom to Write Your LaTeX Article in macOS)