I want to change style of verb environment of my latex.
- Want a light gray background with red text.
- I tried using
newverbs
package I'm able to changetextcolor
orbackgroundcolor
but it's failing to use both once.
\documentclass{article}
\usepackage{newverbs}
\usepackage{xcolor}
\begin{document}
\renewenvironment{verbatim}
{\semiverbatim\colorbox{gray!20}}
{\endsemiverbatim}
\renewcommand{\verb}{\collectverb{\colorbox{gray!20}}}
\colorbox{gray!20}{{\color{red}What I want}}
\verb|What I have|
\end{document}
- Above is the working example with only foreground changed.
- Below is the code I'm using for both.
\documentclass{article}
\usepackage{newverbs}
\usepackage{xcolor}
\begin{document}
\renewenvironment{verbatim}
{\semiverbatim\colorbox{gray!20}\color{red}}
{\endsemiverbatim}
\renewcommand{\verb}{\collectverb{\colorbox{gray!20}\color{red}}}
\colorbox{gray!20}{{\color{red}What I want}}
\verb|What I have|
\end{document}