2007年9月11日 星期二

用LaTeX製作考卷

我之前是用Openoffice來製作考卷,但是後來覺得Openoffice對於數學式子的排版能力不是很好,再加上之前寫碩士論文時接觸了LaTeX,所以就想到用LaTeX來製作考卷。

因為我的考卷是用中文出的,一般的LaTeX沒辦法處理,所以我改裝另一套名為texlive的套件。這部分請參考我的另一篇文章:在LaTeX中使用中文

而我用的不是傳統的latex而是pdflatex,因為latex只能吃eps圖檔而pdflatex能夠接受jpg和pdf檔。
以下兩個檔案是我用來寫考卷和解答的樣板。

至於LaTeX的詳細教學,請參考下列網站:
  1. cwTeX 排版系統
  2. 大家來學LaTeX
  3. 果正札記



% ==================================================
% This is my templet of quiz with CJKutf8.
% version 1.0
% Yi-Zhe Wang      Sep. 11, 2007
% ==================================================
\documentclass[12pt, b5paper]{article}
\usepackage{CJKutf8}                    % For utf8 Chinese characters
\usepackage[unicode,pdftex,colorlinks=true,linkcolor=blue]{hyperref}
\usepackage{graphicx}                   % For including pictures

\usepackage{amsmath}                    % For ams math
\usepackage{amsthm}                     % For
\theoremstyle{definition}               % plain, definition, remark
\newtheorem{thm}{}                      % For problem
\renewcommand{\proofname}{Solution}     % For solution

\usepackage{txfonts}                    % Public Times New Roman text & math font
\usepackage{color}                      % For multi-color
\usepackage[body={6.0in, 8.6in},left=0.5in,right=0.5in]{geometry}
                                        % For page margin setting
\usepackage{multicol}                   % For multicols environment
\usepackage{lscape}                     % Landscape package
\usepackage{epic}                       % For drawing plots

% ==================================================
% Figure setting
% ==================================================
\renewcommand{\textfraction}{0.15}
\renewcommand{\topfraction}{0.85}
\renewcommand{\bottomfraction}{0.65}
\renewcommand{\floatpagefraction}{0.60}

% ==================================================
% Document
% ==================================================
\begin{document}
%\begin{CJK}{UTF8}{song}  %baseline
%\begin{CJK}{UTF8}{cwfsu} %baseline
%\begin{CJK}{UTF8}{cwhbu} %baseline
%\begin{CJK}{UTF8}{cwku}  %baseline
\begin{CJK}{UTF8}{cwmu}   %center
%\begin{CJK}{UTF8}{cwyu}  %baseline

% ==================================================
%Title of quiz
% ==================================================
\begin{center}
\begin{large}
國立中和高級中學~~~高二物理小考~~~範圍:\\[5mm]
\end{large}
班級:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
姓名:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
座號:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\\
\end{center}
\vspace*{-0.5cm}
\unitlength=1mm
\begin{picture}(160, 0)
\line(1, 0){152}
\end{picture}

% ==================================================
% Contents
% ==================================================
%題目放在thm中
\begin{thm}
\end{thm}
\vspace*{5cm} %作答區

%小題
   \begin{description}\itemsep=-2pt
   \item[(1)]%內容
   \item[(2)]
   \item[(3)]
   \item[(4)]
   \end{description}

\begin{figure}[hbtp]
\begin{flushright}
   \unitlength1.0cm
%   \resizebox{.3\textwidth}{!}{\includegraphics[angle = 0]{../../templet_fig/}}
%   \caption{}
%   \label{fig:}
\end{flushright}
\end{figure}

\end{CJK}
\end{document}



% ==================================================
% This is my templet of answer with CJKutf8.
% version 1.0
% Yi-Zhe Wang      Sep. 11, 2007
% ==================================================
\documentclass[12pt, a4paper]{article}
\usepackage{CJKutf8}                    % For utf8 Chinese characters
\usepackage[unicode,pdftex,colorlinks=true,linkcolor=blue]{hyperref}
\usepackage{graphicx}                   % For including pictures

\usepackage{amsmath}                    % For ams math
\usepackage{amsthm}                     % For example
\theoremstyle{definition}               % plain, definition, remark
\newtheorem{thm}{Example}               %
\renewcommand{\proofname}{Solution}     % For solution

\usepackage{txfonts}                    % Public Times New Roman text & math font
\usepackage{color}                      % For multi-color
\usepackage{fancyhdr}                   % Fancy Header and Footer
\usepackage[body={6.0in, 8.6in},left=1.05in,right=1.05in]{geometry}
                                        % For page margin setting
\usepackage{multicol}                   % For multicols environment
\usepackage{longtable,booktabs}         % For table of 640 pins
\usepackage{lscape}                     % Landscape package
\usepackage{url}                        % For url
\def\UrlFont{\rm}                       % Use rm type for url

% ==================================================
% Figure setting
% ==================================================
\renewcommand{\textfraction}{0.15}
\renewcommand{\topfraction}{0.85}
\renewcommand{\bottomfraction}{0.65}
\renewcommand{\floatpagefraction}{0.60}

% ==================================================
% Document
% ==================================================
\begin{document}
%\begin{CJK}{UTF8}{song}  %baseline
%\begin{CJK}{UTF8}{cwfsu} %baseline
%\begin{CJK}{UTF8}{cwhbu} %baseline
%\begin{CJK}{UTF8}{cwku}  %baseline
\begin{CJK}{UTF8}{cwmu}   %center
%\begin{CJK}{UTF8}{cwyu}  %baseline

% ==================================================
% Contents
% ==================================================
\begin{center}
\large%Title of answer
\end{center}

\flushleft{\textbf{1.}}

\textbf{2.}

\textbf{3.}

\textbf{4.}

\textbf{5.}

%有小題
   \begin{description}\itemsep=-2pt
   \item[A]%內容
   \item[B]
   \item[C]
   \item[D]
   \item[E]
   \end{description}

\begin{figure}[hbtp]
\begin{flushright}
   \unitlength1.0cm
%   \resizebox{.3\textwidth}{!}{\includegraphics[angle = 0]{../../templet_fig/}}
%   \caption{}
%   \label{fig:}
\end{flushright}
\end{figure}

\end{CJK}
\end{document}




1 則留言:

  1. 在網上尋找 exam template,看到你的部落格,latex 如果有樣板,內容就很容易產生,謝謝你的分享。

    版主回覆:(01/01/1970 12:00:00 AM)


    感謝您的留言,希望這篇文章對您有幫助。

    回覆刪除