考试类 - 使用 probsoln 水平对齐问题

考试类 - 使用 probsoln 水平对齐问题

我想创建工作表,其中的问题按行而不是列填充。我用它probsoln来存储和调用问题,但它们总是垂直填满工作表。我尝试将它们放在表格中,但我无法让它工作。

\documentclass[letter]{article}

\usepackage{probsoln}
\usepackage{amsmath}
\usepackage{multicol}

\PSNrandseed{2004}

\hideanswers

\begin{document}
\ifthenelse{\boolean{showanswers}}{\textbf{Solution Sheet}}{}
\loadrandomproblems{10}{AddingFractionsDatabase}

\begin{tabular}{lllll}
\foreachproblem{\thisproblem\\}%
\end{tabular}


\end{document}

我希望能够根据需要从每个文件中提取一两行问题。如果可能的话,我想使用考试类。

测试数据库

\newproblem{addfractions:1212} 
{$\frac{1}{2} + \frac{1}{2} = $} 
{$\frac{1}{2} + \frac{1}{2} = \frac{2}{2} = 1$} 

\newproblem{addfractions:1213} 
{$\frac{1}{2} + \frac{1}{3} = $} 
{$\frac{1}{2} + \frac{1}{3} = \frac{3}{6} + \frac{2}{6} = \frac{5}{6}$} 

\newproblem{addfractions:1223} 
{$\frac{1}{2} + \frac{2}{3} = $} 
{$\frac{1}{2} + \frac{2}{3} = \frac{3}{6} + \frac{4}{6} = \frac{7}{6} = 1 \frac{1}{6}$} 

\newproblem{addfractions:1214} 
{$\frac{1}{2} + \frac{1}{4} = $} 
{$\frac{1}{2} + \frac{1}{4} = \frac{2}{4} + \frac{1}{4} = \frac{3}{4}$}

\newproblem{addfractions:1216}
{$\frac{1}{2} + \frac{1}{6} = $}
{$\frac{1}{2} + \frac{1}{6} = \frac{3}{6} + \frac{1}{6} = \frac{4}{6} = \frac{2}{3}$}

\newproblem{addfractions:1256}
{$\frac{1}{2} + \frac{5}{6} = $}
{$\frac{1}{2} + \frac{5}{6} = \frac{3}{6} + \frac{5}{6} = \frac{8}{6} = 1 \frac{2}{6} = 1 \frac{1}{3}$}

\newproblem{addfractions:1217}
{$\frac{1}{2} + \frac{1}{7} = $}
{$\frac{1}{2} + \frac{1}{7} = \frac{7}{14} + \frac{2}{14} = \frac{9}{14}$}

\newproblem{addfractions:1227}
{$\frac{1}{2} + \frac{2}{7} = $}
{$\frac{1}{2} + \frac{2}{7} = \frac{7}{14} + \frac{4}{14} = \frac{11}{14}$}

\newproblem{addfractions:1237}
{$\frac{1}{2} + \frac{3}{7} = $}
{$\frac{1}{2} + \frac{3}{7} = \frac{7}{14} + \frac{6}{14} = \frac{13}{14}$}

\newproblem{addfractions:1247}
{$\frac{1}{2} + \frac{4}{7} = $}
{$\frac{1}{2} + \frac{4}{7} = \frac{7}{14} + \frac{8}{14} = \frac{15}{14} = 1 \frac{1}{14}$}

\newproblem{addfractions:1257}
{$\frac{1}{2} + \frac{5}{7} = $}
{$\frac{1}{2} + \frac{5}{7} = \frac{7}{14} + \frac{10}{14} = \frac{17}{14} = 1 \frac{3}{14}$}

\newproblem{addfractions:1267}
{$\frac{1}{2} + \frac{6}{7} = $}
{$\frac{1}{2} + \frac{6}{7} = \frac{7}{14} + \frac{12}{14} = \frac{19}{14} = 1 \frac{5}{14}$}

\newproblem{addfractions:1218}
{$\frac{1}{2} + \frac{1}{8} = $}
{$\frac{1}{2} + \frac{1}{8} = \frac{4}{8} + \frac{1}{8} = \frac{5}{8}$}

\newproblem{addfractions:1238}
{$\frac{1}{2} + \frac{3}{8}= $}
{$\frac{1}{2} + \frac{3}{8} = \frac{4}{8} + \frac{3}{8} = \frac{7}{8}$}

\newproblem{addfractions:1258}
{$\frac{1}{2} + \frac{5}{8}= $}
{$\frac{1}{2} + \frac{5}{8} = \frac{4}{8} + \frac{5}{8} = \frac{9}{8} = 1 \frac{1}{8}$}

\newproblem{addfractions:1278}
{$\frac{1}{2} + \frac{7}{8}= $}
{$\frac{1}{2} + \frac{7}{8} = \frac{4}{8} + \frac{7}{8} = \frac{11}{8} = 1 \frac{3}{8}$}

\newproblem{addfractions:1219}
{$\frac{1}{2} + \frac{1}{9}= $}
{$\frac{1}{2} + \frac{1}{9} = \frac{9}{18} + \frac{2}{18} = \frac{11}{18}$}

答案1

您可以通过跟踪您所在的列来实现这一点,如下所示:

\documentclass{article}

\usepackage{etoolbox}
\usepackage{probsoln}
\usepackage{amsmath}
\usepackage{multicol}

\PSNrandseed{2004}

\hideanswers

\begin{document}
\ifthenelse{\boolean{showanswers}}{\textbf{Solution Sheet}}{}
\loadrandomproblems{10}{AddingFractionsDatabase}

\newcounter{colcount}
\begin{tabular}{lllll}
\foreachproblem{\thisproblem
 \global\stepcounter{colcount}%
 \ifnumless{\value{colcount}}{4}{&}{\global\setcounter{colcount}{0}\\}%
}%
\end{tabular}


\end{document}

结果:

结果图像

相关内容