Merge pull request #3876 from jfbu/fixboxdrawing

Fix #3851 and fix #3706 about box drawing characters for PDF output
This commit is contained in:
Takeshi KOMIYA 2017-07-02 17:07:05 +09:00 committed by GitHub
commit 1b67a8eb9d
3 changed files with 50 additions and 5 deletions

View File

@ -1478,6 +1478,41 @@
% figure legend comes after caption and may contain arbitrary body elements
\newenvironment{sphinxlegend}{\par\small}{\par}
% Declare Unicode characters used by linux tree command to pdflatex utf8/utf8x
\def\spx@bd#1#2{%
\leavevmode
\begingroup
\ifx\spx@bd@height \@undefined\def\spx@bd@height{\baselineskip}\fi
\ifx\spx@bd@width \@undefined\setbox0\hbox{0}\def\spx@bd@width{\wd0 }\fi
\ifx\spx@bd@thickness\@undefined\def\spx@bd@thickness{.6\p@}\fi
\ifx\spx@bd@lower \@undefined\def\spx@bd@lower{\dp\strutbox}\fi
\lower\spx@bd@lower#1{#2}%
\endgroup
}%
\@namedef{sphinx@u2500}% BOX DRAWINGS LIGHT HORIZONTAL
{\spx@bd{\vbox to\spx@bd@height}
{\vss\hrule\@height\spx@bd@thickness
\@width\spx@bd@width\vss}}%
\@namedef{sphinx@u2502}% BOX DRAWINGS LIGHT VERTICAL
{\spx@bd{\hb@xt@\spx@bd@width}
{\hss\vrule\@height\spx@bd@height
\@width \spx@bd@thickness\hss}}%
\@namedef{sphinx@u2514}% BOX DRAWINGS LIGHT UP AND RIGHT
{\spx@bd{\hb@xt@\spx@bd@width}
{\hss\raise.5\spx@bd@height
\hb@xt@\z@{\hss\vrule\@height.5\spx@bd@height
\@width \spx@bd@thickness\hss}%
\vbox to\spx@bd@height{\vss\hrule\@height\spx@bd@thickness
\@width.5\spx@bd@width\vss}}}%
\@namedef{sphinx@u251C}% BOX DRAWINGS LIGHT VERTICAL AND RIGHT
{\spx@bd{\hb@xt@\spx@bd@width}
{\hss
\hb@xt@\z@{\hss\vrule\@height\spx@bd@height
\@width \spx@bd@thickness\hss}%
\vbox to\spx@bd@height{\vss\hrule\@height\spx@bd@thickness
\@width.5\spx@bd@width\vss}}}%
\protected\def\sphinxunichar#1{\@nameuse{sphinx@u#1}}%
% Tell TeX about pathological hyphenation cases:
\hyphenation{Base-HTTP-Re-quest-Hand-ler}
\endinput

View File

@ -40,12 +40,9 @@ tex_replacements = [
# used to separate -- in options
('', r'{}'),
# map some special Unicode characters to similar ASCII ones
('', r'-'),
('', r'\_'),
('', r'\textbackslash{}'),
('', r'\textendash{}'),
('|', r'\textbar{}'),
('', r'\textbar{}'),
('', r'e'),
('', r'i'),
('', r'\(\sp{\text{0}}\)'),

View File

@ -105,9 +105,22 @@ ADDITIONAL_SETTINGS = {
'pdflatex': {
'inputenc': '\\usepackage[utf8]{inputenc}',
'utf8extra': ('\\ifdefined\\DeclareUnicodeCharacter\n'
' \\ifdefined\\DeclareUnicodeCharacterAsOptional\\else\n'
' \\ifdefined\\DeclareUnicodeCharacterAsOptional\n'
' \\DeclareUnicodeCharacter{"00A0}{\\nobreakspace}\n'
' \\DeclareUnicodeCharacter{"2500}{\\sphinxunichar{2500}}\n'
' \\DeclareUnicodeCharacter{"2502}{\\sphinxunichar{2502}}\n'
' \\DeclareUnicodeCharacter{"2514}{\\sphinxunichar{2514}}\n'
' \\DeclareUnicodeCharacter{"251C}{\\sphinxunichar{251C}}\n'
' \\DeclareUnicodeCharacter{"2572}{\\textbackslash}\n'
' \\else\n'
' \\DeclareUnicodeCharacter{00A0}{\\nobreakspace}\n'
'\\fi\\fi'),
' \\DeclareUnicodeCharacter{2500}{\\sphinxunichar{2500}}\n'
' \\DeclareUnicodeCharacter{2502}{\\sphinxunichar{2502}}\n'
' \\DeclareUnicodeCharacter{2514}{\\sphinxunichar{2514}}\n'
' \\DeclareUnicodeCharacter{251C}{\\sphinxunichar{251C}}\n'
' \\DeclareUnicodeCharacter{2572}{\\textbackslash}\n'
' \\fi\n'
'\\fi'),
},
'xelatex': {
'latex_engine': 'xelatex',