A Multiformat Document Workflow With Docutils

Post on 16-Jan-2015

1.486 views 4 download

description

Docutils is my method for producing web pages in multiple formats, notable html and pdf. These are slides I gave for a 15-minute talk at the Joint Mathematics meetings in San Francisco in January 2009.

Transcript of A Multiformat Document Workflow With Docutils

A Multiformat Document Workflow

using DocutilsMatthew LeingangNew York University

MAA Session on Publishing Math on the WebSan Francisco, CAJanuary 15, 2010

Multiformat

∞�

n=1

1

n2=

π2

6

Multiformat

∞�

n=1

1

n2=

π2

6

∞�

n=1

1

n2=

π2

6

Multiformat

HTML

HTML

Take a Picture?

Firefox

Google Chrome

LaTeX

A third way?

Docutils

http://docutils.sourceforge.net/∞�

n=1

1

n2=

π2

6

Docutils has many products

PythonCode

Docutils has many products

PythonCode ReST

Docutils has many products

PythonCode

XHTML

ReST

Docutils has many products

PythonCode

XHTML

ReST

LaTeX

Docutils has many products

PythonCode

XHTML

ReST

LaTeX

PDF

Docutils has many products

PythonCode

XHTML

ReST

LaTeX

PDFtroff

Docutils has many products

PythonCode

XHTML

ReST

LaTeX PDF

PDFtroff

Docutils has many products

PythonCode

XHTML

ReST

LaTeX PDF

XHTML

PDFtroff

Docutils has many products

XHTML

ReST

LaTeX PDF

XHTML

ReStuctured Text is human- and machine-readable

ReStuctured Text is human- and machine-readable

San Francisco is \emph{beautiful} in January!LATEX

ReStuctured Text is human- and machine-readable

San Francisco is \emph{beautiful} in January!

San Francisco is <strong>beautiful</strong> in January!

LATEX

HTML

ReStuctured Text is human- and machine-readable

San Francisco is \emph{beautiful} in January!

San Francisco is <strong>beautiful</strong> in January!

San Francisco is *beautiful* in January!

LATEX

ReST

HTML

SectionsTitle!!!!!

Introduction============

Math on the Web===============

XHTML-----

XHTML is an application ...

SectionsTitle!!!!!

Introduction============

Math on the Web===============

XHTML-----

XHTML is an application ...

Configured by your usage

LinksI'm going to JMM_ this year to give a talk__ on docutils. It’s a text format and suite of scripts with multiple output formats.

.. _JMM: http://www.ams.org/amsmtgs/2124_intro.html__ http://www.ams.org/amsmtgs/2124_abstracts/1056-n5-630.pdf

ReST

Demonstration

∞�

n=1

1

n2=

π2

6

Adding LaTeX to ReST

Do an example such as :latex:`$\int x^2e^x\,dx$` where they have to integrate by parts twice, an example suchas :latex:`$\int e^x \sin x\,dx$` where they have to integrate by parts twicethen solve for the original integral, and an example where :latex:`$dv = dx$`works.

Adding a role to docutilsdef latex_role(role, rawtext, text, lineno, inliner,options={}, content=[]): """ Latex role. """

i = rawtext.find('`') tex = rawtext[i+1:-1] return latex_math(tex), [] def register(): register_canonical_role('latex', latex_role)

Adding a role to docutilsdef latex_role(role, rawtext, text, lineno, inliner,options={}, content=[]): """ Latex role. """

i = rawtext.find('`') tex = rawtext[i+1:-1] return latex_math(tex), [] def register(): register_canonical_role('latex', latex_role)

Adding a role to docutilsdef latex_role(role, rawtext, text, lineno, inliner,options={}, content=[]): """ Latex role. """

i = rawtext.find('`') tex = rawtext[i+1:-1] return latex_math(tex), [] def register(): register_canonical_role('latex', latex_role)

Processing LaTeX

with demos

∞�

n=1

1

n2=

π2

6

Processing LaTeX •latex + dvipng

with demos

∞�

n=1

1

n2=

π2

6

Processing LaTeX •latex + dvipng

•docutils MathML writer

with demos

∞�

n=1

1

n2=

π2

6

Processing LaTeX •latex + dvipng

•docutils MathML writer

•tth

with demos

∞�

n=1

1

n2=

π2

6

TTHhttp://hutchinson.belmont.ma.us/tth/

Thanks

∞�

n=1

1

n2=

π2

6

@mleingang#JointMath