TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Sorry for being as clueless as the last times I asked but also having done no research because I have to finish this overhead presentation for tomorrow...

Is there a good way to create an environment which makes all text inside it colored in a certain color?

I have tried:


But this doesn't yield what I want... It gives a compile error and just puts the word "rrpptt" inside the text. What am I doing wrong?

Of course I do have the color package loaded. I also have the beamer documentclass - is that a problem?

Oh, and I don't care about \textcolor being lowlevel and stuff - I don't have footnotes and sudden page changes, so I would be content with the way \textcolor normally works, if it would do so.

share|improve this question
up vote 16 down vote accepted

The \textcolor macro takes a second argument, which is the text to be coloured. The \color macro changes the colour until the end of the current group or environment. So I think you need something like this.

Here is some black text.
And here is some red text.
Here is more black text.
share|improve this answer
AAAAAAHHHH! Thanks! – darij grinberg May 17 '11 at 22:22
@darij (and @Ian) You could even omit the \color{black} at end of the definition because the environment itself is a group … It is also recommended to use xcolor instead of color. Maybe you would like to add \ignorespacesafterend at end of the definition to prevent unwished spaces. – Tobi May 18 '11 at 9:24
@Tobi --- you are right, putting \black there was pointless. I didn't know about \ignorespacesafterend, so thanks for a useful tip. – Ian Thompson May 18 '11 at 15:37
You're welcome! :-) – Tobi May 18 '11 at 20:52

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.