/** * Creates {@link WebPageOutputOptions} suitable for creating an HTML 5 web page with * embedded MathML, using MathJax for cross-browser rendering of the MathML. * <p> * This is one of the most effective web page outputs. * * @see #createXHTMLMathJaxOptions() * * @param customMathJaxUrl custom MathJax URL, which can be used to point to a local * installation of MathJax or pass custom configuration details to MathJax. */ public static final WebPageOutputOptions createHTML5MathJaxOptions(String customMathJaxUrl) { WebPageOutputOptions options = createHTML5MathJaxOptions(); options.setCustomMathJaxUrl(customMathJaxUrl); return options; }
public static void main(String[] args) throws IOException { /* Create vanilla SnuggleEngine and new SnuggleSession */ SnuggleEngine engine = new SnuggleEngine(); SnuggleSession session = engine.createSession(); /* Parse some very basic Math Mode input */ SnuggleInput input = new SnuggleInput("$$ a^2 = b^2 + c^2 $$"); session.parseInput(input); /* Create "options" Object to SnuggleTeX what kind of web page we want. We're going * to generate one that will work fine with MOZILLA and tweak a few options, just for * fun! */ WebPageOutputOptions options = WebPageOutputOptionsBuilder.createHTML5MathJaxOptions(); options.setTitle("My Web Page"); options.setAddingTitleHeading(true); options.setIndenting(true); options.setAddingMathSourceAnnotations(true); options.setIncludingStyleElement(false); /* Now ask SnuggleTeX to write the resulting output to the console. * (You would normally send the output somewhere more interesting, though!) */ session.writeWebPage(options, System.out); } }