Start by locating the layer that is shrinking the equation. If only inline mathematics is small, MathJax is probably applying its intentional inline sizing. If the browser preview is correct but the PDF is tiny, wkhtmltopdf is usually changing scale, viewport, media, or WebKit’s smart-shrinking behavior. Compare the same page in a browser and in the PDF, then change one setting at a time.
1. Decide whether the size is actually wrong
MathJax treats inline and display mathematics differently. Inline expressions such as (E=mc^2) must fit inside a line of prose, so MathJax compresses fractions, roots, and other constructs to protect line spacing. Display expressions such as [E=mc^2] or $$E=mc^2$$ receive their own vertical space and normally appear larger. The MathJax FAQ documents this behavior and also warns that changing surrounding font sizes after typesetting can leave equations too small: MathJax FAQ.
- If only inline equations look smaller than body text, use display math for expressions that deserve emphasis instead of globally enlarging MathJax.
- If both inline and display equations are tiny in the browser, inspect MathJax configuration, inherited CSS, and the output processor.
- If the browser is correct but wkhtmltopdf is not, leave the MathJax markup alone and test wkhtmltopdf’s rendering controls.
2. Compare browser HTML with the generated PDF
Render the exact URL or HTML in a current browser first. Record whether inline math, display math, equation numbers, line wrapping, and page width look correct. Then run the same input through the exact wkhtmltopdf executable used in production. This split prevents a PDF-only zoom fix from masking a CSS or MathJax problem.
When HTML is already too small
Check the MathJax major version and output processor, the font size on the equation’s parent element, and any stylesheet loaded after MathJax has finished. MathJax’s documentation cautions that post-typesetting font changes can make the generated mathematics no longer match surrounding text. Put the intended font sizing in CSS before typesetting, or trigger a deliberate re-typeset after changing it.
#1 Best Overall
When only the PDF is too small
Investigate viewport width, zoom, smart shrinking, print media, and JavaScript timing. Do not change all of them together: each can alter page fit and line breaks in a different way.
3. Fix the viewport before changing scale
A missing or incorrect viewport can make MathJax calculate an unexpectedly small layout. MathJax 2.7 states: “Incorrect or missing viewport information can confuse MathJax’s layout process, leading to very small font sizes.” Add this to the document’s <head>:
<meta name="viewport" content="width=device-width, initial-scale=1">
Then give wkhtmltopdf a deliberate viewport that matches the CSS design width. For example:
wkhtmltopdf --viewport-size 1280x900 https://example.com/math.html math.pdf
The correct width depends on your layout. A very wide viewport can make the page scale down to fit a paper sheet; a very narrow one can cause wrapping and taller pages. Confirm the result in the PDF rather than assuming that a larger number always produces larger equations.
4. Adjust MathJax with the options for your installed version
MathJax 2 HTML-CSS output
MathJax 2’s HTML-CSS processor documents scale as the math size relative to surrounding text and minScaleAdjust as a lower bound when matching available fonts. The documented defaults are scale: 100 and minScaleAdjust: 50: MathJax 2.7 HTML-CSS options.
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
"HTML-CSS": {
scale: 110,
minScaleAdjust: 70
}
});
</script>
Increase scale modestly, regenerate the PDF, and inspect page fit. Raising minScaleAdjust prevents excessive shrinking when MathJax is selecting a font, but it can increase line height or cause overflow on constrained pages. These names apply to MathJax 2’s HTML-CSS processor, not automatically to MathJax 4.
MathJax 4 output
MathJax 4 exposes common output options documented at MathJax 4 output options. Use scale for a relative size and minScale to stop matching from shrinking equations below a chosen fraction; the documented default for minScale is .5. Put shared settings in the common output configuration if your application can switch renderers.
<script>
MathJax = {
output: {
scale: 1.1,
minScale: 0.7
}
};
</script>
Load this configuration before the MathJax script. Do not paste MathJax 2’s MathJax.Hub.Config block into a MathJax 4 page; verify the installed version and adapt the option names.
Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Repair Windows errors before they cause bigger problemsFix Now →Choose the right semantic fix
- Use display delimiters when an equation should read as a separate, prominent line.
- Use a local CSS rule on a specific formula container when only one component needs adjustment.
- Use a global MathJax scale only when the entire document consistently needs a different relationship between text and mathematics.
5. Isolate wkhtmltopdf’s scaling controls
The wkhtmltopdf command-line documentation lists independent controls for zoom, smart shrinking, viewport size, print media, and JavaScript execution: wkhtmltopdf CLI usage. Start with a baseline:
wkhtmltopdf --enable-javascript https://example.com/math.html baseline.pdf
Test --zoom
--zoom defaults to 1. Try a small controlled change such as --zoom 1.1:
wkhtmltopdf --zoom 1.1 https://example.com/math.html zoom-110.pdf
Zoom affects the whole page, not just mathematics. Check margins, headings, table widths, page count, line wrapping, and equation numbers. There is no universal zoom value for every CSS width and paper format.
Test smart shrinking
wkhtmltopdf’s smart-shrinking strategy changes the pixel-to-DPI relationship to make content fit the page. Compare the default with:
Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchPC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11wkhtmltopdf --disable-smart-shrinking https://example.com/math.html no-shrink.pdf
Some packaged builds handle this option differently or omit it. Verify behavior with the executable and binding deployed in your environment. Disabling shrinking can make text and equations larger while allowing content to run beyond the printable width.
Test print media
If your stylesheet contains separate @media print rules, add:
wkhtmltopdf --print-media-type https://example.com/math.html print-css.pdf
Compare the PDF with and without this flag. A print rule may deliberately reduce font sizes, change widths, or hide containers that MathJax uses.
Rank #4
Wait for MathJax to finish
wkhtmltopdf can execute JavaScript after the page has loaded. Its --run-script option is documented for this purpose, but running a script is not the same as proving that MathJax has completed typesetting. Prefer a page-side readiness marker:
The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →<script>
window.mathJaxReady = false;
window.MathJax = {
startup: {
pageReady: () => MathJax.startup.defaultPageReady().then(() => {
window.mathJaxReady = true;
})
}
};
</script>
In an application wrapper, wait until window.mathJaxReady === true before invoking wkhtmltopdf. If you cannot control the wrapper, a carefully chosen delay is less reliable because network speed and formula complexity vary.
6. Consider SVG output when font rendering is the culprit
MathJax’s output-format documentation describes SVG as high quality and print-friendly across browsers, avoiding some HTML-CSS font problems: MathJax output formats. MathJax 2’s format guide is at MathJax 2.7 output formats.
SVG is not a free layout fix. The documentation notes that variable-width tables become fixed after typesetting, which can affect equation-number alignment if the page is resized later. Switch output mode only after confirming that font rendering, rather than viewport or wkhtmltopdf scaling, is the cause. Always inspect the final PDF at normal and high zoom.
7. A repeatable one-change-at-a-time workflow
- Save a browser screenshot and a baseline PDF from the same HTML.
- Classify each problem as inline-only, all MathJax in HTML, or PDF-only.
- Add the viewport meta tag and set an explicit
--viewport-size. - Confirm the MathJax major version and output processor.
- Change one MathJax option or one wkhtmltopdf option, then save a new PDF.
- Check inline and display equations, fractions, roots, equation numbers, page fit, margins, and line wrapping.
- Keep the smallest change that fixes size without damaging pagination.
8. Troubleshooting symptoms and fixes
| Symptom | Likely cause | Fix to test |
|---|---|---|
| Only inline equations are small | Normal MathJax inline sizing | Use display delimiters for important standalone equations; do not globally scale first. |
| Browser and PDF are both small | CSS, viewport, or MathJax configuration | Add the viewport meta tag, inspect inherited font size, and use version-correct MathJax options. |
| Browser is correct; PDF is tiny | Zoom, smart shrinking, viewport, or print CSS | Test --zoom, --disable-smart-shrinking, --viewport-size, and --print-media-type separately. |
| Equations are missing or partially rendered | Capture occurred before MathJax finished | Wait for a MathJax readiness signal; do not rely only on a fixed delay. |
| Changing zoom breaks page layout | Whole-page scaling | Undo zoom and adjust MathJax scale or the CSS container instead. |
| Equation numbers drift after SVG conversion | Fixed-width SVG tables after typesetting | Validate at the final viewport and avoid resizing the already-typeset layout. |
| CLI flag has no visible effect | Different distro build or library binding | Check the actual executable’s help output and the library settings reference: wkhtmltopdf library settings. |
9. Or skip the browser setup
If you need a clean capture for a rendered page rather than a locally tuned wkhtmltopdf pipeline, ScreenshotNeo provides a website screenshot API and MCP server. It accepts consent banners before capture and removes more than 60 known consent platforms, newsletter popups, and chat widgets; bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers identify the page verdict and billing status. Its MCP tools—take_screenshot, get_page_info, and capture_pdf—work with Claude, Cursor, and other MCP clients.
Free tools Windows power users keep installed
One-click scans. No signup required.
Use the API call below (replace the URL with the page containing your MathJax):
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
Other runnable clients are available when integrating into a build:
import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
See the parameter and response details in the ScreenshotNeo documentation. Every feature is included on every plan: full-page and element capture, device and viewport control, retina scale, PDF paper and margin settings, custom CSS or JavaScript, waits, blocking rules, cookies and headers, timezone and geolocation, resizing, cache TTLs, signed links, asynchronous webhooks, bulk capture of up to 100 URLs per call, usage reporting, and an OpenAPI specification. The parameter names used by other screenshot APIs also work, which can simplify migration.
The Free plan includes 1,000 screenshots per month without a card. Paid plans start at $5 for 3,000 shots; yearly billing gives two months free. Create a free ScreenshotNeo account.
Recommended Free Tools
10. Validate the finished PDF
Open the final file in the viewer your users will use. Check a representative inline formula, a multi-line display equation, a fraction, a radical, an equation with a number, and a page near the widest content. Confirm that text remains selectable if your workflow requires it, that no formula is clipped, and that page breaks are acceptable. Keep the exact wkhtmltopdf version, MathJax version, viewport, and options in your build configuration so a future package update does not silently change sizing.
Frequently Asked Questions
Should I increase MathJax’s scale or wkhtmltopdf’s zoom first?
Compare browser and PDF output first. Increase MathJax settings when HTML is already small; test wkhtmltopdf zoom or shrinking only when the browser is correct.
Does disabling smart shrinking always make equations readable?
No. It can enlarge the page while causing horizontal overflow or different pagination. Compare it with the default on your paper size and CSS width.
Can native MathML solve the problem?
Do not treat it as a universal workaround. Rendering quality, spacing, and font support depend on the target renderer; MathJax’s documented output modes should be tested against the final PDF.
Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Fix the driver behind crashes, sound loss and screen glitches3Clear out junk files and repair common Windows errorsQuick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

