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.

Fraction bars disappear when printing webpages into PDFs.

See original GitHub issue

Hello, I’m using KaTeX 0.10.0-beta and a fresh installation of Google Chrome Beta 69.0.3497.23 on Ubuntu 18.04 (to make sure that all preferences are defaults). I’m considering printing webpages with math formulas into PDFs. But I came across some issues with fractions.

For example:

<!DOCTYPE html>
<html>
<head>
  <link href="katex/katex.min.css" type="text/css" rel="stylesheet">
  <script src="katex/katex.min.js" type="text/javascript"></script>
  <script src="katex/contrib/auto-render.min.js" type="text/javascript"></script>
  <script>
    document.addEventListener("DOMContentLoaded", function() {
      renderMathInElement(document.body, options = {delimiters: [{ left: "$$", right: "$$", display: true }, { left: "$", right: "$", display: false }]});
    });
  </script>
</head>
<body>
<p>inline math: ${2 \over n}$.</p>
<p>display math:
$$
f^{(n)}(x) = \begin{cases}
x + nb &amp; (a = 1) \\
a^n\ x + {a^n - 1 \over a - 1} \cdot b &amp; (a &gt; 1)
\end{cases}
$$
</p>
</body>
</html>

Print it via Chrome and will get:

Press “F12” to add the following CSS code:

.katex {
    font-size: 1em;  /* or even smaller */
}

Reprint and get:

I have also tried https://khan.github.io/KaTeX/ and set font-size to 0.3em and came across the same issue. I wonder why printed PDFs would be different from original webpages. Is that a bug in Chrome or KaTeX?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:11 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
ronkokcommented, Aug 14, 2018

@mbourne Thanks for the feedback. I’ve re-opened the PR.

0reactions
mikepiercecommented, Dec 15, 2022

I’m going to close this issue, as resolved by PR #1594. We may get a complaint someday for frac-bars that print too thick, but that will be a different issue.

I came here looking to complain about exactly that 😉

08December2022-1670551638

That’s a screenshot of PDF, printed from a webpage, of an in-line fraction.

Update before I leave for winter: Here’s screenshots of a PDFs created by chrome-beta (left) and by firefox (right) with only CSS specifying 9pt font.

screenshot

@media only print {
    body {font-size:9pt;}
}

Increasing the font-size to 12pt got rid of the visual difference. This isn’t a serious problem for me though, and looking through the issues y’all know about this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

When You See Thin White Lines in Your PDF Files
The lines will still show up when your pdf is rasterized which means they may cause problems in print, and they will definitely...
Read more >
Disappearing or Strange Looking Elements in the PDF
If elements disappear from the PDF after uploading to E-pages it may be because of the use of layers and layers with transparency...
Read more >
Hiding the toolbars surrounding an embedded pdf?
It works for me with the caveat that when I refresh (using Chrome) the toolbar appears again. I am trying to figure out...
Read more >
If you can't find a button or control in Pages on Mac
Click your Pages document and make sure the menu bar shows Pages next to the Apple menu . If the toolbar is missing...
Read more >
10 annoying Word features (and how to turn them off)
Solution: Direct the user's attention to the Close Full Screen View button at the bottom of the window (depending on the version) or...
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