TeX - LaTeX Asked on December 20, 2021
I am writing an informative text and I need to use verbatim, below I have a code that is working in normal texts.
colorbox{gray!10}{
begin{minipage}{0.9linewidth}
TEXT
end{minipage}}
Now below the text inside the verbatim environment and I can’t give the same background color as the other.
colorbox{gray!10}{
begin{minipage}{0.9linewidth}
begin{verbatim}
TEXT
end{verbatim}
end{minipage}}
How can I put all verbatim text in a frame like normal text?
I’m using the xcolor package
Does this work for you --from --
https://gist.github.com/parthi2929/2855a9c1792c7ff0ebe67205ee023999
documentclass[10pt,a4paper]{article}
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}
Answered by js bibra on December 20, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP