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 <a href="https://www.tug.org/texlive/">TeXLive</a>, <a href="http://www.tug.org/mactex/">MacTeX</a>. 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:
command line mode:
apm install language-latex
GUI
If you prefer installation via GUI, you can go toAtom
>Settings
>Install
, search the name in Packages tab and install it.
Remember, if you want to compile Chinese LaTeX in atom. DO NOT CHOOSE pdflatex
! Please use xelatex
!
Just like this pic:
Also, you can download a package called language-latex
this package can help you syntax highlighting and snippets for LaTeX in atom.
%!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:
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 @
)