Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

<fillin/> with @rows and @cols attributes?

14 views
Skip to first unread message

Spencer Bagley

unread,
Jul 12, 2024, 7:34:44 PM7/12/24
to PreTeXt support
Consider the following LaTeX:
\begin{tabular} {|c | c|}\hline $M$ & 0 \\ \hline $T$ (regular) & ~\hspace{.5in} ~ \\
&& \\ \hline
\end{tabular}
This produces a table with a bit of space for a student to write an answer in the bottom-right cell. 

Is there an idiomatic way to do something similar in PreTeXt? I tried <fillin rows="2" cols="5" /> but the following thing happened (which I don't know if this is the expected behavior or not).


Thanks!
Spencer

D. Brian Walton

unread,
Jul 12, 2024, 7:49:51 PM7/12/24
to pretext...@googlegroups.com
That result probably is coming from some XSL designed for WeBWorK.

Try <fillin characters="15"/>, changing the 15 to control width. (I assume you are just wanting space, not an auto-checked fill-in-the-blank, which does not support.) I don't think there is any way to expand vertically at present.

Brian

--
You received this message because you are subscribed to the Google Groups "PreTeXt support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pretext-suppo...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pretext-support/3f0a9731-2ae4-49ae-a6e6-d1cb6736168cn%40googlegroups.com.

Alex Jordan

unread,
Jul 12, 2024, 9:03:27 PM7/12/24
to pretext...@googlegroups.com
That style of fillin is meant for regular text, like in a "p". And in that context perhaps looks better if the textfillinstyle is underline or shade. But in regular text in a "p" we did not want to actually make a 2x5 array of fillin blanks. So it communicates what kind of thing is expected without actually showing the array.

Here in a table cell, something different could be done, but currently nothing is different compared with a fillin that's in regular text. My taste: if a fillin were the only element in a "cell", print nothing, not even an underline.

But that would not capture the desire to make a blank table cell that is taller than one line. And rows="2" is not meant to convey height, but rather how many inputs are expected in some array of fillins.

Depending on what your actual use case is, the following is or is not a hack. You could do like:
<cell>
    <m><fillin fill="\begin{array}{c}XXXXX\\XXXXX\end{array}}/></m>
</cell>

I haven't tested to check this is up to date, but what is supposed to happen is that the @fill content gets wrapped in \phantom. And you end up with something the same size as what @fill would work out to be. Just note that in HTML, a user can peek inside the content of the \phantom, so you want to avoid giving away actual answers there.

And note that the fillin-math-style can differ from fillin-text-style.


Oscar Levin

unread,
Jul 12, 2024, 10:41:08 PM7/12/24
to pretext...@googlegroups.com
Someone else was asking me about this on Wednesday.  So it does seem like some sort of fillin table with height would be reasonable and common.  But until that is possibly implemented, would filling the cell with two <line><nbsp/></line> give the required space?

Spencer Bagley

unread,
Jul 15, 2024, 1:54:29 PM7/15/24
to PreTeXt support
Just tested -- jordancanonical's solution works great!

Oscar's solution is also good except that it doesn't immediately provide for control over the horizontal width of the cell. Probably you could couple that with something like Brian's <fillin characters="5" />.
Reply all
Reply to author
Forward
0 new messages