Does webwork allow us to align displayed equations? I have in mind something like this:
Xone= two
= three some comments
= four some comments
Note: one of those one/two/three/four could be input boxes for students.
Thanks!
EDIT: my message does not come out properly the way I want (why is there an X at the beginning of "one"?!!), so here's a latex version of what I have in mind:
$$
\begin{array}{llllll}
one & = & two
\\
& = & three & comments
\\
& = & four & comments
\end{array}
$$
Here is a version (omitting the comments) which WeBWorK / MathJax can display
\[ \begin{aligned}
one
& = two \\
& = three = thrice = tripled \\
& = four
\end{aligned} \]
This seems a good topic for a new page in the wiki (especially if we learn about a variety of ways to do this task).
Hi Dick,
I tried your snipet and Simon's too. They both displayed arrays fine. However, when I tried to insert an answer box by entering perl mode there is an error in the display. Im sure I have seen problems where authors insert perl within tex mode, but I cant seem to find one. Here is an example of what I mean and what I believe Simon wants to do:
\[ \begin{aligned}
one
& = two \\
& = three = \{ ans_rule(5) \} = tripled \\
& = four
\end{aligned} \]
I tried your snipet and Simon's too. They both displayed arrays fine. However, when I tried to insert an answer box by entering perl mode there is an error in the display. Im sure I have seen problems where authors insert perl within tex mode, but I cant seem to find one. Here is an example of what I mean and what I believe Simon wants to do:
\[ \begin{aligned}
one
& = two \\
& = three = \{ ans_rule(5) \} = tripled \\
& = four
\end{aligned} \]
I hope I didn't hijack your question Siman. After looking thru the library, it appears that one can't insert perl commands within tex mode. I guess this makes sense. If this is the case, maybe you have to format the array outside of tex?
I too had tried to insert perl commands inside the tex codes before I posted my question; I just like to confirm that I'm not missing something obvious.
And feel free to hijack my thread; one day maybe I too will be about to help others :-)
And feel free to hijack my thread; one day maybe I too will be about to help others :-)
Instead of inserting Perl into TeX, you can insert TeX into Perl. There are PG table commands that produce aligned tables. You can have TeX, or other Perl/PG objects at any entry in the table.
I believe that PG has a simple table command, but I go straight to the one provided by PGunion.pl. Read about it here:
http://webwork.maa.org/wiki/Tables
Scroll to the bottom to read about the tables that PGunion allows. There's more documentation here:
http://webwork.maa.org/viewvc/system/trunk/pg/macros/unionTables.pl?revision=6499&view=markup
Each entry in these tables can be:
I believe that PG has a simple table command, but I go straight to the one provided by PGunion.pl. Read about it here:
http://webwork.maa.org/wiki/Tables
Scroll to the bottom to read about the tables that PGunion allows. There's more documentation here:
http://webwork.maa.org/viewvc/system/trunk/pg/macros/unionTables.pl?revision=6499&view=markup
Each entry in these tables can be:
- strings encased in " "
- LaTeX encased in "\( \)"
- some kind of Perl/PG command (including ans_rule), with no surrounding quotation marks
If the intent is to present an organized collection of answer boxes, perhaps
http://webwork.maa.org/wiki/AlignedChoice
(which discusses presentation of Aligned Answer Blanks) will be relevant.
FWIW: that example loads PGunion.pl, but I have been able to omit it --- perhaps because alignedChoice.pl loads unionUtils.pl.