Created
September 25, 2018 18:33
-
-
Save parthi2929/2855a9c1792c7ff0ebe67205ee023999 to your computer and use it in GitHub Desktop.
Boxing a verbatim via new environment in latex. Box to look similar to ipython notebook. MWE.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\documentclass[10pt,a4paper]{article} | |
\usepackage[latin1]{inputenc} | |
\usepackage{amsmath} | |
\usepackage{amsfonts} | |
\usepackage{amssymb} | |
\usepackage{graphicx} | |
\usepackage{calc} | |
\usepackage{fancyvrb} % verbatim replacement that allows latex | |
\usepackage[breakable]{tcolorbox} | |
\definecolor{cellborder}{HTML}{CFCFCF} | |
\definecolor{cellbackground}{HTML}{F7F7F7} | |
\DefineVerbatimEnvironment{Highlighting}{Verbatim}{commandchars=\\\{\}} | |
\newenvironment{InVerbatim}{\VerbatimEnvironment% | |
\begin{tcolorbox}[breakable, size=fbox, boxrule=1pt, pad at break*=1mm, | |
colback=cellbackground, colframe=cellborder] | |
\begin{Verbatim} | |
}{ | |
\end{Verbatim} | |
\end{tcolorbox} | |
} | |
\begin{document} | |
trrgdsgh | |
\begin{tcolorbox}[breakable, size=fbox, boxrule=1pt, pad at break*=1mm, colback=cellbackground, colframe=cellborder] | |
\begin{verbatim} | |
tesdt | |
\end{verbatim} | |
\end{tcolorbox} | |
\begin{InVerbatim} | |
this is via environment setting | |
\end{InVerbatim} | |
\end{document} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment