pretext icon indicating copy to clipboard operation
pretext copied to clipboard

Boxes in Card Sort Problems

Open twjudson opened this issue 7 months ago • 10 comments

It's very difficult to fit text and math into the boxes for matching problems. There are work arounds such as reducing the font size or breaking a line, but it would be nice if this was automatic.

twjudson avatar May 13 '25 19:05 twjudson

I think perhaps, following through on a long conversation that Andrew, Rob, and I and others have been having about marking a problem to be full width is perhaps the best place to start.

I don't think that Runestone wants to get in the business of figuring out how to intelligently add line breaks to mathematical expressions.

@ascholerChemeketa @rbeezer

bnmnetp avatar May 13 '25 20:05 bnmnetp

There are rumors that MathJax 4 will do some of this more automatically. We may need to configure something.

@twjudson: would you add this as something to check on as part of #1841?

rbeezer avatar May 13 '25 20:05 rbeezer

If the contents of a premise or response is text, and that text is too long for one line, the text wraps reasonably well.

This came up yesterday in an APEX PROTEUS meeting. One of the team members had written a card sort problem where the responses contained text that was too long to fit on a line. The person who wrote the problem was not happy that the text in the cards uses a typewriter/verbatim font. (His guess was that the font assumes these are programming questions, and not math questions.)

He wanted the font in the cards to match the font in the main text, which led to him doing things like:

<response>
  <line><m>\text{some text leading to some math }45x^2+3x\text{ more text}</m></line>
  <line><m>\text{some additional text that didn't fit on the previous line</m></line>
</response>

Depending on screen size and browser, his estimate of what fits on a line may or may not have been correct. We agreed that this was a bad idea, and the <line>s should be removed. Without them, the text wraps and doesn't spill over the cards.

So that is good, but doesn't fix the font issue.

sean-fitzpatrick avatar May 14 '25 16:05 sean-fitzpatrick

Suggestion: could we consider the following?

<response>A bunch of text</response> is rendered using the current typewriter font. <response><p>A bunch of text</p></response> is rendered using the main font.

sean-fitzpatrick avatar May 14 '25 16:05 sean-fitzpatrick

I don't think it is the case that they were assumed to be code. In fact in CSAwesome many of the card sort problems are for matching vocab words.

I do see in the CSS for the card sort questions that BOTH the draggable and droppable containers are set to have font-family: monospace. I had never noticed that before as I thought all of the problems in the sample book looked quite lovely. In the sample book the majority of the examples are math. In PreTeXt, problems with code are going to get styled correctly because it is going to have the right html.

It would be easy to experiment by examining the offending block in the developer tools, and unchecking the css rule that sets monospace.

The current CSS for card sorts has these two lines (unchanged since a student wrote this in the summer of 2015)

    font-family: monospace;
    font-size: 120%;

I removed those lines and I don't think it has an impact on the usability of the card sort problems. I am willing to make that permanent and see what happens. But I would like a few more people to weigh in first. I'm not sure that letting one author decide what font should be used where is a good idea. There are relatively few matching questions compared to other kinds of questions, so this probably isn't going to upset anyone if we make a change.

It probably does provide some additional room. I still think the fundamental problem remains. We can't just create horizontal space where there isn't any. I think we can increase the horizontal space by creating an attribute for an exercise that says "please give me all the width." Beyond that it is going to take some work or compromise to write the questions in a way that works with the medium.

bnmnetp avatar May 14 '25 18:05 bnmnetp

I'm not too worried about the horizontal space. We were seeing overflows because one person tried to hack their way out of the monospace font. If you simply write text without markup (other than math tags), text wraps just fine within the cards.

Some people might like to have monospace, which is why I was wondering if there is some markup we can use (like <p>) to change the font.

sean-fitzpatrick avatar May 14 '25 18:05 sean-fitzpatrick

@bnmnetp Turning your assertion on its head... Unless there is a good reason to change the font in a particular context it seems much better to not modify it than to modify it because one developer thought a particular font looked nice in that place. What is the design reason that they should be monospace?

There are lots of ways to turn on monospace with PTX markup. We don't need to randomly default to it in some places and then invent ways to turn it off.


But yes, agree that authors will need to live within the available space. It is on them to break up long equations if necessary. All we can do is give them reasonably reasonable and predictable amounts of space.

ascholerChemeketa avatar May 14 '25 18:05 ascholerChemeketa

It probably wasn't just one developer, as for most of these things we made some attempts and got feedback from a number of authors before committing to a style that has lasted a decade. I'm trying to listen and be accommodating so that things look good for all kinds of questions.

Back when these were created, we didn't even allow markup to be apart of the premise or response, they were just text. So I 100% agree that with PreTeXt there are lots of ways to control the font and so removing those rules is probably the right thing to do.

bnmnetp avatar May 14 '25 18:05 bnmnetp

Maybe everybody gets this, but a PreTeXt author has little control over fonts. em will be italic, c will be monospace, etc, so there are font changes -- we just regulate how/why that happens. We (Brad, Andrew) can control how those things happpen in specific instances like a box of a matching problem..

rbeezer avatar May 14 '25 19:05 rbeezer

OK, I ended up doing a release this afternoon, with the font-family and font-size rules removed. Maybe that will help some.

bnmnetp avatar May 14 '25 22:05 bnmnetp