/** * 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; }
/** * 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() */ public static final WebPageOutputOptions createHTML5MathJaxOptions() { WebPageOutputOptions options = createHTML5Options(); options.setMathJax(true); return options; }
/** * Create "Cross-browser" XHTML + MathML suitable for deploying to Mozilla and * Internet Explorer + MathPlayer using a client-side XSLT often called the "Universal StyleSheet". * <p> * See <a href="www.w3.org/Math/XSL/Overview-tech.html">XSLT Stylesheets for MathML</a> * for more details. * <p> * You must specify a URL for the client-side XSLT stylesheet that will be referenced in * the resulting web page so that it is available to browsers. You will need to take into * account security restrictions, such as "same domain", so will probably need to make sure * you put the XSLT somewhere that is "local" to where you are serving up your pages. * <p> * Note that the SnuggleTeX source distribution contains a slightly fixed version of the * USS that works in versions of IE newer than 6, but hasn't been extensively tested. * <p> * This is a niche output kept around for legacy purposes. You should look at some of the * newer HTML5 + MathJax-related options for better compatibility and easier deployment. * * <h3>Technical notes</h3> * * The resulting page is created with an XML declaration but no DOCTYPE declaration. * <p> * The <strong>pref:renderer</strong> attribute on the <tt>html</tt> element will be set * to <tt>mathplayer-dl</tt>. */ public static final WebPageOutputOptions createUniversalStylesheetOptions(String clientStylesheetUrl) { return createUniversalStylesheetOptions(clientStylesheetUrl, "mathplayer-dl"); }
/** * Creates {@link WebPageOutputOptions} suitable for creating an XHTML + MathML web page, * using MathJax for cross-browser rendering of the MathML. * <p> * This is one of the most effective web page outputs. * * @see #createHTML5MathJaxOptions() * * @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 createXHTMLMathJaxOptions(String customMathJaxUrl) { WebPageOutputOptions options = createXHTMLMathJaxOptions(); 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); } }