LoginSignup
40
34

More than 3 years have passed since last update.

LaTeXにおいて体裁を整えるのに便利なパッケージ

Last updated at Posted at 2019-05-08

はじめに

学士・修士・博士論文を$\LaTeX$で書くときに、大学が指定する体裁に合わせる必要があります。
例えば今所属しているテキサス大学オースティン校ではDigital Submission RequirementとしてMS WordおよびLaTeXテンプレートを用意しています。大学側でテンプレートを用意してくれていない場合は、自分で細かく指定する必要がありますので、体裁を整えるのに便利なパッケージを紹介しておきます。
(私の場合は大学の提供するテンプレートが2002年に作成されて古すぎ、かつ修正できないほど複雑な構成だったため、自分で調べて作りました。)

LaTeXパッケージ

余白を調整:geometry

$\LaTeX$ではページの余白を制御する変数を変更することでページの体裁を調整できるようになっています。ただし、論文の体裁を整えるには細かすぎるため、geometryパッケージを使うほうが楽です。

\usepackage{geometry}

% ページの余白を1.25インチにする
\geometry{
    left=1.25truein,
    right=1.25truein,
    top=1.25truein,
    bottom=1.25truein,
}

目次の体裁を調整:tocloft

tocloftパッケージを使うと目次の体裁を簡単に調整できます。

\usepackage{tocloft}

目次のタイトルの体裁を修正

% 目次の表題を、largeサイズ, 太字, 中央寄せに変更
\renewcommand{\cfttoctitlefont}{\hfill\large\bfseries}
\renewcommand{\cftaftertoctitle}{\hfill\null}
% 表題の上下の調整幅をなくす
\renewcommand{\cftbeforetoctitleskip}{0pt}
\renewcommand{\cftaftertoctitleskip}{0pt}

% 表目次の場合も同様
\renewcommand{\cftlottitlefont}{\hfill\large\bfseries}
\renewcommand{\cftafterlottitle}{\hfill\null}
\setlength{\cftbeforelottitleskip}{0pt}
\setlength{\cftafterlottitleskip}{0pt}
% 表番号の前に「Table」をつける
\renewcommand{\cfttabpresnum}{Table }
% 表番号の後に「:」をつける
\renewcommand{\cfttabaftersnum}{:}
% 表見出しのインデント幅
\renewcommand{\cfttabnumwidth}{6em}

% 図目次の場合も同様
\renewcommand{\cftloftitlefont}{\hfill\large\bfseries}
\renewcommand{\cftafterloftitle}{\hfill\null}
\setlength{\cftbeforeloftitleskip}{0pt}
\setlength{\cftafterloftitleskip}{0pt}
\renewcommand{\cftfigpresnum}{Figure }
\renewcommand{\cftfigaftersnum}{:}
\renewcommand{\cftfignumwidth}{6em}

目次の中身の体裁を修正

% 章見出しのフォント
\renewcommand{\cftchapfont}{\normalsize}
% 章ページ番号のフォント
\renewcommand{\cftchappagefont}{\normalsize}
% 章番号の前に「Chapter」を付ける
\renewcommand{\cftchappresnum}{Chapter }
% 章番号の後に「:」を付ける
\renewcommand{\cftchapaftersnum}{:}
% 章見出しのインデント幅
\renewcommand{\cftchapnumwidth}{5em}
% 章見出しからページ番号までを点線でつなぐ
\renewcommand{\cftchapleader}{\cftdotfill{\cftchapdotsep}}
% 点線の点間隔の調整
\renewcommand{\cftchapdotsep}{\cftdotsep}
% 章見出しの上にある余白を調整
\setlength{\cftbeforechapskip}{0pt}

目次に表示される内容を制御:tocbibind

tocbibindを使うと、目次に「目次」、「表目次」などを表示するかどうかを制御することができます。

\usepackage[
    notbib,%「Bibliography」がToC内に表示されないようにする
    notlot,% List of Tables」がToC内に表示されないようにする
    notlof,% List of Figures」がToC内に表示されないようにする
    nottoc %「Contents」がToC内に表示されないようにする
    ]{tocbibind}

見出しの体裁を変更:titlesec

titlesecを使うと、見出しのフォントや位置などを制御できます。

\usepackage{titlesec}

\titleformat{\chapter}% command
    [block]% shape
    {\bfseries\large}% format
    {Chapter \thechapter:}% label
    {0.5em}% sep
    {\centering}% before-code
\titlespacing{\chapter}
    {0pt}% left
    {18pt}% before-sep
    {6pt}% after-sep

\titleformat{\section}% command
    [block]% shape
    {\bfseries\normalsize}% format
    {\thesection}% label
    {0.5em}% sep
    {}% before-code
\titlespacing{\section}
    {0pt}% left
    {18pt}% before-sep
    {6pt}% after-sep

\titleformat{\subsection}% command
    [block]% shape
    {\bfseries\normalsize}% format
    {\thesubsection}% label
    {0.5em}% sep
    {}% before-code
\titlespacing{\subsection}
    {0pt}% left
    {18pt}% before-sep
    {6pt}% after-sep

\titleformat{\subsubsection}% command
    [block]% shape
    {\bfseries\normalsize\slshape}% format
    {\thesubsubsection}% label
    {0.5em}% sep
    {}% before-code
\titlespacing{\subsubsection}
    {0pt}% left
    {18pt}% before-sep
    {6pt}% after-sep    

行間隔:setspace

\usepackage{setspace}

\begin{document}
 % 行間隔をダブルスペースに
\doublespacing
% \singlespacing, \onehalfspacingも可能
\end{document}

リストの体裁を調整:enumitem

\usepackage{enumitem}

% リスト前の文書との余白をなくす
\setlist{nosep}
% レベル1のリストのインデント幅を調整
\setlist[itemize,1]{leftmargin=0.5truein, labelsep=*}
\setlist[enumerate,1]{leftmargin=0.5truein, labelsep=*}
40
34
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
40
34