4

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/[email protected]/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.

1
  • 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
    Commented Mar 30, 2011 at 22:26

3 Answers 3

2

The best way to approach this is in Lyx is to use branches. See here:

https://tex.stackexchange.com/a/87672

Briefly, you do to Document => Setting => Branches. There you can create new branches: just write something in the textbox above (e.g. "Longer version") and click 'add'.

Then while editing the document go to insert => branches => "Longer version". It will insert a box in which you can write some further explanations.

In the document settings you can choose which branches to include in the final version and which not to.

1
  • Thanks! This is a nice community, although it's a bit unfortunate so few people here use Lyx.
    – Clark
    Commented Aug 18, 2016 at 0:04
4

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

Example:

\documentclass{article}
\usepackage{xcolor}
\newenvironment{gray}{\color{gray}}{}
\usepackage{comment}
\excludecomment{gray}

\begin{document}

...
\begin{gray}
    Text
\end{gray}
...

\end{document}

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

16
  • +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
    Commented Mar 30, 2011 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. Commented Mar 30, 2011 at 22:05
  • 1
    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
    Commented Mar 30, 2011 at 22:18
  • 1
    Lyx has a predefined environment for lyxgreyout. When I add \excludecomment{lyxgreyedout} to the preamble of the document, I get many errors saying Extra }, or forgotten \endgroup and a short description of where the error occurs says \end{lyxgreyedout}. I find that it is possible to convince lyx to do what you want but when overriding it's default behavior I get these kinds of errors sometimes.
    – denilw
    Commented Mar 30, 2011 at 22:28
  • 1
    @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. Commented Mar 30, 2011 at 22:53
1

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.

2
  • +1 This seems very promising I will look at it in detail on the weekend.
    – denilw
    Commented Mar 31, 2011 at 16:01
  • The link you provided blog.ibd.com/howto/… is excellent.
    – denilw
    Commented Mar 31, 2011 at 16:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .