Edit Links |
Tips /
ExportWithCommentsIncludedCategories: Comments << | Page list | >>How to Switch Printing of Comments On and OffTable of contents (hide) 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 can be included as inline text (works for all backends), or included as PDF annotation (export via pdflatex). 1. PDF annotation1.1 Comment to PDF notesThis 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 1.2 Comment notes into PDF Comments and Greyed Out notes into PDF MarkupsHere is a hack to use PDF comments ( Make the following layout changes either by adding it to your document's Local Layouts or by changing a copy of Notice: Due to a bug in LyX the
# 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
2. Convert to Greyed OutThere 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. 3. BranchesIn LyX >= 1.5, you can useet up a branch in Document>Settings>Branches. 4. LyX < 1.5An 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. |