我想制作一个气泡答题纸,其中的问题数量由 \qCount 显示。它总是低于 100。是否可以动态制作它?我无法在每行之前打印问题编号,也无法在单元格内显示气泡。
期望输出:样本
梅威瑟:
\documentclass[a4paper]{article}
\usepackage{tikz}
\newcommand{\repeatntimes}[2]{
\newcount\i
\i=0
\newtoks\ans
\loop
\ans=\expandafter{\the\ans #2}
\advance\i by 1
\ifnum\i<#1\repeat
\the\ans
}
\newcommand{\countRepeatntimes}[2]{
\newcount\i
\i=0
\newtoks\ans
\loop
\advance\i by 1
\ans=\expandafter{\the\ans #2}
\ifnum\i<#1\repeat
\the\ans
}
\newcommand{\generateTable}[1]{%
\countRepeatntimes{#1}{\indent
\repeatntimes{4}{\textcolor{lightgray}{\rule{0.9\baselineskip}{0.9\baselineskip}} }\par
}
}
\begin{document}
\def\qCount{80}
\generateTable{\qCount}
\end{document}
答案1
我在循环中打印了一个步进计数器来表示问题编号(以及另一个用于气泡标签的计数器),并将正方形更改\rule
为旋转的“0”,并进行适当的缩放和拉伸。您可以通过 的数值参数更改大小\scalebox{1.4}[1.5]{}
。我还将其设置为两列。
已编辑,提供样本填充块。
\documentclass[a4paper,twocolumn]{article}
\usepackage{tikz,graphicx}
\usepackage[usestackEOL]{stackengine}
\newcommand{\repeatntimes}[2]{
\newcount\i
\i=0
\newtoks\ans
\loop
\ans=\expandafter{\the\ans #2}
\advance\i by 1
\ifnum\i<#1\repeat
\the\ans
}
\newcommand{\countRepeatntimes}[2]{
\newcount\i
\i=0
\newtoks\ans
\loop
\advance\i by 1
\ans=\expandafter{\the\ans #2}
\ifnum\i<#1\repeat
\the\ans
}
\newcounter{problem}
\newcounter{choice}
\newcommand{\generateTable}[1]{%
\countRepeatntimes{#1}{\stepcounter{problem}\makebox[2ex][r]{\theproblem.}%\indent
\setcounter{choice}{0}%
\repeatntimes{4}{\stepcounter{choice}\textcolor{black!35}{%
\raisebox{-1.5pt}{\scalebox{1.5}[1.8]{\stackinset{c}{}{c}{}{%
\scalebox{.6}{\tiny \Alph{choice}}}{\rotatebox{90}{0}}}}} }\par
}
}
\def\sampleblock{%
\makebox[5.1ex]{}
\stepcounter{choice}\textcolor{black!35}{%
\raisebox{-1.5pt}{\scalebox{1.5}[1.8]{\stackinset{c}{}{c}{}{%
\scalebox{.6}{\tiny \Alph{choice}}}{\rotatebox{90}{0}}}}}
\stepcounter{choice}\textcolor{black!35}{%
\raisebox{-1.5pt}{\scalebox{1.5}[1.8]{\stackinset{c}{}{c}{}{%
\scalebox{.6}{\tiny \Alph{choice}}}{\rotatebox{90}{0}}}}}
\stepcounter{choice}\textcolor{black!35}{%
\smash{\raisebox{-1.5pt}{\scalebox{1.5}[1.8]{\stackinset{c}{}{c}{-1pt}{%
\scalebox{6}[3.5]{\color{black}$\cdot$}}{\rotatebox{90}{0}}}}}}
\stepcounter{choice}\textcolor{black!35}{%
\raisebox{-1.5pt}{\scalebox{1.5}[1.8]{\stackinset{c}{}{c}{}{%
\scalebox{.6}{\tiny \Alph{choice}}}{\rotatebox{90}{0}}}}}
\par}
\voffset=\dimexpr\voffset+.5in
\textheight=\dimexpr\textheight-.5in
\begin{document}
\smash{\Shortstack[l]{%
Name \underline{\hspace{2.4in}} Class\underline{\hspace{1.2in}}
Date\underline{\hspace{1.2in}}\\
\textcolor{black!50}{\rule{5.9in}{2ex}}\\
\rule[2ex]{10ex}{2ex}\sffamily\itshape\Huge Bubble Answer Sheet\\
\strut\\
\sampleblock\\
\rule{0ex}{4pt}\\}%
}\vspace{-\baselineskip}\par
\def\qCount{80}
\generateTable{\qCount}
\end{document}
补充
有评论要求提供带有循环选择的版本:
\documentclass[a4paper,twocolumn]{article}
\usepackage{tikz,graphicx}
\usepackage[usestackEOL]{stackengine}
\newcommand{\repeatntimes}[2]{
\newcount\i
\i=0
\newtoks\ans
\loop
\ans=\expandafter{\the\ans #2}
\advance\i by 1
\ifnum\i<#1\repeat
\the\ans
}
\newcommand{\countRepeatntimes}[2]{
\newcount\i
\i=0
\newtoks\ans
\loop
\advance\i by 1
\ans=\expandafter{\the\ans #2}
\ifnum\i<#1\repeat
\the\ans
}
\newcounter{problem}
\newcounter{choice}
\newcommand{\generateTable}[1]{%
\countRepeatntimes{#1}{\stepcounter{problem}\makebox[2ex][r]{\theproblem.}%\indent
\setcounter{choice}{0}%
\repeatntimes{4}{\stepcounter{choice}\textcolor{black!35}{%
\raisebox{0.5pt}{\scalebox{1.0}{\stackinset{c}{}{c}{}{%
\scalebox{.6}{\footnotesize \Alph{choice}}}{$\bigcirc$}}}} }\par
}
}
\def\sampleblock{%
\makebox[5.1ex]{}
\stepcounter{choice}\textcolor{black!35}{%
\raisebox{-1.5pt}{\scalebox{1.0}{\stackinset{c}{}{c}{}{%
\scalebox{.6}{\footnotesize \Alph{choice}}}{$\bigcirc$}}}}
\stepcounter{choice}\textcolor{black!35}{%
\raisebox{-1.5pt}{\scalebox{1.0}{\stackinset{c}{}{c}{}{%
\scalebox{.6}{\footnotesize \Alph{choice}}}{$\bigcirc$}}}}
\stepcounter{choice}\textcolor{black!35}{%
\smash{\raisebox{-1.5pt}{\scalebox{1.0}{\stackinset{c}{}{c}{-2.5pt}{%
\scalebox{8}{\color{black}$\cdot$}}{$\bigcirc$}}}}}
\stepcounter{choice}\textcolor{black!35}{%
\raisebox{-1.5pt}{\scalebox{1.0}{\stackinset{c}{}{c}{}{%
\scalebox{.6}{\footnotesize \Alph{choice}}}{$\bigcirc$}}}}
\par}
\voffset=\dimexpr\voffset+.5in
\textheight=\dimexpr\textheight-.5in
\begin{document}
\smash{\Shortstack[l]{%
Name \underline{\hspace{2.4in}} Class\underline{\hspace{1.2in}}
Date\underline{\hspace{1.2in}}\\
\textcolor{black!50}{\rule{5.9in}{2ex}}\\
\rule[2ex]{10ex}{2ex}\sffamily\itshape\Huge Bubble Answer Sheet\\
\strut\\
\sampleblock\\
\rule{0ex}{4pt}\\}%
}\vspace{-\baselineskip}\par
\def\qCount{80}
\generateTable{\qCount}
\end{document}