这是作为工作表的一部分创建问题的代码的一部分,但我不明白为什么不会出现所有的问题。
\documentclass{book}
\usepackage{newfile}
\usepackage{amsmath}
\usepackage{xifthen}
\usepackage{enumitem}
\usepackage{multicol}
\usepackage{lipsum}
\usepackage{blindtext}
\usepackage{tikz}% added <<<<<<<<<<<<<<<<<
\usepackage[left=1.00cm, right=1.00cm, top=3.00cm, bottom=3.00cm]{geometry}
%start of book and exercise code
\setlength{\parindent}{0pt}
\newoutputstream{solutions}
\openoutputfile{\jobname.solutions}{solutions}
\newcounter{exblock}
\newcounter{exquestion}
\newcounter{exsubquestion}
\newlist{questionlist}{enumerate}{1}
\newlist{solutionlist}{enumerate}{1}
\newlist{subquestionlist}{enumerate*}{1}
\newlist{subsolutionlist}{enumerate*}{1}
\setlist[questionlist,solutionlist]{label=\arabic*.}
\setlist[subquestionlist,subsolutionlist]{label=(\alph*),itemjoin={},before=~}
\newcommand{\exheader}{%
\ifthenelse{\value{exblock}>0}{\addtostream{solutions} {\noexpand\end{solutionlist}}}{}%
\refstepcounter{exblock}%
\setcounter{exquestion}{0}%
\section{Exercises}%
\label{ex.\arabic{exblock}}%
\addtostream{solutions}{\noexpand\paragraph{Exercises \noexpand\ref{ex.\arabic{exblock}}, page \noexpand\pageref{ex.\arabic{exblock}}}}%
\addtostream{solutions}{\noexpand\begin{solutionlist}}%
}
\newcommand{\printsolutions}{%
\ifthenelse{\value{exblock}>0}{\addtostream{solutions} {\noexpand\end{solutionlist}}}{}%
\closeoutputstream{solutions}%
\input{\jobname.solutions}%
}
\newenvironment{exercises}[1][]{%
\begin{questionlist}[start=\value{exquestion}+1, #1]%
}{%
\end{questionlist}%
}
\newenvironment{exercisescol}[2][]{%
\begin{multicols}{#2}%
\begin{questionlist}[start=\value{exquestion}+1, #1]%
}{%
\end{questionlist}%
\end{multicols}%
}
\newcommand{\question}[2]{%
\refstepcounter{exquestion}%
\label{ex.\arabic{exblock}.\arabic{exquestion}}%
\item #1%
\addtostream{solutions} {\noexpand\item[\noexpand\ref{ex.\arabic{exblock}.\arabic{exquestion}}.] #2}%
}
\newenvironment{subquestions}[1][]{%
\refstepcounter{exquestion}%
\label{ex.\arabic{exblock}.\arabic{exquestion}}%
\setcounter{exsubquestion}{0}%
\addtostream{solutions} {\noexpand\item[\noexpand\ref{ex.\arabic{exblock}.\arabic{exquestion}}.]\noexpand\begin {subsolutionlist}}%
\item #1%
\begin{subquestionlist}%
}{%
\end{subquestionlist}%
\addtostream{solutions}{\noexpand\end{subsolutionlist}}
}
\newcommand{\subquestion}[2]{%
\refstepcounter{exsubquestion}%
\item #1%
\addtostream{solutions}{\noexpand\item #2}%
}
\setlist*[questionlist]{font=\bfseries}
\setlist*[solutionlist]{noitemsep,font=\bfseries}
\setlist*[subquestionlist]{font=\bfseries}
\setlist*[subsolutionlist]{noitemsep,font=\bfseries,itemjoin={\\},before={}}
%end of book and exercise code
\begin{document}
So for example the number forty five thousand, two hundred and seventy three\\
can be broken down as;\\
\vspace{1cm}
\begin{table}[htp!]
\begin{tabular}{|c|c|c|c|c|c|c|}
\hline
Millions & hundred thousand & ten thousand & thousand & hundred & tens & units\\
\hline
1,000,000 & 100,000 & 10,000 & 1,000 & 100 & 10 & 1\\
\hline
0 & 0 & 4 & 5 & 2 & 7 & 3\\
\hline
\end{tabular}
\end{table}
\vspace{1cm}
so in figures the number forty five thousand, two hundred and seventy three will be\\
45,273\\
\exheader
Write the following numbers in figures
\begin{exercisescol}[noitemsep]{2}
\question{Five thousand, one hundred and three}
\question{Three hundred tousand, seven hundred and nighty one}
\question{two and a half million}
\question{one million, seven hundred and two thousand, two hundred and four}
\end{exercisescol}
\end{document}
任何帮助都将不胜感激。
答案1
进行了一些修正,\question
并猜测第一个可选参数是要列出的解决方案。
\documentclass{book}
\usepackage{newfile}
\usepackage{amsmath}
\usepackage{xifthen}
\usepackage{enumitem}
\usepackage{multicol}
\usepackage{lipsum}
\usepackage{blindtext}
\usepackage{tikz}% added <<<<<<<<<<<<<<<<<
\usepackage[left=1.00cm, right=1.00cm, top=3.00cm, bottom=3.00cm]{geometry}
%start of book and exercise code
\setlength{\parindent}{0pt}
\newoutputstream{solutions}
\openoutputfile{\jobname.solutions}{solutions}
\newcounter{exblock}
\newcounter{exquestion}
\newcounter{exsubquestion}
\newlist{questionlist}{enumerate}{1}
\newlist{solutionlist}{enumerate}{1}
\newlist{subquestionlist}{enumerate*}{1}
\newlist{subsolutionlist}{enumerate*}{1}
\setlist[questionlist,solutionlist]{label=\arabic*.}
\setlist[subquestionlist,subsolutionlist]{label=(\alph*),itemjoin={},before=~}
\newcommand{\exheader}{%
\ifthenelse{\value{exblock}>0}{\addtostream{solutions} {\noexpand\end{solutionlist}}}{}%
\refstepcounter{exblock}%
\setcounter{exquestion}{0}%
\section{Exercises}%
\label{ex.\arabic{exblock}}%
\addtostream{solutions}{\noexpand\paragraph{Exercises \noexpand\ref{ex.\arabic{exblock}}, page \noexpand\pageref{ex.\arabic{exblock}}}}%
\addtostream{solutions}{\noexpand\begin{solutionlist}}%
}
\newcommand{\printsolutions}{%
\ifthenelse{\value{exblock}>0}{\addtostream{solutions} {\noexpand\end{solutionlist}}}{}%
\closeoutputstream{solutions}%
\input{\jobname.solutions}%
}
\newenvironment{exercises}[1][]{%
\begin{questionlist}[start=\value{exquestion}+1, #1]%
}{%
\end{questionlist}%
}
\newenvironment{exercisescol}[2][]{%
\begin{multicols}{#2}%
\begin{questionlist}[start=\value{exquestion}+1, #1]%
}{%
\end{questionlist}%
\end{multicols}%
}
\newcommand{\question}[2][]{% <<<<<<<<<<<<<<<<<<<<<<<<<<<<
\refstepcounter{exquestion}%
\label{ex.\arabic{exblock}.\arabic{exquestion}}%
\item #2%%changed <<<<
\addtostream{solutions} {\noexpand\item[\noexpand\ref{ex.\arabic{exblock}.\arabic{exquestion}}.] #1}%%changed <<<<
}
\newenvironment{subquestions}[1][]{%
\refstepcounter{exquestion}%
\label{ex.\arabic{exblock}.\arabic{exquestion}}%
\setcounter{exsubquestion}{0}%
\addtostream{solutions} {\noexpand\item[\noexpand\ref{ex.\arabic{exblock}.\arabic{exquestion}}.]\noexpand\begin {subsolutionlist}}%
\item #1%
\begin{subquestionlist}%
}{%
\end{subquestionlist}%
\addtostream{solutions}{\noexpand\end{subsolutionlist}}
}
\newcommand{\subquestion}[2]{%
\refstepcounter{exsubquestion}%
\item #1%
\addtostream{solutions}{\noexpand\item #2}%
}
\setlist*[questionlist]{font=\bfseries}
\setlist*[solutionlist]{noitemsep,font=\bfseries}
\setlist*[subquestionlist]{font=\bfseries}
\setlist*[subsolutionlist]{noitemsep,font=\bfseries,itemjoin={\\},before={}}
%end of book and exercise code
\begin{document}
So for example the number forty five thousand, two hundred and seventy three\\
can be broken down as;\\
\vspace{1cm}
\begin{table}[htp!]
\begin{tabular}{|c|c|c|c|c|c|c|}
\hline
Millions & hundred thousand & ten thousand & thousand & hundred & tens & units\\
\hline
1,000,000 & 100,000 & 10,000 & 1,000 & 100 & 10 & 1\\
\hline
0 & 0 & 4 & 5 & 2 & 7 & 3\\
\hline
\end{tabular}
\end{table}
\vspace{1cm}
so in figures the number forty five thousand, two hundred and seventy three will be\\
45,273\\
\exheader
Write the following numbers in figures
\begin{exercisescol}[noitemsep]{2}
\question[5,103]{Five thousand, one hundred and three}
\question[370,091]{Three hundred thousand, seven hundred and ninety one}
\question[2,500,000]{Two and a half million}
\question[1,702,204]{One million, seven hundred and two thousand, two hundred and four}
\end{exercisescol}
\printsolutions % added <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
\end{document}