Home Reading Searching Subscribe Sponsors Statistics Posting Contact Spam Lists Links About Hosting Filtering Features Download Marketing Archives FAQ Blog From: Dan Davison stats.ox.ac.uk> Subject: publishing pretty code with maths; jsMath -> pdf Newsgroups: gmane.emacs.orgmode Date: Friday 30th July 2010 04:13:59 UTC (over 7 years ago) I've recently realised that when mixing code and maths one can get the best of both HTML and LaTeX worlds by using jsMath[1] to export to HTML and then creating a pdf from that. Just in case this wasn't already obvious to people, here's an example. The HTML output is here (the jsmath should[2] display) http://www.princeton.edu/~ddavison/software/jsmath/jsmath.html and the pdf output is here, with nice code fontification as well as crisp fonts for the mathematical notation. http://www.princeton.edu/~ddavison/software/jsmath/jsmath.pdf Here's the org input -------------------------------------------------------------- #+title:jsMath #+style: #+options: latex:verbatim toc:nil author:nil timestamp:nil creator:nil This should appear via jsMath: $\int_{0}^{\infty} bxe^{-bx} dx = \frac{1}{b}$ and here's the dvipng output for comparison [[file:exp.png]] And here's some code that will be nicely formatted in the html and pdf. #+begin_src R :exports both ## Mean of a sample of random numbers f <- function(n, b) mean(rexp(n, b)) f(1000, 4) #+end_src #+results: : 0.248342091803384 The pdf is [[./jsmath.pdf][here]]. -------------------------------------------------------- If you want to use src blocks for the latex, begin_src latex :results raw :exports results will do the job. This arose because I recently had to produce a document containing code and maths. I decided to export to HTML in order to get pretty code fontification, and then to use the web browser to produce a pdf so that everything was in a single file. The trouble is of course the nasty dvipng images of latex fragments. (Not org's fault -- the web's crawling with them.) As a result I revisited that file using jsMath for the latex fragments: no more fuzzy images of equations. Furthermore, using the web browser to export to pdf creates a very nice looking pdf with the htmlized emacs code buffers mixed with mathematical notation using proper fonts. And you can send it to people who don't have jsMath installed. Dan Footnotes: [1] http://orgmode.org/worg/org-tutorials/org-jsmath.php http://www.math.union.edu/~dpvc/jsMath/ [2] I've put jsMath on that server so it should display for you -- but I had no luck with chrome; try firefox instead. _______________________________________________ Emacs-orgmode mailing list Please use Reply All' to send replies to the list. [email protected] http://lists.gnu.org/mailman/listinfo/emacs-orgmode`
CD: 3ms
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.6837339997291565, "perplexity": 5811.461930906594}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2018-22/segments/1526794867841.63/warc/CC-MAIN-20180526170654-20180526190654-00333.warc.gz"}