Skip to content

Commit

Permalink
Fix #101: set colours for Verbatim without using private Sphinx macros (
Browse files Browse the repository at this point in the history
#102)

* Fix #101: set colours for Verbatim without using private Sphinx macros

The \colorlet macro is provided by xcolor package which is part of the
template anyhow (and probably loaded by some other packages from the
template).

Else, if with 'color' package and not 'xcolor' package, we could have
used \sphinxcolorlet which is avaiable since Sphinx 1.5 from December
2016.

The scope of \colorlet is limited by the environment.

This avoids using private Sphinx macro \spx@verbatimfcolorbox which got
renamed at Sphinx 5.1.0 and whose definition would thus remain without
effect.

* Remove unneeded \makeatletter/\makeatother at end of JupyterBook.cls

Co-authored-by: AakashGC <aakashguptachoudhury@gmail.com>
  • Loading branch information
jfbu and AakashGfude committed Nov 14, 2022
1 parent 6785357 commit d841b28
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions sphinx_jupyterbook_latex/theme/jupyterBook.cls
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,15 @@
{\endMakeFramed}

% Env which wraps code cell inputs
\makeatletter
\newenvironment{sphinxVerbatimInput}
{\def\spx@verbatimfcolorbox{\spx@fcolorbox{CodeBlockInputBorderColor}{CodeBlockInputColor}}\begin{adjustwidth}{5pt}{}}
{\colorlet{VerbatimBorderColor}{CodeBlockInputBorderColor}%
\colorlet{VerbatimColor}{CodeBlockInputColor}%
\begin{adjustwidth}{5pt}{}}
{\end{adjustwidth}}
\makeatother

% Env which wraps code cell outputs
\makeatletter
\newenvironment{sphinxVerbatimOutput}
{\def\spx@verbatimfcolorbox{\spx@fcolorbox{CodeBlockOutputBorderColor}{CodeBlockOutputColor}} \begin{adjustwidth}{20pt}{}}
{\colorlet{VerbatimBorderColor}{CodeBlockOutputBorderColor}%
\colorlet{VerbatimColor}{CodeBlockOutputColor}%
\begin{adjustwidth}{20pt}{}}
{\end{adjustwidth}}
\makeatother

0 comments on commit d841b28

Please sign in to comment.