0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

そのまま使えるLaTeXテンプレート

Last updated at Posted at 2025-10-31

テンプレート全文

まずは、筆者が実際に使用しているLaTeXプリアンブル全文を以下に示す。

\documentclass[fleqn]{jsarticle}

\usepackage[dvipdfmx]{graphicx}
\usepackage{amssymb,amsfonts,amsmath}
\usepackage{geometry}
\usepackage{enumitem}
\usepackage{bm}
\usepackage{booktabs}
\usepackage{float}
\usepackage{wrapfig}
\usepackage{caption,subcaption}
\usepackage{ulem}
\usepackage[super]{cite}
\usepackage[dvipdfmx]{hyperref}
\usepackage{fancybox}
\cornersize{0.1}
\usepackage{mwe}
\usepackage{bxjalipsum}
\usepackage{listings,jvlisting}

\lstset{
  basicstyle={\ttfamily},
  identifierstyle={\small},
  commentstyle={\smallitshape},
  keywordstyle={\small\bfseries},
  ndkeywordstyle={\small},
  stringstyle={\small\ttfamily},
  frame={tb},
  breaklines=true,
  columns=[l]{fullflexible},
  numbers=left,
  xrightmargin=0zw,
  xleftmargin=3zw,
  numberstyle={\scriptsize},
  stepnumber=1,
  numbersep=1zw,
  lineskip=-0.5ex
}

\renewcommand\citeform[1]{[#1]}
\renewcommand{\labelitemi}{}
\newcommand{\circledtext}[1]{\leavevmode\raise0.2ex\hbox{\textcircled{\scriptsize #1}}}
\newcommand{\boldsymbolmath}[1]{{\mbox{\boldmath $#1$}}}

\DeclareCaptionLabelSeparator{enspace}{\enspace}
\captionsetup{
  labelsep=enspace,
  labelformat=simple
}

\hypersetup{
    colorlinks=false,
    linkbordercolor={0.11 0.61 0.94},
    citebordercolor={0.11 0.61 0.94},
    filebordercolor={0.11 0.61 0.94},
    urlbordercolor={0.11 0.61 0.94}
}

\geometry{top=20mm, bottom=20mm, left=20mm, right=20mm}
\bibliographystyle{unsrt}
\setlength{\mathindent}{15mm}
\title{タイトル}
\author{著者\thanks{大学 学部}}
\date{}

\begin{document}
\maketitle
\end{document}

はじめに

本記事では、筆者がLaTeX文書作成で使用しているテンプレートのプリアンブル部分を解説する。各パッケージの役割や設定の意味をコメント付きで紹介する。
対象は日本語環境で、文書クラスにjsarticleを使用し、ドライバとしてdvipdfmxを用いることを想定している。

ドキュメントクラス

\documentclass[fleqn]{jsarticle}

jsarticleは日本語対応の文書クラスである。
オプションfleqnを付けることで数式が左寄せになる。
タイトルページを付けたい場合は、以下のようにする。

\documentclass[titlepage,fleqn]{jsarticle}

基本パッケージの読み込み

\usepackage[dvipdfmx]{graphicx}
\usepackage{amssymb,amsfonts,amsmath}
\usepackage{geometry}
\usepackage{enumitem}
\usepackage{bm}
\usepackage{booktabs}
\usepackage{float}
\usepackage{wrapfig}
\usepackage{caption,subcaption}
\usepackage{ulem}
\usepackage[super]{cite}
\usepackage[dvipdfmx]{hyperref}
\usepackage{fancybox}
\cornersize{0.1}
\usepackage{mwe}
\usepackage{bxjalipsum}
  • graphicx:画像を挿入するための基本パッケージ。dvipdfmx指定でPDF出力に対応。
  • amsmath, amssymb, amsfonts:数式環境を拡張し、美しい数式を出力できる。
  • geometry:余白を調整する。
  • enumitem:箇条書きのスタイルや間隔を細かく設定できる。
  • bm:太字ベクトルや太字の数式記号を出力する。
  • booktabs:表の罫線を美しく整える。
  • float:図表の配置オプションを拡張する。
  • wrapfig:文章の途中に図を回り込ませる。floatの後に読み込む必要がある。
  • caption, subcaption:キャプションの体裁設定と(a)(b)付き図に対応。
  • ulem:下線や打ち消し線などの装飾を追加する。
  • cite:文献番号を上付き表示に変更する。
  • hyperref:ハイパーリンクを有効化し、参照やURLをクリック可能にする。
  • fancybox:角丸枠や影付き枠などの装飾に使用。cornersizeで角の丸みを調整。
  • mwe:テスト用のダミー画像(example-imageなど)を提供する。
  • bxjalipsum:日本語のダミーテキストを出力する。

ソースコード表示の設定

\usepackage{listings,jvlisting}

\lstset{  
  basicstyle={\ttfamily},
  identifierstyle={\small},
  commentstyle={\smallitshape},
  keywordstyle={\small\bfseries},
  ndkeywordstyle={\small},
  stringstyle={\small\ttfamily},
  frame={tb},
  breaklines=true,
  columns=[l]{fullflexible},
  numbers=left,
  xrightmargin=0zw,
  xleftmargin=3zw,
  numberstyle={\scriptsize},
  stepnumber=1,
  numbersep=1zw,
  lineskip=-0.5ex
}

listingsはソースコードを整形して表示するためのパッケージである。
日本語のコメントを含む場合はjvlistingを併用する。
この設定では、左側に行番号を表示し、長い行は自動的に折り返すようにしている。
また、frame={tb}で上下に枠線を付け、xleftmargin=3zwで左マージンを3文字分確保している。

独自コマンドと基本設定

\renewcommand\citeform[1]{[#1]}
\renewcommand{\labelitemi}{}
\newcommand{\circledtext}[1]{\leavevmode\raise0.2ex\hbox{\textcircled{\scriptsize #1}}}
\newcommand{\boldsymbolmath}[1]{{\mbox{\boldmath $#1$}}}

citeformは引用番号の形式を角括弧付き[1]に変更している。
\labelitemiは箇条書きの先頭記号を「・」に変更する設定である。
\circledtext{}は丸囲み文字を出力するためのコマンド、\boldsymbolmath{}は太字の数式表現を作るための補助コマンドである。

キャプションとリンクの設定

\DeclareCaptionLabelSeparator{enspace}{\enspace}
\captionsetup{
  labelsep=enspace,
  labelformat=simple
}

\hypersetup{
    colorlinks=false,
    linkbordercolor={0.11 0.61 0.94},
    citebordercolor={0.11 0.61 0.94},
    filebordercolor={0.11 0.61 0.94},
    urlbordercolor={0.11 0.61 0.94}
}

キャプションでは、ラベルと本文の区切りをコロンではなく半角スペースに設定している。
hyperrefの設定では、リンク部分に色付きの枠線を表示するようにし、リンク文字そのものの色は変えないようにしている。
リンクの境界色は青系のRGB値で指定している。

ページ設定と文書情報

\geometry{top=20mm, bottom=20mm, left=20mm, right=20mm}
\bibliographystyle{unsrt}
\setlength{\mathindent}{15mm}
\title{タイトル}
\author{著者\thanks{大学 学部}}
\date{}

余白は上下左右すべて20mmに設定している。
参考文献のスタイルはunsrtで、引用順に文献を並べる。
数式のインデントは15mmに設定。
\title\author\dateでタイトル・著者・日付を指定する。
\thanksを使うと著者名の脚注として所属などを記述できる。

0
1
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
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?