TransWikia.com

How to renewenvironment that wrap the base environment?

TeX - LaTeX Asked on April 8, 2021

I would like to add wrap something around an existing environment.

Consider an existing environment sphinxVerbatim, I would like to renew this environment by adding something before and after that environment call. I could write this, but obviously it doesn’t work:

renewenvironment{sphinxVerbatim}[1]
    {begin{code}begin{sphinxVerbatim}{#1}}
    {end{sphinxVerbatim}end{code}}

In context, I would like to wrap my code environment around an existing environment named sphinxVerbatim:

newtcolorbox{code}{breakable,enhanced,arc=0mm,colback=lightgray!5,colframe=lightgray}

Sphinx generates some code such as:

begin{sphinxVerbatim}[commandchars={}]
PYG{c+cp}{PYGZsh{}}PYG{c+cp}{include} PYG{c+cpf}{PYGZlt{}stdio.hPYGZgt{}}
end{sphinxVerbatim}

and I would like to redeclare this environment for this sphinxVerbatim to be wrapped inside a begin{code}...end{code}.

The main issue I have with sphinxVerbatim is that the frame goes outside from the page area, I want it to be inside with some margin as shown below:

enter image description here

enter image description here
I thought I could simply redeclare sphinxVerbatim

One Answer

You may benefit from looking at the documentation for Sphinx: https://www.sphinx-doc.org/en/master/latex.html

The section on sphinxsetup mentions the ability to do things like adding a frame, coloring, etc. which should allow you to do the customizations that you like.

Correct answer by Don Hosek on April 8, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP