Skip to content

Commit

Permalink
fix JuliaLang#8494 (broken pdf docs)
Browse files Browse the repository at this point in the history
Only include unicode-input-table.rst in html docs until latex's
primitive unicode support improves. Also switch back to using pdflatex
(sorry @jiahao) -- readthedocs.org only supports pdflatex.
  • Loading branch information
nolta committed Oct 3, 2014
1 parent 3603b8a commit a583726
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 16 deletions.
9 changes: 4 additions & 5 deletions doc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ help:
@echo " devhelp to make HTML files and a Devhelp project"
@echo " epub to make an epub"
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
@echo " latexpdf to make LaTeX files and run them through lualatex"
@echo " latexpdf to make LaTeX files and run them through pdflatex"
@echo " text to make text files"
@echo " man to make manual pages"
@echo " texinfo to make Texinfo files"
Expand Down Expand Up @@ -114,10 +114,9 @@ latex: juliadoc-pkg

latexpdf: juliadoc-pkg
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@#Monkey-patch sphinx style file
sed -ibak '/graphicx/d' $(BUILDDIR)/latex/sphinx.sty
cd $(BUILDDIR)/latex; latexmk -lualatex JuliaLanguage
@echo "lualatex finished; the PDF files are in $(BUILDDIR)/latex."
@echo "Running LaTeX files through pdflatex..."
$(MAKE) -C $(BUILDDIR)/latex all-pdf
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."

text: juliadoc-pkg
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
Expand Down
44 changes: 37 additions & 7 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,13 +197,43 @@
# Additional stuff for the LaTeX preamble.
#'preamble': '',

'inputenc': r'\newcommand{\DeclareUnicodeCharacter}[2]{}',
'fontenc': r'\usepackage{fontspec}',
'preamble': r'''
\setmainfont{Times}
\setsansfont{Helvetica}
\setmonofont{Inconsolata}
'''
'utf8extra': r'''
\usepackage{CJKutf8}
\usepackage{amssymb}
\DeclareUnicodeCharacter{00A0}{\nobreakspace}
\DeclareUnicodeCharacter{2203}{\ensuremath{\exists}}
\DeclareUnicodeCharacter{2200}{\ensuremath{\forall}}
\DeclareUnicodeCharacter{2713}{x}
\DeclareUnicodeCharacter{27FA}{\ensuremath{\Longleftrightarrow}}
\DeclareUnicodeCharacter{221A}{\ensuremath{\sqrt{}}}
\DeclareUnicodeCharacter{221B}{\ensuremath{\sqrt[3]{}}}
\DeclareUnicodeCharacter{2295}{\ensuremath{\oplus}}
\DeclareUnicodeCharacter{2297}{\ensuremath{\otimes}}
\DeclareUnicodeCharacter{2211}{\ensuremath{\sum}}
\DeclareUnicodeCharacter{03C0}{\ensuremath{\pi}}
\DeclareUnicodeCharacter{2081}{\ensuremath{_{1}}}
\DeclareUnicodeCharacter{00B9}{\ensuremath{^{1}}}
\DeclareUnicodeCharacter{0127}{\ensuremath{\hbar}}
\DeclareUnicodeCharacter{2260}{\ensuremath{\ne}}
\DeclareUnicodeCharacter{2264}{\ensuremath{\le}}
\DeclareUnicodeCharacter{2265}{\ensuremath{\ge}}
\DeclareUnicodeCharacter{2261}{\ensuremath{\equiv}}
\DeclareUnicodeCharacter{2262}{\ensuremath{\not\equiv}}
\DeclareUnicodeCharacter{2208}{\ensuremath{\in}}
\DeclareUnicodeCharacter{220B}{\ensuremath{\ni}}
\DeclareUnicodeCharacter{2209}{\ensuremath{\notin}}
\DeclareUnicodeCharacter{220C}{\ensuremath{\not\ni}}
\DeclareUnicodeCharacter{2286}{\ensuremath{\subseteq}}
\DeclareUnicodeCharacter{2288}{\ensuremath{\nsubseteq}}
\DeclareUnicodeCharacter{228A}{\ensuremath{\subsetneq}}
\DeclareUnicodeCharacter{222A}{\ensuremath{\cup}}
\DeclareUnicodeCharacter{2229}{\ensuremath{\cap}}
\DeclareUnicodeCharacter{00F7}{\ensuremath{\div}}
\DeclareUnicodeCharacter{03B3}{\ensuremath{\gamma}}
\DeclareUnicodeCharacter{03C6}{\ensuremath{\varphi}}
\DeclareUnicodeCharacter{22C5}{\ensuremath{\cdot}}
\DeclareUnicodeCharacter{00D7}{\ensuremath{\times}}
''',
}

# Grouping the document tree into LaTeX files. List of tuples
Expand Down
12 changes: 11 additions & 1 deletion doc/manual/getting-started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,24 @@ same location as the current host. Each machine definition takes the form


If you have code that you want executed whenever julia is run, you can
put it in ``~/.juliarc.jl``::
put it in ``~/.juliarc.jl``:

.. raw:: latex

\begin{CJK*}{UTF8}{mj}

::

$ echo 'println("Greetings! 你好! 안녕하세요?")' > ~/.juliarc.jl
$ julia
Greetings! 你好! 안녕하세요?
...

.. raw:: latex

\end{CJK*}

There are various ways to run Julia code and provide options, similar to
those available for the ``perl`` and ``ruby`` programs::

Expand Down
13 changes: 10 additions & 3 deletions doc/manual/unicode-input.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
.. _man-unicode-input:

*************************************
***************
Unicode Input
*************************************
***************

.. only:: html

.. include:: unicode-input-table.rst

.. only:: latex

Please see the online documentation.

.. include:: unicode-input-table.rst
16 changes: 16 additions & 0 deletions doc/manual/variables.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ Julia provides an extremely flexible system for naming variables.
Variable names are case-sensitive, and have no semantic meaning (that is,
the language will not treat variables differently based on their names).

.. raw:: latex

\begin{CJK*}{UTF8}{gbsn}

.. doctest::

julia> x = 1.0
Expand All @@ -44,8 +48,16 @@ the language will not treat variables differently based on their names).
julia> UniversalDeclarationOfHumanRightsStart = "人人生而自由,在尊严和权力上一律平等。"
"人人生而自由,在尊严和权力上一律平等。"

.. raw:: latex

\end{CJK*}

Unicode names (in UTF-8 encoding) are allowed:

.. raw:: latex

\begin{CJK*}{UTF8}{mj}

.. doctest::

julia> δ = 0.00001
Expand All @@ -60,6 +72,10 @@ name followed by tab. For example, the variable name ``δ`` can be
entered by typing ``\delta``-*tab*, or even ``α̂₂`` by
``\alpha``-*tab*-``\hat``-*tab*-``\_2``-*tab*.

.. raw:: latex

\end{CJK*}

Julia will even let you redefine built-in constants and functions if needed:

.. doctest::
Expand Down

0 comments on commit a583726

Please sign in to comment.