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

Mathjax formulas looking "bold" when exported to pdf on some pdf viewers #287

Closed
Prki42 opened this issue Feb 26, 2022 · 2 comments · Fixed by #290
Closed

Mathjax formulas looking "bold" when exported to pdf on some pdf viewers #287

Prki42 opened this issue Feb 26, 2022 · 2 comments · Fixed by #290
Labels
bug Something isn't working

Comments

@Prki42
Copy link

Prki42 commented Feb 26, 2022

Version of Marp Tool

Marp CLI v1.7.0

Operating System

Windows

Environment

  • OS version: Windows 10 (running in wsl2)
  • WSL Ubuntu version: Ubuntu 20.04.3 LTS
  • Node.js version: v17.3.0
  • Marp CLI version: v1.7.0
  • Marp core version: v2.3.2

How to reproduce

  1. Use mathjax for math formulas
  2. Export pdf using marp cli
  3. Open pdf in web browser (tried in Firefox, Chrome and Microsoft Edge)

Expected behavior

This is how it looks when using html preview
firefox_eRrUJKUK0L

Actual behavior

Looks a bit bolder than when using html preview
firefox_vyYMJND3ZP

When zoomed out
firefox_7D3HSvDeSk

Additional information

This problem is observed to only happen on web browsers' pdf viewers (Firefox, Chrome, Edge). On some standalone pdf viewers problem is not present. Also, if katex is used the problem doesn't persist.

@Prki42 Prki42 added the bug Something isn't working label Feb 26, 2022
@yhatt
Copy link
Member

yhatt commented Mar 6, 2022

I think it is bringing from both of line rendering by viewers and thickening by MathJax. (KaTeX is not affected this problem because it will render math typesettings as text with the custom font)

Yes, there is almost no difference between 1 and 3 when the em-size is 1000. The non-zero amount was to make some very thin areas (like in the italic lower-case "o") less likely to disappear, but I would guess 1 would do just as well. The idea was to have at least some stroke-width, and not just fill, since some areas get very thin.

mathjax/MathJax#2618 (comment)

You can tweak its style for PDF output by <style> tag.

<style>
@media print {
  mjx-container[jax="SVG"] :is(use[data-c], path[data-c]) {
    stroke-width: 0;
  }
}
</style>

If this tweak was working well, we may consider to add this style into Marp Core as the default style for MathJax.

@Prki42
Copy link
Author

Prki42 commented Mar 8, 2022

Thanks for your reply! This solved the problem. Also, for this to work the newer version of chromium is needed (initially I tried on 88 and it didn't work but when I updated to 99 it worked).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants