On 2012-05-04, Gour wrote:
> On Wed, 28 Mar 2012 11:46:06 +0000 (UTC)
> Guenter Milde <mi...@users.sf.net> wrote:

> Excuse me for late reply...I was playing a bit with AsciiDoc and had
> some other tasks in the meantime...

>> On the input side, reStructuredText allows both, direct input as
>> Unicode character as well as via substitution definitions like ::

>>   .. |copy| unicode:: 0xA9 .. copyright sign

>>   Copyright |copy| 2012

> OK. Thank you.


>> PDF output requires configuring LaTeX via packages and preamble code.
>> The details depend ou your choice between traditional 8-bit TeX and
>> XeTeX or LuaTeX as back-end.

> I bet that using XeTex/LuaTeX is no problem...at least, XeTeX is
> standard part of my TexLive package.

I don't know whether XeTeX/LuaTeX output is supported by Sphinx. With
Docutils, you can use the "XeTeX" writer via the rst2xetex backend. For a
single document, this would be:

  rst2xetex mydoc.txt > mydoc.tex
  xelatex mydoc.tex

Font configuration would be done in the LaTeX preamble. See the "fontspec"
package documentation for details how to use different fonts for different
Unicode ranges.


With "normal" LaTeX, you should look up the required symbols in 
`The Comprehensive LaTeX Symbol List`__ or (if it's a math symbol)
`Unicode symbols and corresponding LaTeX math mode commands`__

__ http://mirror.ctan.org/info/symbols/comprehensive/symbols-a4.pdf
__ http://milde.users.sourceforge.net/LUCR/Math/unimathsymbols.xhtml

The latter shows for the sun symbol '☉' (9737, 0x2609) SUN
that it is provided by package "mathabx" under the name ``\Sun``.

The following preamble code sets this up, if the output-encoding is "utf8"::

  \usepackage{mathabx}
  \DeclareUnicodeCharacter{2609}{\ensuremath\Sun}      % ☉


>> HTML output should work out of the box with a modern browser that does
>> the font substitution automatically.

> OK, but I'm curious how to mix fonts...for instance I've special font
> containing glyphs for planets & other astrological symbols and it
> provides such mapping that in my AsciiDoc file I can define something
> like:

>:sun: a

> and then use it, similar to the above, like:

> Symbol for the Sun is +{sun}+.

> The trick is that the text enclosed in '+' characters (e.g. +{sun}+) are
> rendered in monospaced font.

1. Try whether the browser displays the symbold out of the box

2. To select a special font, put the part in a custom role, e.g. ::

     .. role:: astro

     This :astro:`☉` is the Unicode symbol sun.

    and create a custom CSS sheet with a rule like::

        span.astro {font: mono;}

    (How to use this stylesheet differs in Docutils and Sphinx, see the
    respective documentation.)

2a. For display with a monospaced font, you can also use the "literal"
    role with the literal Unicode char::
    
       This ``☉`` is the Unicode symbol sun.

    No other setup required (if the default monospaced font suffices).

Günter    

-- 
You received this message because you are subscribed to the Google Groups 
"sphinx-dev" group.
To post to this group, send email to sphinx-dev@googlegroups.com.
To unsubscribe from this group, send email to 
sphinx-dev+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sphinx-dev?hl=en.

Reply via email to