In sagetex, how to avoid italic font for sagecommandline environment within an italic example environment?

asked 2025-05-23 10:42:21 +0200

Sébastien gravatar image

updated 2025-05-23 10:46:02 +0200

I am using sagecommandline environment of sagetex and I love it. I currently have an issue illustrated in the example below:

\documentclass{article}
\newtheorem{example}{Example}
\usepackage{sagetex}

\begin{document}
This is in the text:
\begin{sagecommandline}
    sage: matrix(3,range(9))
\end{sagecommandline}

\begin{example}
    This is an example:
\begin{sagecommandline}
    sage: matrix(3,range(9))
\end{sagecommandline}
\end{example}
\end{document}

output is:

image description

I would like the sagecommandline code to never be in italic, even inside an environment which is in italic.

edit retag flag offensive close merge delete