question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

\tag is expected to be always flushed at right when equation is overflowed

See original GitHub issue

Before reporting a bug

Describe the pool rendering: For a long equation set to overflow-x: auto, the right-end \tag{} will overlap and scroll with the equation. You can use Eqs. 7.85 and 7.86 as a test case (with a narrow window), available here.

// allow katex equations scrolling horizontally, without vertical scrollbar
.katex-display > .katex {
    height: auto;
    overflow: hidden;
    overflow-x: auto;
}

Expected behavior: The \tag will be flush right no matter the equation is scrollable or not. I’m not familiar with CSS. I tried to play around

.katex-display>.katex>.katex-html>.tag {
    position: absolute;
    right: 0;
}

A feature of position mixturing absolute and static should be perfect. sticky doesn’t fit in current setting, it is a mixturing of relative and fixed as I understand.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
mbournecommented, Jul 19, 2022

Any update/process on this?

0reactions
arctic-hen7commented, Nov 15, 2022

I’ve been able to ‘fix’ (i.e. hack my way out of) this problem with the following CSS (closely inspired by @martinpflaum’s suggestion):

.katex-display > .katex > .katex-html > .tag {
  position: relative !important;
  right: -5rem !important;
}

@media (min-width: 1280px) {
  .katex-display > .katex > .katex-html > .tag {
    position: absolute !important;
    right: 1rem !important;
  }
}

On small screens (i.e. anything less than 1280px in this example), this will position the tag relatively to the equation, shifting it over by 5rem to give it some space. However, on larger screens, this leads to the tags being all out of sync, which looks frankly awful, so the second part of this just makes them absolutely positioned again in such cases (the right positioning there is just personal preference for me). It’s not perfect, especially not on tablet screens, but it’s better than the overlap.

Would it be appropriate to submit a PR for this, at least until someone comes up with something better? The default behavior at the moment is hardly ideal…

Read more comments on GitHub >

github_iconTop Results From Across the Web

flalign, leqno and equations left aligned. Overlapping of ...
How can I have automatic and consistent spacing for tags exactly as if they were set to the default position (right)?. Right tags...
Read more >
Equation numbering in Jupyter notebooks - Stack Overflow
\tag : the label appearing next to the equationcan be a number or letters ... Go to your Jupyter Notebook editor (I am...
Read more >
Specificity - CSS: Cascading Style Sheets - MDN Web Docs
The specificity for a required input nested in an element with attribute id="myApp" is 1-2-1 , based on one ID, two pseudo-classes, ...
Read more >
Clustering 4000 Stack Overflow tags with BigQuery k-means
BigQuery ML does a good job of hot-encoding strings, but it doesn't handle arrays as I wish it did (stay tuned). So I'm...
Read more >
Auto align left equations in Office Word 2013? - Super User
You can define defaults like this in Equation Options. Insert an equation (it will be centered, by default) and place the cursor anywhere...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found