mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix inline math issues inside parsed-literal for LaTeX
This commit is contained in:
parent
06924cc21c
commit
c1e093c2a1
@ -1,6 +1,6 @@
|
||||
\NeedsTeXFormat{LaTeX2e}
|
||||
\ProvidesPackage{footnotehyper-sphinx}%
|
||||
[2017/01/14 v1.5.2 hyperref aware footnote.sty for sphinx (JFB)]
|
||||
[2017/01/16 v1.5.2 hyperref aware footnote.sty for sphinx (JFB)]
|
||||
%%
|
||||
%% Package: footnotehyper-sphinx
|
||||
%% Version: based on footnotehyper.sty v0.9f (2016/10/03)
|
||||
@ -93,7 +93,8 @@
|
||||
%% \spx@opt@BeforeFootnote is defined in sphinx.sty
|
||||
\def\FNH@fixed@footnote {\spx@opt@BeforeFootnote\ifx\@currenvir\fn@footnote
|
||||
\expandafter\FNH@footnoteenv\else\expandafter\fn@latex@@footnote\fi }%
|
||||
\def\FNH@footnoteenv {\sphinxunactivateextrasandspace\@ifnextchar[\FNH@xfootnoteenv%]
|
||||
\def\FNH@footnoteenv {\catcode13=5\sphinxunactivateextrasandspace
|
||||
\@ifnextchar[\FNH@xfootnoteenv%]
|
||||
{\stepcounter\@mpfn
|
||||
\protected@xdef\@thefnmark{\thempfn}\@footnotemark
|
||||
\def\FNH@endfntext@next{\FNH@endfntext@link}\fn@startfntext}}%
|
||||
|
@ -6,7 +6,7 @@
|
||||
%
|
||||
|
||||
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
|
||||
\ProvidesPackage{sphinx}[2017/01/14 v1.5.2 LaTeX package (Sphinx markup)]
|
||||
\ProvidesPackage{sphinx}[2017/01/16 v1.5.2 LaTeX package (Sphinx markup)]
|
||||
|
||||
% we delay handling of options to after having loaded packages, because
|
||||
% of the need to use \definecolor.
|
||||
@ -399,6 +399,7 @@
|
||||
\def\sphinx@verbatim@nolig@list {\do \`}%
|
||||
% Some characters . , ; ? ! / are not pygmentized.
|
||||
% This macro makes them "active" and they will insert potential linebreaks
|
||||
% In math mode, the characters are de-activated.
|
||||
\newcommand*\sphinxbreaksbeforeactivelist {}% none
|
||||
\newcommand*\sphinxbreaksafteractivelist {\do\.\do\,\do\;\do\?\do\!\do\/}
|
||||
\newcommand*\sphinxbreaksviaactive {%
|
||||
@ -413,6 +414,15 @@
|
||||
\lccode`\~`\~
|
||||
}
|
||||
|
||||
% If the linebreak is at a space, the latter will be displayed as visible
|
||||
% space at end of first line, and a continuation symbol starts next line.
|
||||
% Stretch/shrink are however usually zero for typewriter font.
|
||||
\def\spx@verbatim@space {%
|
||||
\nobreak\hskip\z@ plus\fontdimen3\font minus\fontdimen4\font
|
||||
\discretionary{\copy\sphinxvisiblespacebox}{\sphinxafterbreak}
|
||||
{\kern\fontdimen2\font}%
|
||||
}%
|
||||
|
||||
% needed to create wrapper environments of fancyvrb's Verbatim
|
||||
\newcommand*{\sphinxVerbatimEnvironment}{\gdef\FV@EnvironName{sphinxVerbatim}}
|
||||
% Sphinx <1.5 optional argument was in fact mandatory. It is now really
|
||||
@ -468,14 +478,7 @@
|
||||
\doublehyphendemerits\z@\finalhyphendemerits\z@
|
||||
\strut ##1\strut}%
|
||||
}%
|
||||
% If the linebreak is at a space, the latter will be displayed as visible
|
||||
% space at end of first line, and a continuation symbol starts next line.
|
||||
% Stretch/shrink are however usually zero for typewriter font.
|
||||
\def\FV@Space {%
|
||||
\nobreak\hskip\z@ plus\fontdimen3\font minus\fontdimen4\font
|
||||
\discretionary{\copy\sphinxvisiblespacebox}{\sphinxafterbreak}
|
||||
{\kern\fontdimen2\font}%
|
||||
}%
|
||||
\let\FV@Space\spx@verbatim@space
|
||||
% Allow breaks at special characters using \PYG... macros.
|
||||
\sphinxbreaksatspecials
|
||||
% Breaks at punctuation characters . , ; ? ! and / (needs catcode activation)
|
||||
@ -559,11 +562,7 @@
|
||||
% \sphinxbreaksbeforeactivelist\sphinxbreaksafteractivelist\do\-}%
|
||||
}
|
||||
\newcommand*\sphinxbreaksatspaceinparsedliteral{%
|
||||
\lccode`~32 \lowercase{\def~}{\ifmmode\@xobeysp\else\leavevmode
|
||||
\nobreak\hskip\z@ plus\fontdimen3\font minus\fontdimen4\font
|
||||
\discretionary{\copy\sphinxvisiblespacebox}{\sphinxafterbreak}
|
||||
{\kern\fontdimen2\font}\fi
|
||||
}\lccode`\~`\~
|
||||
\lccode`~32 \lowercase{\let~}\spx@verbatim@space\lccode`\~`\~
|
||||
}
|
||||
% now the hack for \url to work (hyperref is required dependency):
|
||||
% the aim it to deactivate - . , ; ? ! / in \url's argument
|
||||
@ -573,7 +572,7 @@
|
||||
}%
|
||||
\long\def\spx@hack@hyper@normalise@aux#1\hyper@n@rmalise#2#3\spx@undefined{%
|
||||
\ifx\spx@hack@hyper@normalise@aux#2%
|
||||
\def\hyper@normalise{#1\sphinxunactivateextras\hyper@n@rmalise}%
|
||||
\def\hyper@normalise{#1\sphinxunactivateextrasandspace\hyper@n@rmalise}%
|
||||
\else
|
||||
\PackageWarning{sphinx}{Could not patch \string\url\space command.%
|
||||
^^J Not using extra active characters in alltt environment}%
|
||||
@ -582,7 +581,7 @@
|
||||
}%
|
||||
\newcommand*{\sphinxunactivateextras}{\let\do\@makeother
|
||||
\sphinxbreaksbeforeactivelist\sphinxbreaksafteractivelist\do\-}%
|
||||
\newcommand*{\sphinxunactivateextrasandspace}{\catcode13=5\catcode32=10\relax
|
||||
\newcommand*{\sphinxunactivateextrasandspace}{\catcode32=10\relax
|
||||
\sphinxunactivateextras}%
|
||||
% now for the modified alltt environment
|
||||
\newenvironment{sphinxalltt}
|
||||
@ -595,8 +594,11 @@
|
||||
\sphinxbreaksviaactiveinparsedliteral
|
||||
\sphinxbreaksatspaceinparsedliteral
|
||||
\spx@hack@hyper@normalise
|
||||
\everymath\expandafter{\the\everymath\catcode`\^=7\catcode`\_=8 }%
|
||||
\everydisplay\expandafter{\the\everydisplay\catcode`\^=7\catcode`\_=8 }%
|
||||
% alltt takes care of the ' as derivative ("prime") in math mode
|
||||
\everymath\expandafter{\the\everymath\sphinxunactivateextrasandspace
|
||||
\catcode`\<=12\catcode`\>=12\catcode`\^=7\catcode`\_=8 }%
|
||||
\everydisplay\expandafter{\the\everydisplay\sphinxunactivateextrasandspace
|
||||
\catcode`\<=12\catcode`\>=12\catcode`\^=7\catcode`\_=8 }%
|
||||
\fi }
|
||||
{\end{alltt}}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user