I
I
Ivan Klimenko2017-11-07 00:00:13
TeX
Ivan Klimenko, 2017-11-07 00:00:13

How can I change the background color of a specific paragraph on a page?

I want to make the background color of the paragraph with the code gray, but all the methods that I tried change the background color of the entire page. Tell me what I'm doing wrong.
Here is a paragraph:

\begin{verbatim}
var a, b: integer;
begin
    a := 3;
    b := 7;
    ...
end.
\end{verbatim}

If you use the command before this paragraph, then the color of the entire page changes. If you use before a paragraph , and after , then the background color of the paragraph and the page remains white. Here is an example of what I want to do from the LaTeX tutorial. But, unfortunately, how to do the same is not said there. PS I didn't read anything in the documentation for the color package either, although I admit that it is there. \pagecolor {grey}\pagecolor {grey}\pagecolor {white}
5a00cc20ab5bc983594978.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrew, 2017-11-07
@yeswell

\usepackage{framed} 
\usepackage{xcolor} 
\colorlet{shadecolor}{gray!25} 
  
\begin{shaded} 
text
\end{shaded}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question