我想将每个 \makenonemptybox 填充为像方格页(3 毫米)或横格页一样?
这是我的代码。
\documentclass[addpoints]{exam}
\usepackage[italian]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{anysize}
\usepackage{graphicx}
\usepackage{float}
\usepackage{etoolbox}
\usepackage{amsbsy}
\usepackage{amsmath}
\usepackage{pbox}
\usepackage{textcomp}
\linespread{1.5}
\frenchspacing
\newcommand{\abs}[1]{\lvert#1\rvert}
\usepackage[a4paper,top=1.5cm,bottom=1.5cm,left=1.5cm,right=1.5cm]{geometry}
\usepackage{enumerate}
\usepackage{multicol}
\usepackage{textgreek}
\makeatletter
\pointpoints{p.}{p.}
\newcommand{\makenonemptybox}[2]{%
\par\nobreak\vspace{\ht\strutbox}\noindent
\fbox{%
\parbox[c][\dimexpr#1-2\fboxsep][t]{\dimexpr\linewidth-2\fboxsep}{
\hrule width \hsize height 0pt
#2
}%
}%
\par\vspace{\ht\strutbox}
}
\begin{document}
\large
\newcounter{copynum} % copy number, to be printed in the footer
\newcounter{NumCopy} % how many copies do we want?
\setcounter{NumCopy}{1} % we want 3
\whiledo{\thecopynum<\theNumCopy}{%
\setcounter{page}{1} % start numbering pages for the current copy at 1
\addtocounter{copynum}{1} % the number of the current copy
\setcounter{question}{1} % make questions start at 1 again
\setcounter{part}{1} % make parts start at 1 again
\setcounter{numquestions}{0}
\setcounter{numpoints}{0}
\setcounter{numbonuspoints}{0}
\setcounter{numparts}{0}
\setcounter{numsubparts}{0}
\setcounter{numsubsubparts}{0}
\ifnum\value{copynum}>1 %
\ExamResetAfterFirstRun
\fi
\begin{center}
\begin{minipage}{.40\textwidth}
\centering
{\textbf{Exam}}
\end{minipage}
\end{center}
\begin{questions}
\question[3] question 1
\makenonemptybox{1.3in}{
}
\question question 2:
\makenonemptybox{1.3in}{
}
\end{questions}
{ \small
{
\begin{center}
\hqword{Question}
\hpword{Points}
\bhpword{Bonus Points:}
\htword{\textbf{Tot. Points}}
\hsword{Points}
\cellwidth{1.0em}
\gradetable[h][questions]
\end{center}
}
}
}
\end{document}
答案1
我很乐意删除它,但我想知道您是否在寻找类似的东西。
\documentclass[addpoints]{exam}
\usepackage[italian]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{anysize}
\usepackage{tikz}
\usetikzlibrary{patterns}
\usepackage{float}
\usepackage{etoolbox}
\usepackage{amsbsy}
\usepackage{amsmath}
\usepackage{pbox}
\usepackage{textcomp}
\linespread{1.5}
\frenchspacing
\newcommand{\abs}[1]{\lvert#1\rvert}
\usepackage[a4paper,top=1.5cm,bottom=1.5cm,left=1.5cm,right=1.5cm]{geometry}
\usepackage{enumerate}
\usepackage{multicol}
\usepackage{textgreek}
\makeatletter
\pointpoints{p.}{p.}
\newcommand{\makenonemptybox}[2]{%
\par\nobreak\vspace{\ht\strutbox}\noindent
\fbox{%
\parbox[c][\dimexpr#1-2\fboxsep][t]{\dimexpr\linewidth-2\fboxsep}{
\hrule width \hsize height 0pt
#2
}%
}%
\par\vspace{\ht\strutbox}
}
\newcommand{\checkerboardbox}[2]{%
\par\nobreak\vspace{\ht\strutbox}\noindent\begin{tikzpicture}
\node[path picture={\path[pattern=checkerboard light gray]
(path picture bounding box.south west) rectangle
(path picture bounding box.north east);},draw,minimum width=\linewidth,
minimum height=\dimexpr#1-2\fboxsep,align=left,
text width=\dimexpr\linewidth-2\fboxsep]
{#2};
\end{tikzpicture}
}
\newcommand{\gridbox}[2]{%
\par\nobreak\vspace{\ht\strutbox}\noindent\begin{tikzpicture}
\node[path picture={\draw[very thin,gray]
(path picture bounding box.south west) grid[step=5mm]
(path picture bounding box.north east);
\draw (path picture bounding box.south west) grid[step=1cm]
(path picture bounding box.north east);},draw,minimum width=\linewidth,
minimum height=\dimexpr#1-2\fboxsep,align=left,
text width=\dimexpr\linewidth-2\fboxsep]
{#2};
\end{tikzpicture}
}
\pgfdeclarepatternformonly{sparse horizontal lines}{\pgfpointorigin}{\pgfqpoint{100pt}{5mm}}{\pgfqpoint{100pt}{6mm}}%
{%
\pgfsetlinewidth{0.4pt}%
\pgfpathmoveto{\pgfqpoint{0pt}{0.5pt}}%
\pgfpathlineto{\pgfqpoint{100pt}{0.5pt}}%
\pgfusepath{stroke}%
}%
\newcommand{\hlinebox}[2]{%
\par\nobreak\vspace{\ht\strutbox}\noindent\begin{tikzpicture}
\node[path picture={\path[pattern=sparse horizontal lines,pattern color=gray]
(path picture bounding box.south west) rectangle
(path picture bounding box.north east);},draw,minimum width=\linewidth,
minimum height=\dimexpr#1-2\fboxsep,align=left,
text width=\dimexpr\linewidth-2\fboxsep]
{#2};
\end{tikzpicture}
}
\begin{document}
\large
\newcounter{copynum} % copy number, to be printed in the footer
\newcounter{NumCopy} % how many copies do we want?
\setcounter{NumCopy}{1} % we want 3
\whiledo{\thecopynum<\theNumCopy}{%
\setcounter{page}{1} % start numbering pages for the current copy at 1
\addtocounter{copynum}{1} % the number of the current copy
\setcounter{question}{1} % make questions start at 1 again
\setcounter{part}{1} % make parts start at 1 again
\setcounter{numquestions}{0}
\setcounter{numpoints}{0}
\setcounter{numbonuspoints}{0}
\setcounter{numparts}{0}
\setcounter{numsubparts}{0}
\setcounter{numsubsubparts}{0}
\ifnum\value{copynum}>1 %
\ExamResetAfterFirstRun
\fi
\begin{center}
\begin{minipage}{.40\textwidth}
\centering
{\textbf{Exam}}
\end{minipage}
\end{center}
\begin{questions}
\question[3] question 1
\makenonemptybox{1.3in}{
}
\gridbox{1.3in}{
}
\hlinebox{1.3in}{
}
\question question 2:
\makenonemptybox{1.3in}{
}
\end{questions}
{ \small
{
\begin{center}
\hqword{Question}
\hpword{Points}
\bhpword{Bonus Points:}
\htword{\textbf{Tot. Points}}
\hsword{Points}
\cellwidth{1.0em}
\gradetable[h][questions]
\end{center}
}
}
}
\end{document}
\dimexpr
不包含代码的版本tikz
。
\documentclass[addpoints]{exam}
\usepackage[italian]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{anysize}
\usepackage{tikz}
\usetikzlibrary{patterns}
\usepackage{float}
\usepackage{etoolbox}
\usepackage{amsbsy}
\usepackage{amsmath}
\usepackage{pbox}
\usepackage{textcomp}
\linespread{1.5}
\frenchspacing
\newcommand{\abs}[1]{\lvert#1\rvert}
\usepackage[a4paper,top=1.5cm,bottom=1.5cm,left=1.5cm,right=1.5cm]{geometry}
\usepackage{enumerate}
\usepackage{multicol}
\usepackage{textgreek}
\makeatletter
\pointpoints{p.}{p.}
\newcommand{\makenonemptybox}[2]{%
\par\nobreak\vspace{\ht\strutbox}\noindent
\fbox{%
\parbox[c][\dimexpr#1-2\fboxsep][t]{\dimexpr\linewidth-2\fboxsep}{
\hrule width \hsize height 0pt
#2
}%
}%
\par\vspace{\ht\strutbox}
}
\newcommand{\checkerboardbox}[2]{%
\par\nobreak\vspace{\ht\strutbox}\noindent\begin{tikzpicture}
\node[path picture={\path[pattern=checkerboard light gray]
(path picture bounding box.south west) rectangle
(path picture bounding box.north east);},draw,minimum width=\linewidth,
minimum height=#1-2*\fboxsep,align=left,
text width=\linewidth-2*\fboxsep]
{#2};
\end{tikzpicture}
}
\newcommand{\gridbox}[2]{%
\par\nobreak\vspace{\ht\strutbox}\noindent\begin{tikzpicture}
\node[path picture={\draw[very thin,gray]
(path picture bounding box.south west) grid[step=5mm]
(path picture bounding box.north east);
\draw (path picture bounding box.south west) grid[step=1cm]
(path picture bounding box.north east);},draw,minimum width=\linewidth,
minimum height=#1-2*\fboxsep,align=left,
text width=\linewidth-2*\fboxsep]
{#2};
\end{tikzpicture}
}
\pgfdeclarepatternformonly{sparse horizontal lines}{\pgfpointorigin}{\pgfqpoint{100pt}{5mm}}{\pgfqpoint{100pt}{6mm}}%
{%
\pgfsetlinewidth{0.4pt}%
\pgfpathmoveto{\pgfqpoint{0pt}{0.5pt}}%
\pgfpathlineto{\pgfqpoint{100pt}{0.5pt}}%
\pgfusepath{stroke}%
}%
\newcommand{\hlinebox}[2]{%
\par\nobreak\vspace{\ht\strutbox}\noindent\begin{tikzpicture}
\node[path picture={\path[pattern=sparse horizontal lines,pattern color=gray]
(path picture bounding box.south west) rectangle
(path picture bounding box.north east);},draw,minimum width=\linewidth,
minimum height=\dimexpr#1-2\fboxsep,align=left,
text width=\dimexpr\linewidth-2\fboxsep]
{#2};
\end{tikzpicture}
}
\begin{document}
\large
\newcounter{copynum} % copy number, to be printed in the footer
\newcounter{NumCopy} % how many copies do we want?
\setcounter{NumCopy}{1} % we want 3
\whiledo{\thecopynum<\theNumCopy}{%
\setcounter{page}{1} % start numbering pages for the current copy at 1
\addtocounter{copynum}{1} % the number of the current copy
\setcounter{question}{1} % make questions start at 1 again
\setcounter{part}{1} % make parts start at 1 again
\setcounter{numquestions}{0}
\setcounter{numpoints}{0}
\setcounter{numbonuspoints}{0}
\setcounter{numparts}{0}
\setcounter{numsubparts}{0}
\setcounter{numsubsubparts}{0}
\ifnum\value{copynum}>1 %
\ExamResetAfterFirstRun
\fi
\begin{center}
\begin{minipage}{.40\textwidth}
\centering
{\textbf{Exam}}
\end{minipage}
\end{center}
\begin{questions}
\question[3] question 1
\gridbox{1.3in}{
}
\question question 2:
\hlinebox{1.3in}{
}
\end{questions}
{ \small
{
\begin{center}
\hqword{Question}
\hpword{Points}
\bhpword{Bonus Points:}
\htword{\textbf{Tot. Points}}
\hsword{Points}
\cellwidth{1.0em}
\gradetable[h][questions]
\end{center}
}
}
}
\end{document}