Installation of LaTeX and TeXShop on a MAC

Last Edited: Apr 8, 2022

WARNING: YOU NEED AT LEAST 8GB FREE SPACE BEFORE DOWNLOADING.

WARNING: MAKE SURE YOUR MAC IS CONNECTED TO THE POWER LINE OR FULLY CHARGED.

Download the following files: Perform the following steps: (in this order):
  1. Make sure you have enough space on your drive, at least 8GB at this moment (after downloading everything).
  2. Click mactex-20210328.pkg to install it. It may take more than 10 minutes. At the last phase, installation of Command Line Developer Tools may be propsed and it is suggested to install them. It includes many unix commands to be used mainly in CLI.
  3. Move TeXShop to your application folder.
  4. Execute TeXShop, choose 'Preference ( 環境設定)'.
    1. In the 'Source (書類)' tab, there is 'Set Default Values ( 設定プロファイル)' at the left bottom. Choose 'pTeX (ptex2pdf)'.
    2. In the middle right side, there is 'Encoding (エンコーディング)' setting. Make sure it has been set as 'Unicode (UTF-8)'.
    3. In the 'Engine (内部設定)' tab, make sure '(pdf)TeX' field at the top is set as '/Library/TeX/texbin' (it was '/usr/texbin' in MacTeX-2015).
    4. Make sure that 'Latex' field under 'TeX+dvips+distiller' (located in the center left). is as follows:
      ptex2pdf -l -ot "-synctex=1 -file-line-error"
    5. Make sure if the 'BibTeX Engine/(BibTeX エンジン)' is set as 'pbibtex'.
  5. Click 'OK' to save the configuration.
  6. Then 'Quit TeXShop/(TeXShop を終了)' once to complete your configuration.

Invoke TeXShop, type in the following text:
 
\documentclass[a4j]{jarticle}
\begin{document}
\section{Introduction}
Hello World.
\end{document}
 

Oops, if you happen to use Japanese keyboard, you can input a \ by Option+¥.

Save it with a file name such as "sample.tex", then click "typeset" button. TeXShop executes LaTeX and generates "sample.dvi" file. If no error happens, it continues to create a PDF file "sample.pdf" and displays the generated PDF file. If you are able to input Japanese characters, add some Japanese words before the line of \end{document}. Save the file and click the "Typeset" button again to see what happens.

Note that multiple spaces in LaTeX are usually intepreted as a single space, and paragraphs are separated by blank lines. A comment starts with % and continues to the end of line. This is very convenient to leave your memo on the text which is not published in the document. However, you should be careful when you write something like

 
in the analysis, 45% of the users felt ...
 
All characters after % are ignored. In this case, you should write as
 
in the analysis, 45\% of the users felt ...
When you emphasize a word by a doublequote, you specify two backquotes as well as two apostrophies:
 
In order to ``emphasize'' a word
Some other special characters may have special meaning, and you prepend a \ to each of such characters in the text. Please refer the LaTeX documentation.

Before start using TeXShop, creating a new directory is highly recommended as TeX system generates several control/log files there. You can also split the text intro several files, and main tex file can include the definitions (such as \documentclass and \begin{document}) as well as inclusion directives of other files (such as \input{intro.tex}). Note: all of TeX files should have suffix of ".tex".

When you create a file to be included by the main file, you should specify the main file by Macro->Root for each new file. The TeXShop always starts with the main file when you click "Typeset" button (you don't have to search main file window).


When you start writing your thesis, it is recommended to use a TeX Macro Files maintained by Masato Yamanouchi, Daisuke Uriu, and others. Please check the following URL:

KMD Thesis Template maintained by Dr. Charith Fernando

If you are going to write a thesis in Science and Engineering style, I'd suggest to comment out the following lines at the end of each TeX file:

\section*{注}
\addcontentsline{toc}{section}{注}
\begin{footnotesize}
\theendnotes
\end{footnotesize}

If you are going to write in Japanese Science and Engineering style thesis, you may want to replace

\bibliographystyle{acm-sigchi}
at the end part of document.tex with the followings:
%\bibliographystyle{acm-sigchi}
\bibliographystyle{junsrt}
and move
%
% 謝辞
%
\acknowledgements

本研究の指導教員であり、
...
to after a line
%\input{conclusion.tex}

Make sure you periodically (daily) backup all of your files to an USB memory - don't override the old files as long as the remaining capacity allows. According to Murphy's Law, closer the deadline, higher the disk crash possibility. It is also vital to keep the USB memories to a secure place if they contain confidential information. If you have a remote server accessible via ssh, it is suggested to use remote version management tools such as cvs, svn, or git.


In your thesis, every figure and table is required to be referred in the main text, such as "As shown in Figure 2.12". Use \label{label-name} to define a label associated with a figure or a table, then use \ref{label-name} to refer it.

In some cases, you may want to add a citation to the caption such as

 
\begin{figure}[hbt]
\begin{center}
\includegraphics[width=10cm]{figs/sample-figure.eps}
\end{center}
\label{fig:sample-figure}
\caption{Sample Figure~\cite{sample-figure}}
\end{figure}
 
This is good, however, the citation marks such as [12] appear on the "List of Figures" page, which should be avoided. In this case, you can specify an alternate caption by using [ ] such as
 
\caption[Sample Figure]{Sample Figure~\cite{sample-figure}}
 
This is convenient as well when the caption is too long; you can specify an abbrevation version in [ ] to make the list of figure page more beautiful.
In TeX, it is possible to divide your thesis into several files (for example, a separate file for a chapter). But you may need to click the "Typeset" button of the top level file rather than the button of the file under editing in TeXshop. This is a little bit troublesome. You specify the root file once for every non-root file by "macro" -> "root"; then specify the top level file such as "thesis.tex" or "document.tex". It will add a line
 
% !TEX root = thesis.tex
 
at the top of the file. Now you can click "Typeset" to run LaTeX of the file under editing without seeking the top level file window.
Please keep in mind that you may need to run LaTeX (click the "Typeset" button) TWICE. The first run generates ".aux" file to record the chapter/section/subsection numbers, labels, caption of figures, etc. The output PDF file at this stage may include the following:
 
it is illustrated in Figure ??.
 
In this case, you may notify something like followings in the console window:
 
LaTeX warning: Reference `sample-figure' on page 8 undefined on input line 48.
...
LaTeX Warning: There were undefined references.
LaTeX Warning: Label(s) may have changed. Rerun to get cross-references right.
 
In the second run, LaTeX refers the ".aux" file generated in the previous run to resolve the references to generate correct output such as
 
it is illustrated in Figure 2.11.
 
The full course execution of LaTeX would be:
"Typeset LaTeX", "Typeset BibTeX", "Typeset LaTeX", then "Typeset LaTeX".
You should execute this process before submission of your document.
It is essential to browse .log file to make sure
In LaTeX, you may specify more than one bibliography files such as
 
\bibliography{project.bib,rfc.bib,my.bib}
 

When you are to share a project bib file with your colleagues, entry name convention is important to avoid confusion and conflict.

When you need a bibliography file for RFC (Request for Comments), there are many automatically generated ones available. One of them is rfc.bib.gz maintained by Dr. -Ing. Roland Bless from Karlsruhe Institute of Technology.