TeX

ベローチェにて。

以前購入したTEX本を読みながら、.texファイルを作った。そのときのメモ。

  • 流れ
    • .texファイル作成
		\documentclass{クラスファイル}
		\begin{document}
			本文
		\end{document}
  • 構造
    • 部:part
    • 章:chapter
    • 節:section
    • jsbookクラスファイルを使う
  • コメントは「%」
  • 文字通りに表示させるときは、\begin{verbatim}と\end{verbatim}で囲む
  • 脚注は、\footnote{}を使う
  • 画像は、graphicxパッケージを読み込んで\includegraphics{}を使う
  • 目次は、\tableofcontentsを使う

.texファイルはこんな感じになった。

\documentclass{jsbook}
\usepackage[dvipdfmx]{graphicx}

\begin{document}

\tableofcontents

% \part{部にあたる名前}
% ********************************************************
\chapter{準備}

\section{時間をつくる}

\section{やる気を出す}


% ********************************************************
\chapter{実践}

\section{書いてみる}
Android\footnote{http://developer.android.com/index.html} のHello, Worldはこんな感じ。

\begin{verbatim}
package com.example.hello;

import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;

public class HelloAndroid extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        TextView tv = new TextView(this);
        tv.setText("Hello, Android");
        setContentView(tv);
    }

}
\end{verbatim}

実行すると、下記のように表示される
\includegraphics[width=10cm,bb=0 0 640 480]{hello.png}


% ********************************************************
\chapter{まとめ}

\end{document}