Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

An idea for responsive display style equations #1012

Closed
aterenin opened this issue Dec 6, 2017 · 3 comments
Closed

An idea for responsive display style equations #1012

aterenin opened this issue Dec 6, 2017 · 3 comments

Comments

@aterenin
Copy link
Collaborator

aterenin commented Dec 6, 2017

One of the difficulties with designing responsive math is that it is a priori unclear how to resize or break a user's equation if it is too wide to display on mobile devices.

I propose to handle this by allowing use of the TeX hyphenation macro \-. It would work as follows.

  • A user may use the \- command once per line in a display style equation.
  • If the equation is too large, everything after \-, is moved to the next line and right-aligned.

I'd be curious to hear thoughts. This won't cover every situation, but I think would cover most, and is better than having no responsive support at all. It could be added as a contrib module.

@edemaine
Copy link
Member

edemaine commented Dec 6, 2017

Great idea to tackle this! I'd rather do something fully LaTeX compatible. According to this, there seem to be two main packages for automatic line breaking of equations (which we could try to implement support of in KaTeX):

The autobreak package sounds similar to your solution, in that you need to add explicit candidate line breaks. But it does so with \n, a bit of a weird choice... Maybe worth checking out breqn in more detail.

@aterenin
Copy link
Collaborator Author

aterenin commented Dec 7, 2017

I'm not familiar with either of those packages, but autobreak seems like it would work well. Its behavior is very much like the idea above, except that it treats newlines as break candidates, and requires breakable math to be wrapped in \begin{autobreak}. This seems like it would be a good addition in my view.

@edemaine
Copy link
Member

edemaine commented Dec 7, 2017

I looked more closely at both and agree with your assessment. autobreak seems relatively clean in design (though I'm still a little confused how it interacts with arrays) and hopefully not too hard to implement. I'm a little surprised that there isn't a way to automatically wrap all display math in \begin{autobreak}, but this does give more control (especially as relates to arrays).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants