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

In Lyx I would like to convert greyed out text into comments. The Lyx environment is lyxgreyedout. I have considered switching to another IDE already and it is not an acceptable solution.

The website below does something similar I think but I don't quite follow it: http://www.mail-archive.com/lyx-users@lists.lyx.org/msg79368.html

If there is some alternate way of allowing comments to show up in a draft but not the final product in Lyx, please let me know.

share|improve this question
Could you make clear in your question what you want to achieve. It isn't obvious why the "lyx" tag is relevant here, but given your comment on Martin's answer, I expect it might be. – Seamus Mar 30 '11 at 22:26
up vote 1 down vote accepted

You might also consider using PDF annotations with the pdfcomment package.

There's a Lyx module, which at least partly supports pdfcomment. You can use the final option to switch off the comments.

Here's a blog post, how to make it work.

share|improve this answer
+1 This seems very promising I will look at it in detail on the weekend. – denilw Mar 31 '11 at 16:01
The link you provided blog.ibd.com/howto/… is excellent. – denilw Mar 31 '11 at 16:07

Use the comment package and then \excludecomment{gray} to redefine the gray environment to be ignored.






There is also \includecomment{<env>} to define an environment which is simply included. See my answer to Whether it's possible to keep translation together with original text? for an example.

share|improve this answer
+1 this seems like a great solution. Ultimately I want to use this for the to redefine the lyx command \lyxgreyedout, however \excludecomment{lyxgreyedout} doesn't work. I have rolledback the title change in the hopes that a solution to the more general case of redefining an environment will work. – denilw Mar 30 '11 at 21:52
@denilw: Please mention the Lyx application in your question and add the {lyx} tag as well. Your question doesn't has much to do with redefining an environment in general (which is done using \renewenvironment BTW), which was the reason I changed the title. – Martin Scharrer Mar 30 '11 at 22:05
I added the lyx tag, though I have had bad success getting help whenever I mention lyx. No one takes the question seriously. Most of the time the first answer is don't use lyx. – denilw Mar 30 '11 at 22:18
@denilw: I see. What is the problem of using \excludecomment{lyxgreyedout}? The expression doesn't work doesn't tell me much. – Martin Scharrer Mar 30 '11 at 22:20
@denilw: I meant you can't use comment environments inside other environments (or verbatim environments and similar). They do not work like normal but looking for a text match of e.g. \end{comment} which is never seen because it is inside \end{lyxgreyedout} which isn't expanded/processed while looking for it. – Martin Scharrer Mar 30 '11 at 22:53

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.