summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjfbu <jfbu@free.fr>2017-12-10 16:18:08 +0100
committerjfbu <jfbu@free.fr>2017-12-10 16:19:32 +0100
commit347f15ca2805781662eb19d82999c84ef3a11eb8 (patch)
tree981921d285753386445c617c29e7f62516f405ae
parent8ac042a0f81a8aa5ea0a844ae229b43b16e9224c (diff)
downloadsphinx-git-347f15ca2805781662eb19d82999c84ef3a11eb8.tar.gz
Make PDF support for emphasize-lines work with lineno-start like html
-rw-r--r--sphinx/texinputs/sphinx.sty6
1 files changed, 5 insertions, 1 deletions
diff --git a/sphinx/texinputs/sphinx.sty b/sphinx/texinputs/sphinx.sty
index 7c2641b81..6a86cc433 100644
--- a/sphinx/texinputs/sphinx.sty
+++ b/sphinx/texinputs/sphinx.sty
@@ -904,7 +904,7 @@
\fi
\renewcommand\FancyVerbFormatLine[1]{%
\expandafter\sphinx@verbatim@checkifhl
- \expandafter{\the\value{FancyVerbLine}}%
+ \expandafter{\the\numexpr\value{FancyVerbLine}-\spx@verbatim@linedelta}%
\ifin@
\edef\sphinx@restorefboxsep{\fboxsep\the\fboxsep\relax}%
\fboxsep\z@
@@ -914,6 +914,10 @@
\sphinx@FancyVerbFormatLine{##1}%
\fi
}%
+ % hook into this macro to recover the line numbering offset (default zero)
+ \expandafter\def\expandafter\FancyVerbCodes\expandafter{\FancyVerbCodes
+ \FV@SetLineNo
+ \edef\spx@verbatim@linedelta{\the\value{FancyVerbLine}}}%
% go around fancyvrb's check of \@currenvir
\let\VerbatimEnvironment\sphinxVerbatimEnvironment
% go around fancyvrb's check of current list depth