From 7a4867398aac7e40c1ebf080c02bcd8b8f2f64b1 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sat, 11 Sep 2010 00:44:51 +0000 Subject: pdfcomment 1.6 (15aug10) git-svn-id: svn://tug.org/texlive/trunk@19651 c570f23f-e606-0410-a88d-b1316a301751 --- .../texmf-dist/tex/latex/pdfcomment/pdfcomment.sty | 204 ++++++++++++++------- 1 file changed, 139 insertions(+), 65 deletions(-) (limited to 'Master/texmf-dist/tex/latex/pdfcomment') diff --git a/Master/texmf-dist/tex/latex/pdfcomment/pdfcomment.sty b/Master/texmf-dist/tex/latex/pdfcomment/pdfcomment.sty index 3bc46e1d87b..072a3e6cb1c 100644 --- a/Master/texmf-dist/tex/latex/pdfcomment/pdfcomment.sty +++ b/Master/texmf-dist/tex/latex/pdfcomment/pdfcomment.sty @@ -20,7 +20,7 @@ %% This work consists of all files listed in manifest.txt. %% % -\ProvidesPackage{pdfcomment}[2010/06/01 pdfcomment.sty v1.5e - Josef Kleber (C) 2008-2010]% +\ProvidesPackage{pdfcomment}[2010/08/15 pdfcomment.sty v1.6 - Josef Kleber (C) 2008-2010]% % \RequirePackage{xkeyval}% % @@ -126,6 +126,7 @@ \gdef\pc@lopt@captionhoffset{}% \gdef\pc@lopt@captionvoffset{}% \gdef\pc@lopt@linesep{}% +\gdef\pc@lopt@mathstyle{}% % \gdef\pc@lopt@c{}% \gdef\pc@lopt@ic{}% @@ -142,6 +143,8 @@ % \newcounter{pc@annot@lines}% % +\newbox\pc@mathannot@box% +% \newlength{\pc@dima}% \newlength{\pc@dimb}% \newlength{\pc@dimc}% @@ -152,6 +155,7 @@ \newlength{\pc@Sposy}% \newlength{\pc@Eposx}% \newlength{\pc@Eposy}% +\newlength{\pc@box@width}% \newlength{\pc@box@height}% \newlength{\pc@box@depth}% % @@ -1045,6 +1049,11 @@ \expandafter\global\csname pc@gopt@dvipdfmx#1\endcsname% }% % +\define@key{pdfmarkupcomment}{mathstyle}% +{% + \gdef\pc@lopt@mathstyle{#1}% +}% +% \define@key{pdfcomment.sty}{final}[]% {% \pc@gopt@finaltrue% @@ -1720,9 +1729,6 @@ \pc@copy@gopt@lopt% % Change local options if specified \setkeys{pdfmarkupcomment}{#1}% - % Encode Contents, Author and Subject to pdf encodings (PD or PU) with hyperref's \pdfstringdef - % and transform color input to pdf color - \pc@encode@PDF{#3}% \zsavepos{pdfcomment:\thezref@unique}% \zref@refused{pdfcomment:\thezref@unique}% \setlength{\pc@Sposx}{\zposx{pdfcomment:\thezref@unique}sp}% @@ -1730,75 +1736,113 @@ \refstepcounter{zref@unique}% \setlength{\pc@Eposx}{\zposx{pdfcomment:\thezref@unique}sp}% \setlength{\pc@Eposy}{\zposy{pdfcomment:\thezref@unique}sp}% - \settoheight{\pc@box@height}{#2}% - \ifthenelse{\equal{\pc@lopt@markup}{Underline}}% - {% - \settodepth{\pc@box@depth}{Tq}% - }% - {% - \settodepth{\pc@box@depth}{#2}% - }% - \ifdim\pc@Sposy<\pc@Eposy% - \pc@annot@samepagefalse% - \else% - \pc@annot@samepagetrue% - \fi% - \ifpc@annot@samepage\else% + \ifmmode% \ifpc@gopt@final\else% - % 1st part of annotation on 1st page - \pc@annot@calc@pos% - \pc@copy@xy@to@anna% - \renewcommand{\pc@anna@x@two}{\pc@x@right@text}% - \renewcommand{\pc@anna@x@four}{\pc@x@right@text}% - %calculate baseline of last line (not necessarily bottom text block!) - \setlength\pc@dimc{\dimexpr \dimexpr \pc@anna@y@three bp \relax\relax}% - \setlength\pc@dimd{\dimexpr \paperheight - \dimexpr 1in\relax - \voffset - \topmargin - \headheight - \headsep - \textheight\relax}% - \whiledo{\lengthtest{\pc@dimc>\pc@dimd}}% + %changed \pc@encode@PDF, \pdfstringdef does not work in math mode + \marginnote{\pc@encode@PDF@math{#3}}% + \HyColor@XZeroOneThreeFour{\pc@lopt@color}{\pc@hyenc@color}{pdfcomment}{color}% + \HyColor@XZeroOneThreeFour{\pc@lopt@fontcolor}{\pc@hyenc@fontcolor}{pdfcomment}{color}% + \HyColor@XZeroOneThreeFour{\pc@lopt@icolor}{\pc@hyenc@icolor}{pdfcomment}{color}% + \settowidth{\pc@box@width}{$\pc@lopt@mathstyle#2$}% + \settoheight{\pc@box@height}{$\pc@lopt@mathstyle#2$}% + \settodepth{\pc@box@depth}{$\pc@lopt@mathstyle#2$}% + \setbox\pc@mathannot@box=\hbox to\pc@box@width% {% - \addtolength\pc@dimc{-\the\baselineskip}% + \vrule height\pc@box@height depth\pc@box@depth width\z@% + \hfill% + \pc@annot@calc@pos@math% + \xdef\pc@annot@quadpoints{\pc@x@one\space\pc@y@one\space\pc@x@two\space\pc@y@two\space\pc@x@three\space\pc@y@three\space\pc@x@four\space\pc@y@four}% + \ifpdf% + \pc@annot@markup@pdf% + \else% + \ifpc@gopt@dvipdfmx% + \pc@annot@markup@dvipdfmx% + \else% + \pc@annot@markup@dvips% + \fi% + \fi% }% - % one too much - \addtolength\pc@dimc{\the\baselineskip}% - \renewcommand{\pc@anna@y@four}{\pc@pttobp{\pc@dimc}}% - \renewcommand{\pc@anna@y@two}{\pc@pttobp{\pc@dimc + \pc@box@depth + \pc@box@height +2pt}}% - \pc@annot@secondpagefalse% - \pc@create@annot% + \wd\pc@mathannot@box\z@% + \ht\pc@mathannot@box\z@% + \dp\pc@mathannot@box\z@% + \box\pc@mathannot@box% + \nobreak% \fi% - \fi% - \ifpc@gopt@final\else% - \pc@create@lpc% - \fi% - #2% - \zsavepos{pdfcomment:\thezref@unique}% - \zref@refused{pdfcomment:\thezref@unique}% - \refstepcounter{zref@unique}% - \ifpc@gopt@final\else% - \ifpc@annot@samepage% - % annot complete on one page - \pc@annot@calc@pos% - \pc@copy@xy@to@anna% - \pc@annot@secondpagefalse% - \pc@create@annot% + #2% + \else% + \pc@encode@PDF{#3}% + \settoheight{\pc@box@height}{#2}% + \ifthenelse{\equal{\pc@lopt@markup}{Underline}}% + {% + \settodepth{\pc@box@depth}{Tq}% + }% + {% + \settodepth{\pc@box@depth}{#2}% + }% + \ifdim\pc@Sposy<\pc@Eposy% + \pc@annot@samepagefalse% \else% - % 2nd part of annotation on 2nd page - \pc@annot@calc@pos% - \pc@copy@xy@to@anna% - \renewcommand{\pc@anna@x@one}{\pc@x@left@text}% - \renewcommand{\pc@anna@x@three}{\pc@x@left@text}% - \setlength\pc@dimc{\dimexpr \dimexpr \pc@anna@y@four bp \relax\relax}% - \setlength\pc@dimd{\dimexpr \paperheight - \dimexpr 1in\relax - \voffset - \topmargin - \headheight - \headsep\relax}% - \whiledo{\lengthtest{\pc@dimc<\pc@dimd}}% - {% + \pc@annot@samepagetrue% + \fi% + \ifpc@annot@samepage\else% + \ifpc@gopt@final\else% + % 1st part of annotation on 1st page + \pc@annot@calc@pos% + \pc@copy@xy@to@anna% + \renewcommand{\pc@anna@x@two}{\pc@x@right@text}% + \renewcommand{\pc@anna@x@four}{\pc@x@right@text}% + %calculate baseline of last line (not necessarily bottom text block!) + \setlength\pc@dimc{\dimexpr \dimexpr \pc@anna@y@three bp \relax\relax}% + \setlength\pc@dimd{\dimexpr \paperheight - \dimexpr 1in\relax - \voffset - \topmargin - \headheight - \headsep - \textheight\relax}% + \whiledo{\lengthtest{\pc@dimc>\pc@dimd}}% + {% + \addtolength\pc@dimc{-\the\baselineskip}% + }% + % one too much \addtolength\pc@dimc{\the\baselineskip}% - }% - % two too much - \addtolength\pc@dimc{-\the\baselineskip}\addtolength\pc@dimc{-\the\baselineskip}% - \renewcommand{\pc@anna@y@three}{\pc@pttobp{\pc@dimc}}% - \renewcommand{\pc@anna@y@one}{\pc@pttobp{\pc@dimc + \pc@box@depth + \pc@box@height +2pt}}% - \pc@annot@secondpagetrue% - \pc@create@annot% + \renewcommand{\pc@anna@y@four}{\pc@pttobp{\pc@dimc}}% + \renewcommand{\pc@anna@y@two}{\pc@pttobp{\pc@dimc + \pc@box@depth + \pc@box@height +2pt}}% + \pc@annot@secondpagefalse% + \pc@create@annot% + \fi% + \fi% + \ifpc@gopt@final\else% + \pc@create@lpc% + \fi% + #2% + \zsavepos{pdfcomment:\thezref@unique}% + \zref@refused{pdfcomment:\thezref@unique}% + \refstepcounter{zref@unique}% + \ifpc@gopt@final\else% + \ifpc@annot@samepage% + % annot complete on one page + \pc@annot@calc@pos% + \pc@copy@xy@to@anna% + \pc@annot@secondpagefalse% + \pc@create@annot% + \else% + % 2nd part of annotation on 2nd page + \pc@annot@calc@pos% + \pc@copy@xy@to@anna% + \renewcommand{\pc@anna@x@one}{\pc@x@left@text}% + \renewcommand{\pc@anna@x@three}{\pc@x@left@text}% + \setlength\pc@dimc{\dimexpr \dimexpr \pc@anna@y@four bp \relax\relax}% + \setlength\pc@dimd{\dimexpr \paperheight - \dimexpr 1in\relax - \voffset - \topmargin - \headheight - \headsep\relax}% + \whiledo{\lengthtest{\pc@dimc<\pc@dimd}}% + {% + \addtolength\pc@dimc{\the\baselineskip}% + }% + % two too much + \addtolength\pc@dimc{-\the\baselineskip}\addtolength\pc@dimc{-\the\baselineskip}% + \renewcommand{\pc@anna@y@three}{\pc@pttobp{\pc@dimc}}% + \renewcommand{\pc@anna@y@one}{\pc@pttobp{\pc@dimc + \pc@box@depth + \pc@box@height +2pt}}% + \pc@annot@secondpagetrue% + \pc@create@annot% + \fi% \fi% \fi% + %only local! + \gdef\pc@lopt@mathstyle{}% }% % \newenvironment{pdfsidelinecomment}[2][]% @@ -2045,6 +2089,22 @@ \HyColor@XZeroOneThreeFour{\pc@lopt@icolor}{\pc@hyenc@icolor}{pdfcomment}{color}% }% % +\newcommand{\pc@encode@PDF@math}[1]% +{% + \gdef\pc@lopt@comment{#1}% + \ifthenelse{\equal{\pc@lopt@deadline}{}}% + {% + \gdef\pc@comment@deadline{\pc@lopt@comment}% + \pdfstringdef\pc@pdfenc@contents{\pc@comment@deadline}% + }% + {% + \gdef\pc@comment@deadline{\pc@lopt@comment\textCR(\pc@lopt@deadline)}% + \pdfstringdef\pc@pdfenc@contents{\pc@comment@deadline}% + }% + \pdfstringdef\pc@pdfenc@author{\pc@lopt@author}% + \pdfstringdef\pc@pdfenc@subject{\pc@lopt@subject}% +}% +% \newcommand{\pc@annot@text}% {% \pc@lopt@c\space% @@ -2245,6 +2305,20 @@ \setlength{\pc@dimb}{\dimexpr \pc@Eposy - \pc@box@depth - 1pt\relax}% }% % +\newcommand{\pc@annot@calc@pos@math}% +{% + \renewcommand{\pc@x@one}{\pc@pttobp{\pc@Sposx}}% + \renewcommand{\pc@x@two}{\pc@pttobp{\dimexpr \pc@Sposx + \pc@box@width\relax}}% + \renewcommand{\pc@x@three}{\pc@pttobp{\pc@Sposx}}% + \renewcommand{\pc@x@four}{\pc@pttobp{\dimexpr \pc@Sposx + \pc@box@width\relax}}% + \renewcommand{\pc@y@one}{\pc@pttobp{\dimexpr \pc@Sposy + \pc@box@height + 1pt\relax}}% + \renewcommand{\pc@y@two}{\pc@pttobp{\dimexpr \pc@Sposy + \pc@box@height + 1pt\relax}}% + \renewcommand{\pc@y@three}{\pc@pttobp{\dimexpr \pc@Sposy - \pc@box@depth - 1pt\relax}}% + \renewcommand{\pc@y@four}{\pc@pttobp{\dimexpr \pc@Sposy - \pc@box@depth - 1pt\relax}}% + \setlength{\pc@dima}{\dimexpr \pc@Sposy - \pc@box@depth - 1pt\relax}% + \setlength{\pc@dimb}{\dimexpr \pc@Eposy - \pc@box@depth - 1pt\relax}% +}% +% \newcommand{\pc@create@annot@sideline}% {% %create options for \pdfannot -- cgit v1.2.3