余白の書きなぐり

aueweのブログ

大学のレポート問題演習用のLaTeXプリアンブル

f:id:auewe:20130616125436p:plain


\subsectionが問1,問2 になり、 \subsubsectionが(1),(2) になる。 問2の3番目の式には (2.3) のようなタグが付く。 画像の挿入方法には色々宗派があるみたいなので、今回はあえて設定しなかった。 本名や学生証番号はタイトルの下で \flushright 等の環境を使えばいいと思う。

\documentclass[a4paper]{jarticle} 
\usepackage{amsmath}
\topmargin = 0mm
\oddsidemargin = 5mm
\textwidth = 152mm
\textheight = 240mm

% サブセクションを 問1,問2 にする設定
\renewcommand{\thesubsection}{\arabic{subsection}}

% サブサブセクションを (1),(2)にする設定
\renewcommand{\thesubsubsection}{(\arabic{subsubsection})}
% (i),(ii)なら \arabic を \roman に変える。    (a),(b)なら \alph

% 大問2の3番目の計算式のラベルを (2.3) にする設定
% 計算式の参照には \eqref{eq:hoge} を使う
\makeatletter
  \renewcommand{\theequation}{\arabic{subsection}.\arabic{equation}}
  \@addtoreset{equation}{subsection}
\makeatother

% --------------------------------------------------------------------
\begin{document}

% タイトル
\begin{center}
\textbf{\huge{レポート課題}}
\end{center}

% --------------------------------------------------------------------
% 問1
\subsection{サブセクションは大問に対応する}

\subsubsection{}

ここは問1の(1)。
サブサブセクションは小問に対応。

\subsubsection{}

ここは問1の(2)。

% --------------------------------------------------------------------
% 問2
\subsection{計算式のラベルと参照について}

\subsubsection{}

ここは問2の(1)。
簡単な計算
\begin{align}
a &= b \notag \\
c &= d \label{eq:hoge} %これは問2の最初の計算式なので (2.1) となる
\end{align}

\subsubsection{}

ここは問2の(2)。
計算式を参照する。
\eqref{eq:hoge}は(2.1)みたいになる。

\end{document}