Commits

Georg Brandl  committed 754cafd

#574: Add special code for better support of Japanese documents in the LaTeX builder.

  • Participants
  • Parent commits af69933

Comments (0)

Files changed (3)

 Release 1.0.6 (in development)
 ==============================
 
+* #574: Add special code for better support of Japanese documents
+  in the LaTeX builder.
+
 * Regression of #77: If there is only one parameter given with
   ``:param:`` markup, the bullet list is now suppressed again.
 

File sphinx/texinputs/Makefile

 all-dvi: $(ALLDVI)
 all-ps: all-dvi
 	for f in *.dvi; do dvips $$f; done
+all-pdf-ja: $(wildcard *.tex)
+	ebb $(wildcard *.pdf *.png *.gif *.jpeg)
+	platex -kanji=utf8 $(LATEXOPTS) '$<'
+	platex -kanji=utf8 $(LATEXOPTS) '$<'
+	platex -kanji=utf8 $(LATEXOPTS) '$<'
+	-mendex -U -f -d '$(basename $<).dic' -s python.ist '$(basename $<).idx'
+	platex -kanji=utf8 $(LATEXOPTS) '$<'
+	platex -kanji=utf8 $(LATEXOPTS) '$<'
+	dvipdfmx '$(basename $<).dvi'
 
 zip: all-$(FMT)
 	mkdir $(ARCHIVEPREFIX)docs-$(FMT)

File sphinx/writers/latex.py

             lang = babel.get_language()
             if lang:
                 self.elements['classoptions'] += ',' + babel.get_language()
+            elif builder.config.language == 'ja':
+                self.elements['classoptions'] += ',english,dvipdfm'
+                # not elements of babel, but this should be above sphinx.sty.
+                # because pTeX (Japanese TeX) cannot handle this count.
+                self.elements['babel'] += r'\newcount\pdfoutput\pdfoutput=0'
+                # to make the pdf with correct encoded hyperref bookmarks
+                self.elements['preamble'] += r'\AtBeginDvi{\special{pdf:tounicode EUC-UCS2}}'
             else:
                 self.builder.warn('no Babel option known for language %r' %
                                   builder.config.language)