Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tcolorbox combined with sageblock? #54

Open
mjungmath opened this issue Apr 4, 2021 · 5 comments
Open

tcolorbox combined with sageblock? #54

mjungmath opened this issue Apr 4, 2021 · 5 comments

Comments

@mjungmath
Copy link

mjungmath commented Apr 4, 2021

Hello there,
For my current project I'd like to depict Sage code in fancy Jupyter style. For that, I have already made a tcolorbox listing environment. Now it would be nice to combine that with sageblock in order to reuse the code snippets written in there.

Here is a minimal example:

\documentclass{article}
\usepackage[margin=0.7in]{geometry}
\usepackage[parfill]{parskip}
\usepackage[utf8]{inputenc}
\usepackage[many,breakable,listings]{tcolorbox}

\newtcblisting{sagenotebook}{%
	breakable,
	enhanced,
	size=fbox, 
	pad at break*=1mm,
	opacityfill=1,
	boxrule=.7pt,
	before skip=\medskipamount,
	after={\par\noindent},
	colback=lightgray,
	colframe=gray,
	attach title to upper,
	listing only,
	listing options={
		language=Python,
		upquote= true,
		tabsize=4,
		basicstyle=\linespread{1}\small\ttfamily,
		basewidth=.5em,
		aboveskip=0pt,
		belowskip=-2pt,
	},
}

\begin{document}

\begin{sagenotebook}
P = QQ[x]
\end{sagenotebook}

\end{document}

However, I have no clue how to proceed from here. Any help, comment or hint is appreciated. Thanks!

@mjungmath
Copy link
Author

I might have something but it's not finished yet. Is there a general interest to add this to sagetex?

@kcrisman
Copy link
Member

kcrisman commented Aug 20, 2021 via email

@mjungmath
Copy link
Author

mjungmath commented Aug 20, 2021

Okay, here is an example. Suppose we call the new environment sagenotebook. Then

\begin{sagenotebook}
P = QQ[x]
P
\end{sagenotebook}

should produce

Screenshot from 2021-08-21 00-52-30

but in LaTeX code. The above MWE shows one way to produce a Jupyter-like cell. I am not sure whether there is a way too avoid tcolorbox, but I doubt there is.

Please let me know if you need further details.

@mjungmath
Copy link
Author

mjungmath commented Aug 21, 2021

I created a repo. Please check this out:

https://github.com/mjungmath/sagetex_notebook

Feedback is highly appreciated.

@mjungmath
Copy link
Author

Opinions on my above approach? Is that something we would like to implement?

@mjungmath mjungmath closed this as not planned Won't fix, can't repro, duplicate, stale Sep 3, 2022
@mjungmath mjungmath reopened this Sep 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants