Author: milde Date: 2010-09-21 14:51:29 +0200 (Tue, 21 Sep 2010) New Revision: 6431 Added: trunk/docutils/tools/rst2xetex.py Modified: trunk/docutils/docs/dev/todo.txt trunk/docutils/docutils/writers/xetex/__init__.py trunk/docutils/setup.py trunk/docutils/test/functional/expected/standalone_rst_xetex.tex trunk/docutils/test/functional/output/standalone_rst_xetex.tex Log: XeTeX writer update/bugfix/completion rst2xetex.py front end, install xetex writer with setup.py, no hyphenation in literal text. Modified: trunk/docutils/docs/dev/todo.txt =================================================================== --- trunk/docutils/docs/dev/todo.txt 2010-09-21 12:07:13 UTC (rev 6430) +++ trunk/docutils/docs/dev/todo.txt 2010-09-21 12:51:29 UTC (rev 6431) @@ -1066,6 +1066,16 @@ Build on existing extensions (`latex_math`_, `math support in Sphinx`_). + Use MathJax_ for HTML export? + + * a JavaScript-based engine for including TEX and MathML in HTML + * Works across multiple browsers and platforms + * Uses HTML/CSS, JavaScript, and unicode fonts for high-quality + typesetting that is scalable and prints at full resolution. + * MathJax is a joint project of the AMS, Design Science, Inc., and + the Society for Industrial and Applied Mathematics. + * `Math support in Sphinx`_ uses MathJax. + Both a directive and an interpreted text role will be necessary (for each markup). Directive example:: @@ -1083,6 +1093,7 @@ .. _MathML: http://www.w3.org/TR/MathML2/ .. _itex: http://pear.math.pitt.edu/mathzilla/itex2mmlItex.html .. _ASCIIMathML: http://www1.chapman.edu/~jipsen/mathml/asciimath.html + .. _MathJax: http://www.mathjax.org/ .. _Unicode Nearly Plain Text Encoding of Mathematics: http://www.unicode.org/notes/tn28/ @@ -1782,16 +1793,16 @@ + based on bibstuff_? + also have a look at - * CrossTeX_, a backwards-compatible, improved bibtex - re-implementation in Python (including HTML export). - (development stalled since 2 years) + * CrossTeX_, a backwards-compatible, improved bibtex + re-implementation in Python (including HTML export). + (development stalled since 2 years) * Pybtex_,a drop-in replacement for BibTeX written in Python. - * BibTeX styles & (experimental) pythonic style API. - * Database in BibTeX, BibTeXML and YAML formats. - * full Unicode support. - * Write to TeX, HTML and plain text. + * BibTeX styles & (experimental) pythonic style API. + * Database in BibTeX, BibTeXML and YAML formats. + * full Unicode support. + * Write to TeX, HTML and plain text. * Automatically insert a "References" heading? @@ -2159,13 +2170,13 @@ .. Footnote packages: :footnote: texlive-latex-recommended % savenotes environment - :footmisc: texlive-latex-extra % formatting options + :footmisc: texlive-latex-extra % formatting options :manyfoot: texlive-latex-extra :bigfoot: texlive-latex-extra :perpage: texlive-latex-extra :ftnxtra: new on CTAN - fixes the issue of footnote inside \caption{}, - tabular environment and \section{} like commands. + fixes the issue of footnote inside \caption{}, + tabular environment and \section{} like commands. German tutorial: @@ -2196,7 +2207,7 @@ * Take advantage of the fact that the mandatory argument doesn't move if the optional argument is present:: - \section[title] {title\footnote{title ftnt}} + \section[title] {title\footnote{title ftnt}} * Use the footmisc package, with package option stable - this modifies footnotes so that they softly and silently vanish away if used in a @@ -2273,12 +2284,12 @@ * Improve/simplify logic to set the column width in the output. - + Assumed reST line length for table width setting configurable. - + Maybe use `ltxtable` (a combination of `tabularx` (auto-width) and - `longtable` (page breaks))? + + Assumed reST line length for table width setting configurable, or + + use `ltxtable` (a combination of `tabularx` (auto-width) and + `longtable` (page breaks)), or + + use tabularx column type ``X`` and let LaTeX decide width, or + + use tabulary_? - Use tabularx column type ``X`` and let LaTeX decide width? - * csv-tables do not have a colwidth. * Add more classes or options, e.g. for @@ -2314,6 +2325,10 @@ table title. In analogy to the 'figure' directive this should map to a table float. +.. _tabulary: + http://tug.ctan.org/cgi-bin/ctanPackageInformation.py?id=tabulary + + Image and figure directives ``````````````````````````` @@ -2407,26 +2422,9 @@ XeTeX writer ```````````` -Generate LaTeX source code suitable for XeLaTeX. +* Glyphs missing in the font are left out in the PDF without warning + (e.g. ⇔ left-right double arrow in the functional test output). - You will need to do three things to your source document to convert it - to XeLaTeX: - - 1) save the source as UTF-8 - 2) remove any fontenc/inputenc/mathptmx - 3) add the following to your preamble: - - \usepackage{xltxtra} - \setmainfont[Mapping=tex-text]{Times New Roman} - - This will use the real Times New Roman font. - - -- a comp.text.tex post by Alan Munn 2010-05-10 - -Use a separate writer (inheriting from latex2e) instead of a ``--xetex`` -option, to allow separate config options for XeTeX vs. LaTeX2e. - - problematic URLs ```````````````` Modified: trunk/docutils/docutils/writers/xetex/__init__.py =================================================================== --- trunk/docutils/docutils/writers/xetex/__init__.py 2010-09-21 12:07:13 UTC (rev 6430) +++ trunk/docutils/docutils/writers/xetex/__init__.py 2010-09-21 12:51:29 UTC (rev 6431) @@ -31,11 +31,12 @@ """Formats this writer supports.""" default_template = 'xelatex.tex' - default_preamble = '\n'.join([r'% PDF Standard Fonts', - r'\setmainfont{Times New Roman}', - r'\setsansfont[Scale=MatchLowercase]{Arial}', - r'\setmonofont[Scale=MatchLowercase]{Courier New}', - ]) + default_preamble = '\n'.join([ + r'% PDF Standard Fonts', + r'\setmainfont{Times New Roman}', + r'\setsansfont[Scale=MatchLowercase]{Arial}', + r'\setmonofont[Scale=MatchLowercase,HyphenChar=None]{Courier New}', + ]) config_section = 'xetex writer' config_section_dependencies = ('writers', 'latex2e writer') Modified: trunk/docutils/setup.py =================================================================== --- trunk/docutils/setup.py 2010-09-21 12:07:13 UTC (rev 6430) +++ trunk/docutils/setup.py 2010-09-21 12:51:29 UTC (rev 6431) @@ -137,10 +137,12 @@ 'docutils.transforms', 'docutils.writers', 'docutils.writers.html4css1', + # 'docutils.writers.html4strict', # in the sandbox! 'docutils.writers.pep_html', 'docutils.writers.s5_html', 'docutils.writers.latex2e', 'docutils.writers.newlatex2e', + 'docutils.writers.xetex', 'docutils.writers.odf_odt', ], 'data_files': ([('docutils/parsers/rst/include', @@ -150,7 +152,8 @@ 'docutils/writers/html4css1/template.txt']), ('docutils/writers/latex2e', ['docutils/writers/latex2e/default.tex', - 'docutils/writers/latex2e/titlepage.tex',]), + 'docutils/writers/latex2e/titlepage.tex', + 'docutils/writers/latex2e/xelatex.tex',]), ('docutils/writers/newlatex2e', ['docutils/writers/newlatex2e/base.tex']), ('docutils/writers/pep_html', @@ -166,6 +169,7 @@ 'tools/rst2s5.py', 'tools/rst2latex.py', 'tools/rst2newlatex.py', + 'tools/rst2xetex.py', 'tools/rst2man.py', 'tools/rst2xml.py', 'tools/rst2pseudoxml.py', Modified: trunk/docutils/test/functional/expected/standalone_rst_xetex.tex =================================================================== --- trunk/docutils/test/functional/expected/standalone_rst_xetex.tex 2010-09-21 12:07:13 UTC (rev 6430) +++ trunk/docutils/test/functional/expected/standalone_rst_xetex.tex 2010-09-21 12:51:29 UTC (rev 6431) @@ -18,7 +18,7 @@ % PDF Standard Fonts \setmainfont{Times New Roman} \setsansfont[Scale=MatchLowercase]{Arial} -\setmonofont[Scale=MatchLowercase]{Courier New} +\setmonofont[Scale=MatchLowercase,HyphenChar=None]{Courier New} %%% User specified packages and stylesheets @@ -750,10 +750,9 @@ end, much much thicker in the middle and then thin again at the far end. That is my theory, it is mine, and belongs to me and I own it, and what it is too. +\nopagebreak -\begin{flushright} ----Anne Elk (Miss) -\end{flushright} +\raggedleft —Anne Elk (Miss) \end{quote} @@ -1854,7 +1853,7 @@ & ¬ & - +\- & ® & @@ -2065,8 +2064,6 @@ \item Line wrapping with/without breakpoints marked by soft hyphens (\textbackslash{}u00ad): -pdnderdmdtdrischpdnderdmdtdrischpdnderdmdtdrischpdnderdmdtdrischpdnderdmdtdrisch - pdn\-derd\-mdtd\-ri\-schpdn\-derd\-mdtd\-ri\-schpdn\-derd\-mdtd\-ri\-schpdn\-derd\-mdtd\-ri\-schpdn\-derd\-mdtd\-ri\-sch pdnderdmdtdrischpdnderdmdtdrischpdnderdmdtdrischpdnderdmdtdrischpdnderdmdtdrisch Modified: trunk/docutils/test/functional/output/standalone_rst_xetex.tex =================================================================== --- trunk/docutils/test/functional/output/standalone_rst_xetex.tex 2010-09-21 12:07:13 UTC (rev 6430) +++ trunk/docutils/test/functional/output/standalone_rst_xetex.tex 2010-09-21 12:51:29 UTC (rev 6431) @@ -4,7 +4,6 @@ \usepackage[no-sscript]{xltxtra} % loads fixltx2e, metalogo, xunicode, fontspec \usepackage{ifthen} \usepackage{color} -\usepackage{alltt} \usepackage{float} % float configuration \floatplacement{figure}{H} % place figures here definitely \usepackage{graphicx} @@ -19,7 +18,7 @@ % PDF Standard Fonts \setmainfont{Times New Roman} \setsansfont[Scale=MatchLowercase]{Arial} -\setmonofont[Scale=MatchLowercase]{Courier New} +\setmonofont[Scale=MatchLowercase,HyphenChar=None]{Courier New} %%% User specified packages and stylesheets @@ -751,10 +750,9 @@ end, much much thicker in the middle and then thin again at the far end. That is my theory, it is mine, and belongs to me and I own it, and what it is too. +\nopagebreak -\begin{flushright} ----Anne Elk (Miss) -\end{flushright} +\raggedleft —Anne Elk (Miss) \end{quote} @@ -2074,11 +2072,11 @@ (some have an Euro sign at its place). You might see an error like: % -\begin{quote}\begin{alltt} -! Package textcomp Error: Symbol \textbackslash{}textcurrency not provided by -(textcomp) font family ptm in TS1 encoding. -(textcomp) Default family used instead. -\end{alltt} +\begin{quote}{\ttfamily \raggedright \noindent +!~Package~textcomp~Error:~Symbol~\textbackslash{}textcurrency~not~provided~by\\ +(textcomp)~~~~~~~~~~~~~~~~font~family~ptm~in~TS1~encoding.\\ +(textcomp)~~~~~~~~~~~~~~~~Default~family~used~instead. +} \end{quote} (which in case of font family ptm is a false positive). Add either Added: trunk/docutils/tools/rst2xetex.py =================================================================== --- trunk/docutils/tools/rst2xetex.py (rev 0) +++ trunk/docutils/tools/rst2xetex.py 2010-09-21 12:51:29 UTC (rev 6431) @@ -0,0 +1,27 @@ +#!/usr/bin/env python +# .. coding: utf8 + +# $Id$ +# Author: Günter Milde +# Copyright: This module has been placed in the public domain. + +""" +A minimal front end to the Docutils Publisher, producing XeLaTeX source code. +""" + +try: + import locale + locale.setlocale(locale.LC_ALL, '') +except: + pass + +from docutils.core import publish_cmdline + +description = ('Generates XeLaTeX documents from standalone reStructuredText ' + 'sources. ' + 'Reads from <source> (default is stdin) and writes to ' + '<destination> (default is stdout). See ' + '<http://docutils.sourceforge.net/docs/user/latex.html> for ' + 'the full reference.') + +publish_cmdline(writer_name='xetex', description=description) Property changes on: trunk/docutils/tools/rst2xetex.py ___________________________________________________________________ Added: svn:executable + * Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native |