Go to page:

Search:   Help

Navigation

Groups

LyX documentation

Edit

Shared groups

Links

ExportWithCommentsIncluded

Categories: Comments
<< | Page list | >>

How to Switch Printing of Comments On and Off

There are three comment styles: Comment, Greyedout, and Lyx Note. Lyx Notes are only seen in the Lyx document; they are not printed or exported to Latex. Comments are exported to Latex as Latex comments; they are not printed. Greyedouts are printed as grey text. You can change the colour of the "grey" text in Documents→Settings→Colours.

There are two routes to include comments. They be included as inline text (works for all backends), or included as PDF annotation (export via pdflatex).

PDF annotation

Comment to PDF notes

This StackExchange question shows how to create an PDF annotation from a Lyx Comment:

How-to:

1) Go to Document > Configuration... > LaTex preamble

2) Paste the following lines:

    % Change comments in PDF notes
    \usepackage{pdfcomment}
    \usepackage{environ}
    \RenewEnviron{comment}{\pdfcomment{\BODY}}

3) Go to Insert > Note > Comment and write some text.

4) Export the document with pdflatex

Comment notes into PDF Comments and Greyed Out notes into PDF Markups

Here is a hack to use PDF comments (pdfcomment and pdfmarkupcomment) from the pdfcomment package and instead of the LyX's default notes (comment and lyxgreyedout).

Make the following layout changes either by adding it to your document's Local Layouts or by changing a copy of stdinsets.inc in your user directory from the system directory. This will turn Comment notes into PDF Comments and Greyed Out notes into PDF Markups. The changes are marked with comments (#) below.

Notice: Due to a bug in LyX the Requires command is not accepted in Note:Comment. So, if you are using only comments, you have to load the pdfcomment package in another way. For example, by using the PDF Comments module and include the PDF-Comment-Setup custom inset in your document (which might be a good idea anyway).

# load hyperref
Provides hyperref 1


InsetLayout Note:Comment
	LabelString           Comment
	#LatexType             environment
	LatexType             command
	#LatexName             comment
	LatexName             pdfcomment
	BgColor               commentbg
	LabelFont
	  Color               comment
	  Size                Small
	EndFont
	#MultiPar             true
	MultiPar              false
	# No use for this in command layouts
	#Display               false
	HTMLTag               div
	HTMLIsBlock           true
  HTMLStyle
    div.note_comment {
      display: none;
    }
  EndHTMLStyle
	# requires pdfcomment package
	Requires		pdfcomment
End


InsetLayout Note:Greyedout
	LabelString           Greyedout
	#LatexType             environment
	LatexType             command
	#LatexName             lyxgreyedout
	LatexName             pdfmarkupcomment
	BgColor               greyedoutbg
	Font
	  Color               greyedouttext
	EndFont
	LabelFont
	  Color               greyedout
	  Size                Small
	EndFont
	#MultiPar              true
	MultiPar              false
	# no use for this
	#Display               false
	# argument for markup comments
	Argument post:1
	  LabelString		"Comment"
	  Mandatory		1
	  ToolTip		"Insert the comment to the marked-up text here"
	EndArgument
	HTMLInnerTag div
	HTMLStyle
		div.note_greyedout {
			display: inline;
			color: #A0A0A0;
			padding-left: 1ex;
			padding-right: 1ex;
		}
	EndHTMLStyle
	HTMLIsBlock           false
	# require pdfcomment package
	Requires		pdfcomment
End

Convert to Greyed Out

There are three comment styles: Comment, Greyedout, and Lyx Note. Lyx Notes are only seen in the Lyx document; they are not printed or exported to Latex. Comments are exported to Latex as Latex comments; they are not printed. Greyedouts are printed as grey text. You can change the colour of the "grey" text in Documents→Settings→Colours.

To print Lyx Notes or Comments you can convert them to Greyedouts.

In LyX >= 1.6.1 you can right click on the heading of an individual comment and change the type to Comment, Greyedout or LyX Note.

In LyX >= 2.0.0 you can convert all notes by pressing Alt-X to get a little command window and running the function

inset-forall Note inset-modify note Note Greyedout

In Lyx 1.6 use the use notes-mutate LyX function instead.

Branches

In LyX >= 1.5, you can useet up a branch in Document>Settings>Branches.

LyX < 1.5

An alternative for LyX < 1.5 is to redefine the Latex comments (just Comment in Lyx) to be visible. Add the following code to your preamble.

\RequirePackage{colortbl, tabularx}
\@ifundefined{comment}{}% do nothing if the comment environment is not defined
  {% redefine the comment environment if it is defined
   \renewenvironment{comment}
    {% replaces \begin{comment}
     \par\medskip\noindent
     \tabularx{\textwidth}{|>{\columncolor[gray]{0.9}}X|}
     \hline
     \emph{\textbf{Comment:}}% You can use any other text instead of "Comment:" or leave it
    }
    {% replaces \end{comment}
     \endtabularx\hrule\par\medskip
    }
  }%

This code will print your comments inside a grayed box with the italicized label "Comment:" on the first line.

If you don't want the comments to be printed, just put % signs in front of each line of the code.

Comments

Edit - History - Print - Recent Changes - All Recent Changes - Search
Page last modified on 2017-02-01 09:42 CET