我想感谢那些编辑我的问题的人,以及那些回答了上一篇文章的人。我正在尝试写一本具有以下主要特点的书
exam
问题以班级格式列出,并带有question
编号,part
以及subpart
- 问题、问题部分和子部分应标明分数或点数以及整个问题的总分,例如
\addtotalpoints
在考试类别中 - 排版时把解答写在问题后面,但出现在书的最后。
代码:
\documentclass[12pt,fleqn]{book}
\usepackage{exsheets}
\SetupExSheets{
counter-format=ch.qu,counter-within=chapter
}
\DeclareInstance{exsheets-heading}{block}{default}
{
join = { title[r,B]number[l,B](1ex,0pt) } ,
attach =
{
main[l,vc]title[l,vc](0pt,0pt) ;
main[r,vc]points[l,vc](\marginparsep,0pt)
},
above = \baselineskip-.5ex ,
below = .5ex}\NewQuSolPair{exercise}{solution}
\DeclareInstance{exsheets-heading}{myheadings2}{default}{
runin = true,
number-post-code = \space,}
\SetupExSheets{
question/pre-body-hook = {%
\hyperlink{sol:\CurrentQuestionID}{\underline{\textbf{Exercise:}
\GetQuestionProperty{counter}{\CurrentQuestionID}}}\par
},
solution/pre-hook = {% \hypertarget{sol:\CurrentQuestionID}{}%
},
solution/pre-body-hook = {%
\hyperref[qu:\CurrentQuestionID]{\underline{\textbf{Solution:}
\GetQuestionProperty{counter}{\CurrentQuestionID}}}\par
},
headings = myheadings2 }
\section{Cell structure}
\begin{itemize}
\item all living organisms are made up of cells
\item cells may be specialised to carry out a particular function
\item specialised cells include root hair cells, nerve cells, red blood cells
\end{itemize}
\begin{exercise}
\begin{enumerate}
\item[]
\item Which organelle is responsible for:
\begin{enumerate}
\item entry and exit of substances into or out of the cell
\item controlling all cellular activities
\end{enumerate}
\item Below is a diagram of a plant cell.
\begin{enumerate}
\item Identify parts 1- 6.
\item Identify features which are \textbf{not} found in animal cells
\end{enumerate}
\end{enumerate}
\end{exercise}
\begin{solution}
\begin{enumerate}
\item[]
\item
\begin{enumerate}
\item cell membrane
\item nucleus
\end{enumerate}
\item
\begin{enumerate}
\item \begin{itemize}
\item chloroplast
\item permanent vacuole
\item cytoplasm
\item cell wall
\item cell membrane
\item nucleus
\end{itemize}
\item
\begin{itemize}
\item chloroplast/1
\item permanent vacuole/2
\item cell wall/4
\end{itemize}
\end{enumerate}
\end{enumerate}
\end{solution}
\chapter{Nutrition}
\section{Diet}\index{Diet}
\begin{itemize}
\item living organisms need food for the following:
\begin{enumerate}
\item to produce energy that is used in work and physical exercise and to keep the body temperature at $37^OC$
\item for growth
\item to renew and repair worn out tissues
\end{enumerate}
\end{itemize}
\begin{exercise}
\begin{enumerate}
\item
\begin{enumerate}
\item A person’s diet should contain carbohydrate and fat and protein. Give two reasons why.
\item Name one health problem, other than being overweight, that is linked to an unbalanced diet.
\end{enumerate}
\item Explain the importance of the following in maintaining good health
\begin{enumerate}
\item personal hygiene
\item sewage disposal
\end{enumerate}
\end{enumerate}
\end{exercise}
\begin{question}
\begin{enumerate}
\item
\begin{enumerate}
\item
\begin{itemize}
\item to get a balanced diet / to prevent malnourishment
\item to obtain energy
\item for building cells / growth / repair
\end{itemize}
\item heart disease, any deficiency disease
\end{enumerate}
\item
\begin{enumerate}
\item prevent the spread of diseases
\item prevent the spread of diseases
\end{enumerate}
\end{enumerate}
\end{question}
\chapter{Answers}
\printsolutions
\end{document}
答案1
这显示了如何使用\makebox
等来格式化标题。它还显示了如何在保存箱中积累解决方案。
一旦您对格式满意,您就可以创建练习和解决方案环境。
\documentclass[12pt,fleqn]{book}
\newsavebox{\solutions}
\setbox\solutions=\vbox{}
\newsavebox{\titlebox}
\newcounter{exercise}
\begin{document}
\section{Cell structure}
\begin{itemize}
\item all living organisms are made up of cells
\item cells may be specialised to carry out a particular function
\item specialised cells include root hair cells, nerve cells, red blood cells
\end{itemize}
\sbox\titlebox{\refstepcounter{exercise}% to avoid writing it twice
\makebox[1in][l]{\normalfont\bfseries Exercise~\theexercise}%
\parbox[t]{\dimexpr \columnwidth-1.5in-\columnsep}{\normalfont Fill in the missing words.}\hfill
\makebox[0.5in][l]{\normalfont 10 points}}%
\noindent\usebox\titlebox
\begin{enumerate}
\item
Animals cells contain $..............$, a semi-fluid solution of salts and other molecules, and are surrounded by a $..............$. When surrounded by distilled water, the animal cells absorb water by $..............$.
\item The leaves of green plants obtain the gas $..............$ which they require for photosynthesis, by a process of $..............$. They also lose the gas oxygen produced during $..............$ by the same process. These gases move in and out through small pores called $..............$.
\item Water is obtained by plants from the soil solution. The water enters by the process of $..............$, via structures outside the root called $..............$. Water is transported in the $..............$. Sugars produced during photosynthesis are transported in the $..............$
\end{enumerate}
\setbox\solutions=\vbox{\unvbox\solutions
\noindent\usebox\titlebox
\begin{enumerate}
\item
\begin{itemize}
\item a cytoplasm
\item cell membrane
\item osmosis
\end{itemize}
\item
\begin{itemize}
\item carbon dioxide
\item diffusion
\item photosynthesis
\item stomata
\end{itemize}
\item
\begin{itemize}
\item osmosis
\item root hair cells
\item xylem
\item phloem
\end{itemize}
\end{enumerate}
\par}%
\chapter{Solutions}
\unvbox\solutions
\end{document}