From 2dff14d23894d03e1a54f3ddc01ca0f6be02a395 Mon Sep 17 00:00:00 2001 From: Juergen Spitzmueller Date: Thu, 30 Oct 2014 10:22:09 +0100 Subject: [PATCH] Fix the pdfcomment rewrite --- lib/examples/PDF-comment.lyx | 255 ++++++++++------------------ lib/layouts/pdfcomment.module | 138 ++++++---------- lib/layouts/pdfcomment.module.uwe | 265 ++++++++++++++++++++++++++++++ lib/layouts/stdspecialchars.inc | 77 +++++++++ 4 files changed, 479 insertions(+), 256 deletions(-) create mode 100644 lib/layouts/pdfcomment.module.uwe create mode 100644 lib/layouts/stdspecialchars.inc diff --git a/lib/examples/PDF-comment.lyx b/lib/examples/PDF-comment.lyx index 8aac290e0b..f1eb7f9c21 100644 --- a/lib/examples/PDF-comment.lyx +++ b/lib/examples/PDF-comment.lyx @@ -1,5 +1,5 @@ -#LyX 2.1 created this file. For more info see http://www.lyx.org/ -\lyxformat 474 +#LyX 2.2 created this file. For more info see http://www.lyx.org/ +\lyxformat 479 \begin_document \begin_header \textclass scrartcl @@ -145,14 +145,14 @@ Uwe Stöhr \end_layout \begin_layout Standard -The LaTeX-package +The LaTeX package \series bold pdfcomment \series default - provides full access for PDF-comments. - You can add normal comments, as well as margin comments, underlining etc. - And you can also define a special layout for the comment that you can use - several times in the document. + provides full access for PDF comments. + You can add normal comments as well as margin comments, underlining etc. + And you can also define a special layout for the comment, which you can + use several times in the document. This document is only a excerpt of the documentation of \series bold pdfcomment @@ -190,7 +190,7 @@ Custom Insets \family default . - You can choose between the following: + You can select one of the following: \end_layout \begin_layout Subsection @@ -198,21 +198,13 @@ PDF-Annotation \end_layout \begin_layout Standard -This is the -\begin_inset Quotes eld -\end_inset - -normal -\begin_inset Quotes erd -\end_inset - - PDF-comment. +This is the standard PDF-comment. Here is an example: \begin_inset Flex PDF-Annotation status open \begin_layout Plain Layout -this is a simple PDF-Annotation +This is a simple PDF-Annotation \end_layout \end_inset @@ -227,17 +219,9 @@ Like all PDF-comment types you can add a lot of things to the option of use the menu \family sans Insert\SpecialChar \menuseparator -PDF-xxx -\begin_inset space ~ -\end_inset - -options -\family default -, where -\family sans -xxx +PDF Comment Options \family default - stands for the type of the comment. +. \end_layout \begin_layout Standard @@ -249,7 +233,8 @@ status open \series bold Note: \series default - all braces and brackets in comment options must be inserted as TeX-code! + Literal TeX code, such as braces and brackets, must be inserted as TeX-code + to the comment options. \end_layout \end_inset @@ -279,51 +264,17 @@ status open status collapsed \begin_layout Plain Layout -author= \begin_inset ERT -status collapsed - -\begin_layout Plain Layout - -{ -\end_layout - -\end_inset - -Daisy Duck -\begin_inset ERT -status collapsed - -\begin_layout Plain Layout - -} -\end_layout - -\end_inset - -,color= -\begin_inset ERT -status collapsed +status open \begin_layout Plain Layout -{ +author={Daisy Duck},color={0.234 0.867 0.211},voffset=8pt,opacity=0.5 \end_layout \end_inset -0.234 0.867 0.211 -\begin_inset ERT -status collapsed - -\begin_layout Plain Layout - -} -\end_layout - -\end_inset -,voffset=8pt,opacity=0.5 \end_layout \end_inset @@ -396,47 +347,14 @@ status open status collapsed \begin_layout Plain Layout -id=1,color=blue,height=2.5cm,width=5.8cm,voffset=-2.8cm,hoffset=8cm,opacity=1.0,just -ification=right,icolor= \begin_inset ERT -status collapsed - -\begin_layout Plain Layout - -{ -\end_layout - -\end_inset - -yellow -\begin_inset ERT -status collapsed - -\begin_layout Plain Layout - -} -\end_layout - -\end_inset - -,linewidth=12pt,borderstyle=dashed,dashstyle= -\begin_inset ERT -status collapsed - -\begin_layout Plain Layout - -{ -\end_layout - -\end_inset - -10 5 -\begin_inset ERT -status collapsed +status open \begin_layout Plain Layout -} +id=1,color=blue,height=2.5cm,width=5.8cm,voffset=-2.8cm,hoffset=8cm,opacity=1.0,just +ification=right,icolor={yellow},linewidth=12pt,borderstyle=dashed,dashstyle={10 + 5} \end_layout \end_inset @@ -494,12 +412,22 @@ status open status collapsed \begin_layout Plain Layout +\begin_inset ERT +status open + +\begin_layout Plain Layout + height=3cm,type=freetext,subject={freetext},width=4.5cm,voffset=-3.2cm,hoffset=-3.2 cm,opacity=0.9,justification=right \end_layout \end_inset + +\end_layout + +\end_inset + This is also a comment, but it's a PDF-Freetext annotation. \end_layout @@ -563,73 +491,19 @@ status open status collapsed \begin_layout Plain Layout -type=line,opacity=1,line= -\begin_inset ERT -status collapsed - -\begin_layout Plain Layout - -{ -\end_layout - -\end_inset - -50 480 50 180 -\begin_inset ERT -status collapsed - -\begin_layout Plain Layout - -} -\end_layout - -\end_inset - -,color=green,icolor=blue,caption=top,linebegin= \begin_inset ERT -status collapsed - -\begin_layout Plain Layout - -{ -\end_layout - -\end_inset - -/ROpenArrow -\begin_inset ERT -status collapsed - -\begin_layout Plain Layout - -} -\end_layout - -\end_inset - -,lineend= -\begin_inset ERT -status collapsed +status open \begin_layout Plain Layout -{ +type=line,opacity=1,line={50 480 50 180},color=green,icolor=blue,caption=top,lin +ebegin={/ROpenArrow},lineend={/OpenArrow},linewidth=2bp,captionhoffset=-5pt,capt +ionvoffset=15pt \end_layout \end_inset -/OpenArrow -\begin_inset ERT -status collapsed - -\begin_layout Plain Layout - -} -\end_layout - -\end_inset -,linewidth=2bp,captionhoffset=-5pt,captionvoffset=15pt \end_layout \end_inset @@ -805,7 +679,7 @@ Underwave PDF-Markup \end_layout \begin_layout Description -StrikeOut The markup text will be striked-out: +StrikeOut The markup text will be struck out: \begin_inset Flex PDF-Markup status open @@ -962,7 +836,7 @@ status open \series bold Note: \series default - Due to technical reasons PDF-Reply works only while using pdflatex. + Due to technical reasons PDF-Reply works only when using pdflatex. \end_layout \end_inset @@ -1299,20 +1173,19 @@ status open status open \begin_layout Plain Layout -mathstyle= \begin_inset ERT -status collapsed +status open \begin_layout Plain Layout - +mathstyle= \backslash - +displaystyle \end_layout \end_inset -displaystyle + \end_layout \end_inset @@ -1818,12 +1691,56 @@ You can insert a list with all PDF-comments using the environment List of author are printed: \end_layout -\begin_layout List of PDF-Comments +\begin_layout List of PDF Comments \begin_inset Argument 1 status open \begin_layout Plain Layout -liststyle={AuthorComment}, heading ={List of PDF-comments} +liststyle= +\begin_inset ERT +status open + +\begin_layout Plain Layout + +{ +\end_layout + +\end_inset + +AuthorComment +\begin_inset ERT +status open + +\begin_layout Plain Layout + +} +\end_layout + +\end_inset + +, heading = +\begin_inset ERT +status open + +\begin_layout Plain Layout + +{ +\end_layout + +\end_inset + +List of PDF-comments +\begin_inset ERT +status open + +\begin_layout Plain Layout + +} +\end_layout + +\end_inset + + \end_layout \end_inset diff --git a/lib/layouts/pdfcomment.module b/lib/layouts/pdfcomment.module index d982517c5e..5b7ce57acd 100644 --- a/lib/layouts/pdfcomment.module +++ b/lib/layouts/pdfcomment.module @@ -3,18 +3,18 @@ #Provides various kinds of annotations for the PDF output. The module uses #the pdcomment package. Please consult the package documentation for details. #DescriptionEnd -# Author: Juergen Spitzmueller and Uwe Stöhr +# Author: Juergen Spitzmueller +# Uwe Stöhr -Format 49 - -AddToPreamble - \RequirePackage{pdfcomment} %support for comments in PDF files -EndPreamble +Format 48 # # helper commands # +# pdfcomment loads hyperref +Provides hyperref 1 + Style Define_Avatar Category PDF-comment LatexType Command @@ -66,49 +66,52 @@ Style Set_PDF-Comment_List_Style ResetArgs 1 End -# -# Comment insets -# - -InsetLayout "Flex:PDF-Annotation" +InsetLayout "Flex:PDF-Comment-Setup" LyXType custom LatexType command Decoration classic - LabelString "PDF (Annotation)" - LatexName pdfcomment + LabelString "PDF (Setup)" + LatexName pdfcommentsetup LabelFont Color magenta Size Small EndFont MultiPar false Argument 1 - MenuString "PDF-Annotation options" + MenuString "PDF-Comment setup options" LabelString "Opts" - ToolTip "Insert PDF-Annotation options here (see the pdfcomment manual)" + ToolTip "Insert PDF-Comment setup options here (see the pdfcomment manual)" EndArgument Requires pdfcomment End -InsetLayout "Flex:PDF-Comment-Setup" - CopyStyle "Flex:PDF-Annotation" - LabelString "PDF (Setup)" - LatexName pdfcommentsetup +# +# Annotation insets +# + +InsetLayout "Flex:PDF-Annotation" + LyXType custom + LatexType command + Decoration classic + LabelString PDF + LatexName pdfcomment + LabelFont + Color magenta + Size Small + EndFont + MultiPar false Argument 1 - MenuString "PDF-Comment setup options" + MenuString "PDFComment Options" LabelString "Opts" - ToolTip "Insert PDF-Comment setup options here (see the pdfcomment manual)" + ToolTip "Insert PDFComment options here (see pdfcomment manual)" EndArgument + Requires pdfcomment End InsetLayout "Flex:PDF-Margin" CopyStyle "Flex:PDF-Annotation" LabelString "PDF (Margin)" LatexName pdfmargincomment - Argument 1 - MenuString "PDF-Margin options" - LabelString "Opts" - ToolTip "Insert PDF-Margin options here (see the pdfcomment manual)" - EndArgument LabelFont Color green Size Small @@ -130,43 +133,36 @@ InsetLayout "Flex:PDF-Freetext" CopyStyle "Flex:PDF-Margin" LabelString "PDF (Freetext)" LatexName pdffreetextcomment - Argument 1 - MenuString "PDF-Freetext options" - LabelString "Opts" - ToolTip "Insert PDF-Freetext options here (see the pdfcomment manual)" - EndArgument End InsetLayout "Flex:PDF-Square" CopyStyle "Flex:PDF-Margin" LabelString "PDF (Square)" LatexName pdfsquarecomment - Argument 1 - MenuString "PDF-Square options" - LabelString "Opts" - ToolTip "Insert PDF-Square options here (see the pdfcomment manual)" - EndArgument End InsetLayout "Flex:PDF-Circle" CopyStyle "Flex:PDF-Margin" LabelString "PDF (Circle)" LatexName pdfcirclecomment - Argument 1 - MenuString "PDF-Circle options" - LabelString "Opts" - ToolTip "Insert PDF-Circle options here (see the pdfcomment manual)" - EndArgument End InsetLayout "Flex:PDF-Line" CopyStyle "Flex:PDF-Margin" LabelString "PDF (Line)" LatexName pdflinecomment - Argument 1 - MenuString "PDF-Line options" - LabelString "Opts" - ToolTip "Insert PDF-Line options here (see the pdfcomment manual)" +End + +InsetLayout "Flex:PDF-Sideline" + CopyStyle "Flex:PDF-Margin" + LabelString "PDF (Sideline)" + LatexType environment + LatexName pdfsidelinecomment + MultiPar true + Argument 2 + LabelString "Comment" + Mandatory 1 + ToolTip "Insert the comment here" EndArgument End @@ -174,11 +170,6 @@ InsetLayout "Flex:PDF-Reply" CopyStyle "Flex:PDF-Margin" LabelString "PDF (Reply)" LatexName pdfreply - Argument 1 - MenuString "PDF-Reply options" - LabelString "Opts" - ToolTip "Insert PDF-Reply options here (see the pdfcomment manual)" - EndArgument LabelFont Color blue Size Small @@ -193,11 +184,6 @@ InsetLayout "Flex:PDF-Tooltip" Color red Size Small EndFont - Argument 1 - MenuString "PDF-Tooltip options" - LabelString "Opts" - ToolTip "Insert PDF-Tooltip options here (see the pdfcomment manual)" - EndArgument Argument post:1 MenuString "Tooltip Text" LabelString "Tooltip" @@ -206,35 +192,13 @@ InsetLayout "Flex:PDF-Tooltip" EndArgument End -# -# Environment inset -# - -InsetLayout "Flex:PDF-Sideline" - CopyStyle "Flex:PDF-Margin" - LabelString "PDF (Sideline)" - LatexType environment - LatexName pdfsidelinecomment - MultiPar true - Argument 1 - MenuString "PDF-Sideline options" - LabelString "Opts" - ToolTip "Insert PDF-Sideline options here (see the pdfcomment manual)" - EndArgument - Argument 2 - LabelString "Comment" - Mandatory 1 - ToolTip "Insert the comment here" - EndArgument -End # # List of Annotations # -Style List_of_PDF-Comments +Style List_of_PDF_Comments KeepEmpty 1 - Category PDF-comment LatexType Command LatexName listofpdfcomments Margin First_Dynamic @@ -247,19 +211,19 @@ Style List_of_PDF-Comments LabelType Static LabelBottomSep 0 LeftMargin MMMMM - LabelString "List of PDF-comments" + LabelString "[LIST of PDF Comments]" + LabelFont - Family sansserif + Family typewriter Series Medium - Size large + Size Small Color latex - Shape bold EndFont + Argument 1 - LabelString "Opts" - MenuString "List Options|s" - Tooltip "Insert list options here (see pdfcomment manual)" + LabelString "Opts" + MenuString "List Options|s" + Tooltip "Insert list options here (see pdfcomment manual)" EndArgument - PassThru 1 - Requires pdfcomment + Requires pdfcomment End diff --git a/lib/layouts/pdfcomment.module.uwe b/lib/layouts/pdfcomment.module.uwe new file mode 100644 index 0000000000..d982517c5e --- /dev/null +++ b/lib/layouts/pdfcomment.module.uwe @@ -0,0 +1,265 @@ +#\DeclareLyXModule{PDF Comments} +#DescriptionBegin +#Provides various kinds of annotations for the PDF output. The module uses +#the pdcomment package. Please consult the package documentation for details. +#DescriptionEnd +# Author: Juergen Spitzmueller and Uwe Stöhr + +Format 49 + +AddToPreamble + \RequirePackage{pdfcomment} %support for comments in PDF files +EndPreamble + +# +# helper commands +# + +Style Define_Avatar + Category PDF-comment + LatexType Command + Margin Dynamic + LatexName defineavatar + ParSkip 0.4 + LabelType Static + LabelSep M + LabelString "PDF-comment avatar:" + Argument 1 + LabelString "Name" + Tooltip "Name of the Avatar" + Mandatory 1 + EndArgument + PassThru 1 + LabelFont + Color green + Shape bold + EndFont + Requires pdfcomment +End + +Style Define_PDF-Comment_Style + CopyStyle Define_Avatar + LatexName definestyle + LabelString "PDF-comment style:" + Argument 1 + LabelString "Name" + Tooltip "Name of the style" + Mandatory 1 + EndArgument +End + +Style Define_PDF-Comment_List_Style + CopyStyle Define_Avatar + LatexName defineliststyle + LabelString "Definition of PDF-comment list style:" + Argument 1 + LabelString "Name" + Tooltip "Name of the list style" + Mandatory 1 + EndArgument +End + +Style Set_PDF-Comment_List_Style + CopyStyle Define_Avatar + LatexName setliststyle + LabelString "PDF-comment list style:" + ResetArgs 1 +End + +# +# Comment insets +# + +InsetLayout "Flex:PDF-Annotation" + LyXType custom + LatexType command + Decoration classic + LabelString "PDF (Annotation)" + LatexName pdfcomment + LabelFont + Color magenta + Size Small + EndFont + MultiPar false + Argument 1 + MenuString "PDF-Annotation options" + LabelString "Opts" + ToolTip "Insert PDF-Annotation options here (see the pdfcomment manual)" + EndArgument + Requires pdfcomment +End + +InsetLayout "Flex:PDF-Comment-Setup" + CopyStyle "Flex:PDF-Annotation" + LabelString "PDF (Setup)" + LatexName pdfcommentsetup + Argument 1 + MenuString "PDF-Comment setup options" + LabelString "Opts" + ToolTip "Insert PDF-Comment setup options here (see the pdfcomment manual)" + EndArgument +End + +InsetLayout "Flex:PDF-Margin" + CopyStyle "Flex:PDF-Annotation" + LabelString "PDF (Margin)" + LatexName pdfmargincomment + Argument 1 + MenuString "PDF-Margin options" + LabelString "Opts" + ToolTip "Insert PDF-Margin options here (see the pdfcomment manual)" + EndArgument + LabelFont + Color green + Size Small + EndFont +End + +InsetLayout "Flex:PDF-Markup" + CopyStyle "Flex:PDF-Margin" + LabelString "PDF (Markup)" + LatexName pdfmarkupcomment + Argument post:1 + LabelString "Comment" + Mandatory 1 + ToolTip "Insert the comment to the marked-up text here" + EndArgument +End + +InsetLayout "Flex:PDF-Freetext" + CopyStyle "Flex:PDF-Margin" + LabelString "PDF (Freetext)" + LatexName pdffreetextcomment + Argument 1 + MenuString "PDF-Freetext options" + LabelString "Opts" + ToolTip "Insert PDF-Freetext options here (see the pdfcomment manual)" + EndArgument +End + +InsetLayout "Flex:PDF-Square" + CopyStyle "Flex:PDF-Margin" + LabelString "PDF (Square)" + LatexName pdfsquarecomment + Argument 1 + MenuString "PDF-Square options" + LabelString "Opts" + ToolTip "Insert PDF-Square options here (see the pdfcomment manual)" + EndArgument +End + +InsetLayout "Flex:PDF-Circle" + CopyStyle "Flex:PDF-Margin" + LabelString "PDF (Circle)" + LatexName pdfcirclecomment + Argument 1 + MenuString "PDF-Circle options" + LabelString "Opts" + ToolTip "Insert PDF-Circle options here (see the pdfcomment manual)" + EndArgument +End + +InsetLayout "Flex:PDF-Line" + CopyStyle "Flex:PDF-Margin" + LabelString "PDF (Line)" + LatexName pdflinecomment + Argument 1 + MenuString "PDF-Line options" + LabelString "Opts" + ToolTip "Insert PDF-Line options here (see the pdfcomment manual)" + EndArgument +End + +InsetLayout "Flex:PDF-Reply" + CopyStyle "Flex:PDF-Margin" + LabelString "PDF (Reply)" + LatexName pdfreply + Argument 1 + MenuString "PDF-Reply options" + LabelString "Opts" + ToolTip "Insert PDF-Reply options here (see the pdfcomment manual)" + EndArgument + LabelFont + Color blue + Size Small + EndFont +End + +InsetLayout "Flex:PDF-Tooltip" + CopyStyle "Flex:PDF-Markup" + LabelString "PDF (Tooltip)" + LatexName pdftooltip + LabelFont + Color red + Size Small + EndFont + Argument 1 + MenuString "PDF-Tooltip options" + LabelString "Opts" + ToolTip "Insert PDF-Tooltip options here (see the pdfcomment manual)" + EndArgument + Argument post:1 + MenuString "Tooltip Text" + LabelString "Tooltip" + Mandatory 1 + ToolTip "Insert the tooltip text here" + EndArgument +End + +# +# Environment inset +# + +InsetLayout "Flex:PDF-Sideline" + CopyStyle "Flex:PDF-Margin" + LabelString "PDF (Sideline)" + LatexType environment + LatexName pdfsidelinecomment + MultiPar true + Argument 1 + MenuString "PDF-Sideline options" + LabelString "Opts" + ToolTip "Insert PDF-Sideline options here (see the pdfcomment manual)" + EndArgument + Argument 2 + LabelString "Comment" + Mandatory 1 + ToolTip "Insert the comment here" + EndArgument +End + +# +# List of Annotations +# + +Style List_of_PDF-Comments + KeepEmpty 1 + Category PDF-comment + LatexType Command + LatexName listofpdfcomments + Margin First_Dynamic + NextNoIndent 1 + ParSkip 0 + TopSep 0 + BottomSep 0.25 + ParSep 0 + Align Center + LabelType Static + LabelBottomSep 0 + LeftMargin MMMMM + LabelString "List of PDF-comments" + LabelFont + Family sansserif + Series Medium + Size large + Color latex + Shape bold + EndFont + Argument 1 + LabelString "Opts" + MenuString "List Options|s" + Tooltip "Insert list options here (see pdfcomment manual)" + EndArgument + PassThru 1 + Requires pdfcomment +End diff --git a/lib/layouts/stdspecialchars.inc b/lib/layouts/stdspecialchars.inc new file mode 100644 index 0000000000..3adb112399 --- /dev/null +++ b/lib/layouts/stdspecialchars.inc @@ -0,0 +1,77 @@ +# +# Standard special characters +# + +SpecialChar LigatureBreak + Type Formatting + LabelString "Ligature Break|k" + LyXOutput 0x007c + LatexOutput \textcompwordmark{} + PlaintextOutput 0x200c + XHTMLOutput ‌ + IsLetter 1 +End + +SpecialChar EndOfSentence + LabelString "End of Sentence|E" + LyXOutput 0x002e + LatexOutput \@. + PlaintextOutput 0x002e + DocBookOutput "." + XHTMLOutput "." +End + +SpecialChar LDots + LabelString "Ellipsis|i" + Width "." + LyXOutput 0x2026 + LatexOutput \ldots{} + PlaintextOutput 0x2026 + DocBookOutput "..." + XHTMLOutput … +End + +SpecialChar MenuSeparator + LabelString "Menu Separator|M" + Width " x " + LyXOutput 0x25b7 + LatexOutput \lyxarrow{} + LaTexOutputRTL \lyxarrow*{} + PlaintextOutput "->" + DocBookOutput &lyxarrow; + XHTMLOutput ⇒ + Requires lyxarrow +End + +SpecialChar Hyphenation + Type Formatting + LabelString "Hyphenation Point|H" + LyXOutput 0x2010 + LatexOutput \- + IsLetter 1 +End + +SpecialChar Slash + LabelString "Breakable Slash|a" + LyXOutput 0x002f + LatexOutput \slash{} + PlaintextOutput 0x002f + DocBookOutput / + XHTMLOutput ⁄ +End + +SpecialChar NobreakDash + LabelString "Protected Hyphen|y" + LyXOutput 0x2010 + LatexOutput \nobreakdash- + NeedsProtect 1 + PlaintextOutput 0x2011 + DocBookOutput - + XHTMLOutput ‑ + Requires amsmath + IsLetter 1 + Font + Color latex + EndFont +End + -- 2.39.2