はじめての LaTeX

LaTeX の初学者のために

LaTeX 学習

ここでは、Mac での操作を前提にして作業を説明する。LaTeX 自体はユニバーサルなので、どの OS でも同じ挙動をするはずなので、TeX コマンドはそのまま使える。

エディターは TeXShop.app を想定 ( TeXLive パッケージに自動で入っている)。 設定は、 Mac を買ったなら の該当する所を見て欲しい。自分用のメモをウェブページにしただけなので、分かりにくい所は質問を是非してほしい。

簡単な文章を書いてみる。

まず、TeXShop.app を開いて、以下を書いて、コンパイルする。

1\documentclass[dvipdfmx]{jreport} %document format
2\begin{document}
3   
4This is my first tex project.
5ハロー、\LaTeX
6     
7\end{document}

基本的には、\begin{document}\end{document}の間に書きたい文章を書けば、それを出力することができる。

TeX において改行はほとんど意味を持たない (意味を持つ場合が LaTeX に示されている)。 つまり、以下の 2 つは同じ出力となる。

1\documentclass[12pt]{jreport} %document format
2\begin{document}
3   
4This is my first tex project.
5     
6\end{document}
01\documentclass[12pt]{jreport} %document format
02\begin{document}
03   
04This
05is
06my
07first
08tex
09project.
10     
11\end{document}
ただし、空行は新しい段落を生む。以下を試してみるといい。
1\documentclass[12pt]{jreport} %document format
2\begin{document}
3   
4This is my first tex project.
5     
6This is the second paragraph.
7 
8\end{document}
同じパラグラフの中で改行を入れたければ、\\ を書く。
01\documentclass[12pt]{jreport} %document format
02\begin{document}
03   
04This is my first tex project.
05     
06This is the second paragraph.\\
07This is the 2nd line.\\
08This is the 3rd line.
09 
10THis is the third paragraph.
11 
12\end{document}

数式を書いてみる

数式には大きく分けて二種類ある。一つは行内に書くもので、もう一つは、別行に書くものである。以下での\begin{document}\end{document}の中身だけ書く。

1Define a function $f (x)$ as follows:
2\begin{equation}
3  f (x) = a x^2 + b x + c.
4\end{equation}
ここで、$ で囲んだものは、行内に現れる。数式の記号等の基本的なものは、 LaTeX の記号 を参照してほしい。
to the top