Latexで論文/レポートを書いた際に調べたメモと、全体のフォーマットをのせます。
環境
- latex(texliveパッケージ)
- Ubuntu 18.04LTS & Windows10
全体フォーマット
tex/pdf/imageなどのファイルは以下に置いてあります。
https://github.com/manabu-kusanagi/tex_tip/tree/master/tex_format_report
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\documentclass[11pt,a4j]{jreport} | |
\title{レポートフォーマットについて} | |
\author{マク} | |
\date{2019 /8/13} | |
\usepackage{booktabs} | |
\usepackage[dvipdfmx,hiresbb]{graphicx} | |
%\pagestyle{empty} | |
\renewcommand{\bibname}{参考文献} % [thebibliography] 関連図書 ==> 参考文献 | |
% 数式番号にsectionを付加 | |
\makeatletter | |
\@addtoreset{equation}{section} | |
\def\theequation{\thesection.\arabic{equation}} | |
\makeatother | |
\begin{document} | |
% 目次 | |
{\makeatletter | |
\let\ps@jpl@in\ps@empty | |
\makeatother | |
\pagestyle{empty} | |
\tableofcontents | |
\clearpage} | |
% Chapter1 | |
\setcounter{page}{1} % 本文からページ番号を振りはじめる | |
\pagestyle{plain} | |
\chapter{序論} | |
章テスト\cite{bunshun} | |
\begin{figure}[htbp] | |
\centering | |
\includegraphics[width=14cm,clip]{image/TOMS526509_TP_V.jpg} | |
\caption{猫の画像\cite{cat-src}} | |
\label{cat} | |
\end{figure} | |
\begin{table}[htb] | |
\begin{center} | |
\caption{各商品の値段と個数} | |
\begin{tabular}{lcc} \toprule | |
商品名 & 個数/個 & 値段/円 \\ \midrule | |
バナナ & 3 & 300 \\ | |
梨 & 4 & 500 \\ \bottomrule | |
\end{tabular} | |
\label{shop} | |
\end{center} | |
\end{table} | |
% 節 | |
\section{節} | |
節テスト(図\ref{cat}.参照) | |
% 項 | |
\subsection{項} | |
項テスト | |
% Chapter2 | |
\chapter{結論} | |
\section{結論} | |
\section{今後の展望} | |
% 参考文献 | |
\begin{thebibliography}{99} | |
\bibitem{bunshun}イアン・エアーズ.その数学が戦略を決める.文春文庫 | |
\bibitem{cat-src}"身構えてもかわいい子猫".無料の写真素材はフリー素材のぱたくそ.https://www.pakutaso.com/20190618179post-21118.html | |
\end{thebibliography} | |
% 謝辞 | |
\chapter*{謝辞} | |
\end{document} |
目次
本文からページ番号をふる
何もしないと目次からページ番号が振られてしまうため、上記の目次の後、本文の始まる前に次の文を挿入します。
章、節の構成
章構成は「章>節>項」とするため、
- chapter
- section
- subsection
の順で構成。
図、表
事前準備(TexLive/win32版の場合、必要なし)
表の横罫線を使用するため、bookbabsスタイルをインストールします。
‘ただし、TexLiveをwin32でインストールしてある場合は初期から入っているため事前準備はとばします’
- パッケージをctanからダウンロードしてzipファイルを解答
- .styファイルを生成してインストール
- 一覧表(ls-Rファイル)の更新
図
図の挿入。
\label{cat}のようにcatとつけたラベルを使って次のように図番号を参照できます。
表
今回は論文の表として良く使用される横罫線を使うことにしたためbooktabsパッケージを使用します。
- まず表の挿入の前に、\begin{document}より前で次のようにパッケージ宣言をします。
- 終わったら任意の場所に表を挿入。
事前準備でbooktabsがうまくインストールされていればちゃんと出力されるはずです。
章毎に数式番号
章ごとに数式番号をふります
これにより挿入した数式の右に表示される数式番号が
(章番号.節番号.数式番号)
となります。
参考文献
thebibliographyを使って参考文献の章を作ります。
- デフォルトだとthebibliographyの項は関連図書と表示されてしまうため、ファイル頭に次の文を入れて参考文献と表示させる。
- 参考文献の書き方。
- このように\bibitem{bunshun}として{}内に入れたタグを使うと、次のようにして、文中の任意の場所から参考文献番号を参照できます。
コメント