Day049 — LaTeX on Mac
It is a document of how I set up LaTeX on Mac.
Download LaTeX
Since I am using Mac, I downloaded MacTeX.
I download through torrent, which is much faster than direct download. After having on local disk, double-click the downloaded .pkg file to start installing. The installation process is straightforward and I don’t think there is something to be aware of.
Development setup
what configuration i use on mac
- Install Sublime Text 3
- Install Package Control on Sublime
- Install LaTeXTools from Package Control
- Install Skim
- Sync between Sublime Text and Skim (Perference->Sync tab->set Preset as Sublime Text)
- Open a .tex file (create one if you don’t have) in Sublime
- Press
cmd+B
to build - A pdf preview will be shown
- (Optional) Move Sublime to the left, and pdf view to the right to see both documents at the same time
Everytime you press cmd+B
to build Skim will auto-refresh to show the result.
There is something to be aware of when writing the .tex doc.
\label
has to be put behind \includegraphics
and \caption
.
Wrong:
\begin{document}
\begin{figure}
\label{fig:cats}
\includegraphics[width=\linewidth]{cats.jpg}
\caption{cats.}
\end{figure}
Figure \ref{fig:cats} shows cats.
\end{document}
Warning message will be shown and
Package caption Warning: \label without proper reference on input line 47.
LaTeX Warning: Reference `fig:boat1' on page 4 undefined on input line 52.
LaTeX Warning: There were undefined references.
Correct:
\begin{document}
\begin{figure}
\includegraphics[width=\linewidth]{cats.jpg}
\caption{cats.}
\label{fig:cats}
\end{figure}
Figure \ref{fig:cats} shows cats.
\end{document}
Good tutorial website about latex syntax:
You may use Atom as you text editor. Here is the article writing about it.
reference website: