From 6d4f314202913f300037670418ac02c1bc1513f7 Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Wed, 11 Mar 2009 13:56:28 +0000
Subject: pdfcomment update (11mar09)

git-svn-id: svn://tug.org/texlive/trunk@12366 c570f23f-e606-0410-a88d-b1316a301751
---
 .../texmf-dist/tex/latex/pdfcomment/pdfcomment.sty | 775 ++++++++++++++++-----
 1 file changed, 603 insertions(+), 172 deletions(-)

(limited to 'Master/texmf-dist/tex/latex/pdfcomment/pdfcomment.sty')

diff --git a/Master/texmf-dist/tex/latex/pdfcomment/pdfcomment.sty b/Master/texmf-dist/tex/latex/pdfcomment/pdfcomment.sty
index ec605e03752..bd17961f093 100644
--- a/Master/texmf-dist/tex/latex/pdfcomment/pdfcomment.sty
+++ b/Master/texmf-dist/tex/latex/pdfcomment/pdfcomment.sty
@@ -20,8 +20,7 @@
 %% This work consists of all files listed in manifest.txt.
 %%
 %
-\ProvidesPackage{pdfcomment}[2009/02/19 pdfcomment.sty v1.2 - Josef Kleber (C) 2008-2009]%
-% dvips, dvipdfmx, XeLaTeX drivers by Alexander Grahn
+\ProvidesPackage{pdfcomment}[2009/03/09 pdfcomment.sty v1.3 - Josef Kleber (C) 2008-2009]%
 %
 \RequirePackage{xkeyval}%
 %
@@ -38,6 +37,7 @@
 \gdef\pc@goptd@height{0pt}%
 \gdef\pc@goptd@depth{0pt}%
 \gdef\pc@goptd@opacity{1.0}%
+\gdef\pc@goptd@markup{Highlight}%
 \gdef\pc@goptd@dvipdfmx{true}%
 %
 % values for global package options
@@ -53,8 +53,7 @@
 \gdef\pc@gopt@height{}%
 \gdef\pc@gopt@depth{}%
 \gdef\pc@gopt@opacity{}%
-\newif\ifpc@gopt@dvipdfmx\pc@gopt@dvipdfmxfalse%
-\newif\ifpc@gopt@final\pc@gopt@finalfalse%
+\gdef\pc@gopt@markup{}%
 %
 % values for local command options
 \gdef\pc@lopt@subject{}%
@@ -69,6 +68,60 @@
 \gdef\pc@lopt@height{}%
 \gdef\pc@lopt@depth{}%
 \gdef\pc@lopt@opacity{}%
+\gdef\pc@lopt@markup{}%
+%
+\newif\ifpc@gopt@dvipdfmx\pc@gopt@dvipdfmxfalse%
+\newif\ifpc@gopt@final\pc@gopt@finalfalse%
+\newif\ifpc@annot@samepage\pc@annot@samepagetrue%
+\newif\ifpc@annot@secondpage\pc@annot@secondpagefalse%
+%
+\newcounter{pc@annot@lines}%
+%
+\newlength{\pc@dima}%
+\newlength{\pc@dimb}%
+\newlength{\pc@dimc}%
+\newlength{\pc@dimd}%
+\newlength{\pc@dime}%
+%
+\newlength{\pc@Sposx}%
+\newlength{\pc@Sposy}%
+\newlength{\pc@Eposx}%
+\newlength{\pc@Eposy}%
+\newlength{\pc@box@height}%
+\newlength{\pc@box@depth}%
+%
+\newcommand{\pc@x@one}{}%
+\newcommand{\pc@x@two}{}%
+\newcommand{\pc@x@three}{}%
+\newcommand{\pc@x@four}{}%
+\newcommand{\pc@y@one}{}%
+\newcommand{\pc@y@two}{}%
+\newcommand{\pc@y@three}{}%
+\newcommand{\pc@y@four}{}%
+\newcommand{\pc@anna@x@one}{}%
+\newcommand{\pc@anna@x@two}{}%
+\newcommand{\pc@anna@x@three}{}%
+\newcommand{\pc@anna@x@four}{}%
+\newcommand{\pc@anna@y@one}{}%
+\newcommand{\pc@anna@y@two}{}%
+\newcommand{\pc@anna@y@three}{}%
+\newcommand{\pc@anna@y@four}{}%
+\newcommand{\pc@annb@x@one}{}%
+\newcommand{\pc@annb@x@two}{}%
+\newcommand{\pc@annb@x@three}{}%
+\newcommand{\pc@annb@x@four}{}%
+\newcommand{\pc@annb@y@one}{}%
+\newcommand{\pc@annb@y@two}{}%
+\newcommand{\pc@annb@y@three}{}%
+\newcommand{\pc@annb@y@four}{}%
+%
+\newcommand{\pc@x@left@text}{}%
+\newcommand{\pc@x@right@text}{}%
+\newcommand{\pc@y@top@text}{}%
+\newcommand{\pc@y@bottom@text}{}%
+%
+\newcommand{\pc@raggedleftmarginnote}{\centering}%
+\newcommand{\pc@raggedrightmarginnote}{\centering}%
 %
 % define global style option avatar for setting a predefined set of options (Avatar)
 \define@key{pdfcomment.sty}{avatar}[]%
@@ -156,6 +209,12 @@
   \gdef\pc@gopt@opacity{#1}%
 }%
 %
+% define global style option markup for setting the markup type of the pdf markup annotations
+\define@key{pdfcomment.sty}{markup}[\pc@goptd@markup]%
+{%
+  \gdef\pc@gopt@markup{#1}%
+}%
+%
 % define global style option dvipdfmx for setting the output driver in DVI mode
 \define@key{pdfcomment.sty}{dvipdfmx}[\pc@goptd@dvipdfmx]%
 {%
@@ -184,7 +243,7 @@
 % define local style option style for setting a predefined set of options (Style)
 \define@key{pdfcomment}{style}[]%
 {%
-  \edef\pc@lopt@loadstyle{\noexpand\setkeys{pdfcomment.sty}{\csname pc@style@#1\endcsname}}%
+  \edef\pc@lopt@loadstyle{\noexpand\setkeys{pdfcomment}{\csname pc@style@#1\endcsname}}%
   \pc@lopt@loadstyle%
 }%
 %
@@ -240,18 +299,21 @@
 \define@key{pdfcomment}{width}[\pc@gopt@width]%
 {%
   \gdef\pc@lopt@width{#1}%
+  \PackageInfo{pdfcomment.sty}{Setting of option width in command \pdfcomment ignored!}%
 }%
 %
 % define local style option height for setting the height of the pdf annotations
 \define@key{pdfcomment}{height}[\pc@gopt@height]%
 {%
   \gdef\pc@lopt@height{#1}%
+  \PackageInfo{pdfcomment.sty}{Setting of option height in command \pdfcomment ignored!}%
 }%
 %
 % define local style option depth for setting the depth of the pdf annotations
 \define@key{pdfcomment}{depth}[\pc@gopt@depth]%
 {%
   \gdef\pc@lopt@depth{#1}%
+  \PackageInfo{pdfcomment.sty}{Setting of option depth in command \pdfcomment ignored!}%
 }%
 %
 % define local style option opacity for setting the opacity of the pdf annotations
@@ -260,17 +322,24 @@
   \gdef\pc@lopt@opacity{#1}%
 }%
 %
+% define local style option markup for setting the markup type of the pdf markup annotations
+\define@key{pdfcomment}{markup}[\pc@gopt@markup]%
+{%
+  \gdef\pc@lopt@markup{#1}%
+  \PackageInfo{pdfcomment.sty}{Setting of option markup in command \pdfcomment ignored!}%
+}%
+%
 % define local style option avatar for setting a predefined set of options (Avatar)
 \define@key{pdfmargincomment}{avatar}[]%
 {%
-  \edef\pc@lopt@loadavatar{\noexpand\setkeys{pdfcomment}{\csname pc@avatar@#1\endcsname}}%
+  \edef\pc@lopt@loadavatar{\noexpand\setkeys{pdfmargincomment}{\csname pc@avatar@#1\endcsname}}%
   \pc@lopt@loadavatar%
 }%
 %
 % define local style option style for setting a predefined set of options (Style)
 \define@key{pdfmargincomment}{style}[]%
 {%
-  \edef\pc@lopt@loadstyle{\noexpand\setkeys{pdfcomment.sty}{\csname pc@style@#1\endcsname}}%
+  \edef\pc@lopt@loadstyle{\noexpand\setkeys{pdfmargincomment}{\csname pc@style@#1\endcsname}}%
   \pc@lopt@loadstyle%
 }%
 %
@@ -326,18 +395,21 @@
 \define@key{pdfmargincomment}{width}[\pc@gopt@width]%
 {%
   \gdef\pc@lopt@width{#1}%
+  \PackageInfo{pdfcomment.sty}{Setting of option width in command \pdfmargincomment ignored!}%
 }%
 %
 % define local style option height for setting the height of the pdf annotations
 \define@key{pdfmargincomment}{height}[\pc@gopt@height]%
 {%
   \gdef\pc@lopt@height{#1}%
+  \PackageInfo{pdfcomment.sty}{Setting of option height in command \pdfmargincomment ignored!}%
 }%
 %
 % define local style option depth for setting the depth of the pdf annotations
 \define@key{pdfmargincomment}{depth}[\pc@gopt@depth]%
 {%
   \gdef\pc@lopt@depth{#1}%
+  \PackageInfo{pdfcomment.sty}{Setting of option depth in command \pdfmargincomment ignored!}%
 }%
 %
 % define local style option opacity for setting the opacity of the pdf annotations
@@ -346,17 +418,24 @@
   \gdef\pc@lopt@opacity{#1}%
 }%
 %
+% define local style option markup for setting the markup type of the pdf markup annotations
+\define@key{pdfmargincomment}{markup}[\pc@gopt@markup]%
+{%
+  \gdef\pc@lopt@markup{#1}%
+  \PackageInfo{pdfcomment.sty}{Setting of option margin in command \pdfmargincomment ignored!}%
+}%
+%
 % define local style option avatar for setting a predefined set of options (Avatar)
 \define@key{pdffreetextcomment}{avatar}[]%
 {%
-  \edef\pc@lopt@loadavatar{\noexpand\setkeys{pdfcomment}{\csname pc@avatar@#1\endcsname}}%
+  \edef\pc@lopt@loadavatar{\noexpand\setkeys{pdffreetextcomment}{\csname pc@avatar@#1\endcsname}}%
   \pc@lopt@loadavatar%
 }%
 %
 % define local style option style for setting a predefined set of options (Style)
 \define@key{pdffreetextcomment}{style}[]%
 {%
-  \edef\pc@lopt@loadstyle{\noexpand\setkeys{pdfcomment.sty}{\csname pc@style@#1\endcsname}}%
+  \edef\pc@lopt@loadstyle{\noexpand\setkeys{pdffreetextcomment}{\csname pc@style@#1\endcsname}}%
   \pc@lopt@loadstyle%
 }%
 %
@@ -382,6 +461,7 @@
 \define@key{pdffreetextcomment}{icon}[\pc@gopt@icon]%
 {%
   \gdef\pc@lopt@icon{#1}%
+  \PackageInfo{pdfcomment.sty}{Setting of option icon in command \pdffreetextcomment ignored!}%
 }%
 %
 % define local command option open for setting the open status (true,false) of pdf annotations
@@ -394,6 +474,7 @@
 \define@key{pdffreetextcomment}{hspace}[\pc@gopt@hspace]%
 {%
   \gdef\pc@lopt@hspace{#1}%
+  \PackageInfo{pdfcomment.sty}{Setting of option open in command \pdffreetextcomment ignored!}%
 }%
 %
 % define local style option voffset for setting the vertical offset of the pdf annotations
@@ -424,6 +505,7 @@
 \define@key{pdffreetextcomment}{depth}[\pc@gopt@depth]%
 {%
   \gdef\pc@lopt@depth{#1}%
+  \PackageInfo{pdfcomment.sty}{Setting of option icon in command \pdffreetextcomment ignored!}%
 }%
 %
 % define local style option opacity for setting the opacity of the pdf annotations
@@ -432,10 +514,124 @@
   \gdef\pc@lopt@opacity{#1}%
 }%
 %
-\ExecuteOptionsX{subject,color,author,icon,open,hspace,voffset,hoffset,width,height,depth,opacity}%
+% define local style option markup for setting the markup type of the pdf markup annotations
+\define@key{pdffreetextcomment}{markup}[\pc@gopt@markup]%
+{%
+  \gdef\pc@lopt@markup{#1}%
+  \PackageInfo{pdfcomment.sty}{Setting of option icon in command \pdffreetextcomment ignored!}%
+}%
+%
+% define local style option avatar for setting a predefined set of options (Avatar)
+\define@key{pdfmarkupcomment}{avatar}[]%
+{%
+  \edef\pc@lopt@loadavatar{\noexpand\setkeys{pdfmarkupcomment}{\csname pc@avatar@#1\endcsname}}%
+  \pc@lopt@loadavatar%
+}%
+%
+% define local style option style for setting a predefined set of options (Style)
+\define@key{pdfmarkupcomment}{style}[]%
+{%
+  \edef\pc@lopt@loadstyle{\noexpand\setkeys{pdfmarkupcomment}{\csname pc@style@#1\endcsname}}%
+  \pc@lopt@loadstyle%
+}%
+%
+% define local command option subject for setting the subject of pdf annotations
+\define@key{pdfmarkupcomment}{subject}[\pc@gopt@subject]%
+{%
+  \gdef\pc@lopt@subject{#1}%
+}%
+%
+% define local command option color for setting the color of pdf annotations
+\define@key{pdfmarkupcomment}{color}[\pc@gopt@color]%
+{%
+  \gdef\pc@lopt@color{#1}%
+}%
+%
+% define local command option author for setting the author of pdf annotations
+\define@key{pdfmarkupcomment}{author}[\pc@gopt@author]%
+{%
+  \gdef\pc@lopt@author{#1}%
+}%
+%
+% define local command option icon for setting the icon of pdf annotations
+\define@key{pdfmarkupcomment}{icon}[\pc@gopt@icon]%
+{%
+  \gdef\pc@lopt@icon{#1}%
+  \PackageInfo{pdfcomment.sty}{Setting of option icon in command \pdfmarkupcomment ignored!}%
+}%
+%
+% define local command option open for setting the open status (true,false) of pdf annotations
+\define@key{pdfmarkupcomment}{open}[\pc@gopt@open]%
+{%
+  \gdef\pc@lopt@open{#1}%
+  \PackageInfo{pdfcomment.sty}{Setting of option open in command \pdfmarkupcomment ignored!}%
+}%
+%
+% define local command option hspace for setting the space after the pdf annotations
+\define@key{pdfmarkupcomment}{hspace}[\pc@gopt@hspace]%
+{%
+  \gdef\pc@lopt@hspace{#1}%
+  \PackageInfo{pdfcomment.sty}{Setting of option icon in command \pdfmarkupcomment ignored!}%
+}%
+%
+% define local style option voffset for setting the vertical offset of the pdf annotations
+\define@key{pdfmarkupcomment}{voffset}[\pc@gopt@voffset]%
+{%
+  \gdef\pc@lopt@voffset{#1}%
+  \PackageInfo{pdfcomment.sty}{Setting of option voffset in command \pdfmarkupcomment ignored!}%
+}%
+%
+% define local style option hoffset for setting the horizontal offset of the pdf annotations
+\define@key{pdfmarkupcomment}{hoffset}[\pc@gopt@hoffset]%
+{%
+  \gdef\pc@lopt@hoffset{#1}%
+  \PackageInfo{pdfcomment.sty}{Setting of option hoffset in command \pdfmarkupcomment ignored!}%
+}%
+%
+% define local style option width for setting the width of the pdf annotations
+\define@key{pdfmarkupcomment}{width}[\pc@gopt@width]%
+{%
+  \gdef\pc@lopt@width{#1}%
+  \PackageInfo{pdfcomment.sty}{Setting of option width in command \pdfmarkupcomment ignored!}%
+}%
+%
+% define local style option height for setting the height of the pdf annotations
+\define@key{pdfmarkupcomment}{height}[\pc@gopt@height]%
+{%
+  \gdef\pc@lopt@height{#1}%
+  \PackageInfo{pdfcomment.sty}{Setting of option height in command \pdfmarkupcomment ignored!}%
+}%
+%
+% define local style option depth for setting the depth of the pdf annotations
+\define@key{pdfmarkupcomment}{depth}[\pc@gopt@depth]%
+{%
+  \gdef\pc@lopt@depth{#1}%
+  \PackageInfo{pdfcomment.sty}{Setting of option depth in command \pdfmarkupcomment ignored!}%
+}%
+%
+% define local style option opacity for setting the opacity of the pdf annotations
+\define@key{pdfmarkupcomment}{opacity}[\pc@gopt@opacity]%
+{%
+  \gdef\pc@lopt@opacity{#1}%
+}%
+%
+% define local style option markup for setting the markup type of the pdf markup annotations
+\define@key{pdfmarkupcomment}{markup}[\pc@gopt@markup]%
+{%
+  \gdef\pc@lopt@markup{#1}%
+}%
+%
+\ExecuteOptionsX{subject,color,author,icon,open,hspace,voffset,hoffset,width,height,depth,opacity,markup}%
 %
 \ProcessOptionsX\relax%
 %
+% problems with older versions of hyperref than v6.76a [2007/04/09]
+% reported by Gabriel Cardona
+\RequirePackage{hyperref}[2007/04/09]%
+\RequirePackage{zref-savepos}[2007/04/22]%
+\zref@require@unique%
+\RequirePackage{ifthen}%
+\RequirePackage{calc}%
 \RequirePackage{marginnote}%
 \RequirePackage{ifpdf}%
 %
@@ -461,10 +657,6 @@
   \fi%
 \fi%
 %
-% problems with older versions of hyperref than v6.76a [2007/04/09]
-% reported by Gabriel Cardona
-\RequirePackage{hyperref}[2007/04/09]%
-%
 % Using the options draft, final and dvipdfmx in \pdfcommentsetup makes absolutely no sense!
 % Therefore, they are switched off at "\AtBeginDocument" 
 % and a warning is issued by xkeyval.sty, if used.
@@ -474,32 +666,15 @@
   \disable@keys{pdfcomment.sty}{final}%
   \disable@keys{pdfcomment.sty}{dvipdfmx}%
 }%
-\newcommand{\pdfcomment}[2][subject={\pc@gopt@subject},color={\pc@gopt@color},author={\pc@gopt@author},icon={\pc@gopt@icon},open={\pc@gopt@open},hspace={\pc@gopt@hspace},voffset={\pc@gopt@voffset},hoffset={\pc@gopt@hoffset},width={\pc@gopt@width},height={\pc@gopt@height},depth={\pc@gopt@depth},opacity={\pc@gopt@opacity}]%
+\newcommand{\pdfcomment}[2][subject={\pc@gopt@subject},color={\pc@gopt@color},author={\pc@gopt@author},icon={\pc@gopt@icon},open={\pc@gopt@open},hspace={\pc@gopt@hspace},voffset={\pc@gopt@voffset},hoffset={\pc@gopt@hoffset},width={\pc@gopt@width},height={\pc@gopt@height},depth={\pc@gopt@depth},opacity={\pc@gopt@opacity},markup={\pc@gopt@markup}]%
 {%
   % Copy all global options to local options
-  \gdef\pc@lopt@subject{\pc@gopt@subject}%
-  \gdef\pc@lopt@color{\pc@gopt@color}%
-  \gdef\pc@lopt@author{\pc@gopt@author}%
-  \gdef\pc@lopt@icon{\pc@gopt@icon}%
-  \gdef\pc@lopt@open{\pc@gopt@open}%
-  \gdef\pc@lopt@hspace{\pc@gopt@hspace}%
-  \gdef\pc@lopt@voffset{\pc@gopt@voffset}%
-  \gdef\pc@lopt@hoffset{\pc@gopt@hoffset}%
-  \gdef\pc@lopt@width{\pc@gopt@width}%
-  \gdef\pc@lopt@height{\pc@gopt@height}%
-  \gdef\pc@lopt@depth{\pc@gopt@depth}%
-  \gdef\pc@lopt@opacity{\pc@gopt@opacity}%
+  \pc@copy@gopt@lopt%
   % Change local options if specified
   \setkeys{pdfcomment}{#1}%
   % Encode Contents, Author and Subject to pdf encodings (PD or PU) with hyperref's \pdfstringdef
-  \def\pc@pdfenc@contents{}%
-  \pdfstringdef\pc@pdfenc@contents{#2}%
-  \def\pc@pdfenc@author{}%
-  \pdfstringdef\pc@pdfenc@author{\pc@lopt@author}%
-  \def\pc@pdfenc@subject{}%
-  \pdfstringdef\pc@pdfenc@subject{\pc@lopt@subject}%
-  % transform color input to pdf color
-  \HyColor@XZeroOneThreeFour{\pc@lopt@color}{\pc@hyenc@color}{pdfcomment}{color}%
+  % and transform color input to pdf color
+  \pc@encode@PDF{#2}%
   \ifpc@gopt@final\else%
     % typeset text annotation (see: PDF Reference)
     \ifpdf%
@@ -514,15 +689,8 @@
           \hskip\pc@lopt@hoffset%
           \pdfannot width 0pt height \baselineskip depth 0pt%
           {%
-          /Subtype /Text%
-          /C [\pc@hyenc@color]%
-          /CA \pc@lopt@opacity%
-          /T (\pc@pdfenc@author)%
-          /Subj (\pc@pdfenc@subject)%
-          /Name /\pc@lopt@icon%
-          /Contents (\pc@pdfenc@contents)%
-          /Open \pc@lopt@open%
-          /F 4%
+            /Subtype /Text%
+            \pc@annot@text%
           }%
         \hss%
         }%
@@ -542,14 +710,7 @@
             \special{pdf: ann width 0pt\space height \the\baselineskip\space depth 0pt%
               <<%
                 /Subtype /Text%
-                /C [\pc@hyenc@color]%
-                /CA \pc@lopt@opacity%
-                /T (\pc@pdfenc@author)%
-                /Subj (\pc@pdfenc@subject)%
-                /Name /\pc@lopt@icon%
-                /Contents (\pc@pdfenc@contents)%
-                /Open \pc@lopt@open%
-                /F 4%
+                \pc@annot@text%
               >>%
             }%
             \hss%
@@ -571,16 +732,7 @@
             {%
               pdfmark=/ANN,%
               Subtype=/Text,%
-              Raw={% 
-                /C [\pc@hyenc@color]%
-                /CA \pc@lopt@opacity%
-                /T (\pc@pdfenc@author)%
-                /Subj (\pc@pdfenc@subject)%
-                /Name /\pc@lopt@icon%
-                /Contents (\pc@pdfenc@contents)%
-                /Open \pc@lopt@open%
-                /F 4%
-              }%
+              Raw={\pc@annot@text}%
             }%
             \hss%
           }%
@@ -592,37 +744,20 @@
   \fi%
 }%
 %
-\newcommand{\pdfmargincomment}[2][subject={\pc@gopt@subject},color={\pc@gopt@color},author={\pc@gopt@author},icon={\pc@gopt@icon},open={\pc@gopt@open},hspace={\pc@gopt@hspace},voffset={\pc@gopt@voffset},hoffset={\pc@gopt@hoffset},width={\pc@gopt@width},height={\pc@gopt@height},depth={\pc@gopt@depth},opacity={\pc@gopt@opacity}]%
+\newcommand{\pdfmargincomment}[2][subject={\pc@gopt@subject},color={\pc@gopt@color},author={\pc@gopt@author},icon={\pc@gopt@icon},open={\pc@gopt@open},hspace={\pc@gopt@hspace},voffset={\pc@gopt@voffset},hoffset={\pc@gopt@hoffset},width={\pc@gopt@width},height={\pc@gopt@height},depth={\pc@gopt@depth},opacity={\pc@gopt@opacity},markup={\pc@gopt@markup}]%
 {%
   % Copy all global options to local options
-  \gdef\pc@lopt@subject{\pc@gopt@subject}%
-  \gdef\pc@lopt@color{\pc@gopt@color}%
-  \gdef\pc@lopt@author{\pc@gopt@author}%
-  \gdef\pc@lopt@icon{\pc@gopt@icon}%
-  \gdef\pc@lopt@open{\pc@gopt@open}%
-  \gdef\pc@lopt@hspace{\pc@gopt@hspace}%
-  \gdef\pc@lopt@voffset{\pc@gopt@voffset}%
-  \gdef\pc@lopt@hoffset{\pc@gopt@hoffset}%
-  \gdef\pc@lopt@width{\pc@gopt@width}%
-  \gdef\pc@lopt@height{\pc@gopt@height}%
-  \gdef\pc@lopt@depth{\pc@gopt@depth}%
-  \gdef\pc@lopt@opacity{\pc@gopt@opacity}%
+  \pc@copy@gopt@lopt%
   % Change local options if specified
   \setkeys{pdfmargincomment}{#1}%
   % Encode Contents, Author and Subject to pdf encodings (PD or PU) with hyperref's \pdfstringdef
-  \def\pc@pdfenc@contents{}%
-  \pdfstringdef\pc@pdfenc@contents{#2}%
-  \def\pc@pdfenc@author{}%
-  \pdfstringdef\pc@pdfenc@author{\pc@lopt@author}%
-  \def\pc@pdfenc@subject{}%
-  \pdfstringdef\pc@pdfenc@subject{\pc@lopt@subject}%
-  % transform color input to pdf color
-  \HyColor@XZeroOneThreeFour{\pc@lopt@color}{\pc@hyenc@color}{pdfcomment}{color}%
+  % and transform color input to pdf color
+  \pc@encode@PDF{#2}%
   \ifpc@gopt@final\else%
-    \begingroup
+    \begingroup%
     % center marginnotes!
-      \renewcommand*{\raggedleftmarginnote}{\centering}%
-      \renewcommand*{\raggedrightmarginnote}{\centering}%
+      \renewcommand{\raggedleftmarginnote}{\pc@raggedleftmarginnote}%
+      \renewcommand{\raggedrightmarginnote}{\pc@raggedrightmarginnote}%
       % typeset text annotation (see: PDF Reference)
       \marginnote%
       {%
@@ -639,14 +774,7 @@
               \pdfannot width 0pt height \baselineskip depth 0pt%
               {%
                 /Subtype /Text%
-                /C [\pc@hyenc@color]%
-                /CA \pc@lopt@opacity%
-                /T (\pc@pdfenc@author)%
-                /Subj (\pc@pdfenc@subject)%
-                /Name /\pc@lopt@icon%
-                /Contents (\pc@pdfenc@contents)%
-                /Open \pc@lopt@open%
-                /F 4%
+                \pc@annot@text%
               }
               \hss%
             }%
@@ -666,14 +794,7 @@
                 \special{pdf: ann width 0pt\space height \the\baselineskip\space depth 0pt%
                   <<%
                     /Subtype /Text%
-                    /C [\pc@hyenc@color]%
-                    /CA \pc@lopt@opacity%
-                    /T (\pc@pdfenc@author)%
-                    /Subj (\pc@pdfenc@subject)%
-                    /Name /\pc@lopt@icon%
-                    /Contents (\pc@pdfenc@contents)%
-                    /Open \pc@lopt@open%
-                    /F 4%
+                    \pc@annot@text%
                   >>%
                 }%
                 \hss%
@@ -695,16 +816,7 @@
                 {%
                   pdfmark=/ANN,%
                   Subtype=/Text,%
-                  Raw={% 
-                    /C [\pc@hyenc@color]%
-                    /CA \pc@lopt@opacity%
-                    /T (\pc@pdfenc@author)%
-                    /Subj (\pc@pdfenc@subject)%
-                    /Name /\pc@lopt@icon%
-                    /Contents (\pc@pdfenc@contents)%
-                    /Open \pc@lopt@open%
-                    /F 4%
-                  }%
+                  Raw={\pc@annot@text}%
                 }%
                 \hss%
               }%
@@ -714,52 +826,23 @@
         \fi%
         \hspace{\pc@lopt@hspace}%
       }%
-    \endgroup
-  \fi
+    \endgroup%
+  \fi%
 }%
 %
-\newcommand{\pdffreetextcomment}[2][subject={\pc@gopt@subject},color={\pc@gopt@color},author={\pc@gopt@author},icon={\pc@gopt@icon},open={\pc@gopt@open},hspace={\pc@gopt@hspace},voffset={\pc@gopt@voffset},hoffset={\pc@gopt@hoffset},width={\pc@gopt@width},height={\pc@gopt@height},depth={\pc@gopt@depth},opacity={\pc@gopt@opacity}]%
+\newcommand{\pdffreetextcomment}[2][subject={\pc@gopt@subject},color={\pc@gopt@color},author={\pc@gopt@author},icon={\pc@gopt@icon},open={\pc@gopt@open},hspace={\pc@gopt@hspace},voffset={\pc@gopt@voffset},hoffset={\pc@gopt@hoffset},width={\pc@gopt@width},height={\pc@gopt@height},depth={\pc@gopt@depth},opacity={\pc@gopt@opacity},markup={\pc@gopt@markup}]%
 {%
   % Copy all global options to local options
-  \gdef\pc@lopt@subject{\pc@gopt@subject}%
-  \gdef\pc@lopt@color{\pc@gopt@color}%
-  \gdef\pc@lopt@author{\pc@gopt@author}%
-  \gdef\pc@lopt@icon{\pc@gopt@icon}%
-  \gdef\pc@lopt@open{\pc@gopt@open}%
-  \gdef\pc@lopt@hspace{\pc@gopt@hspace}%
-  \gdef\pc@lopt@voffset{\pc@gopt@voffset}%
-  \gdef\pc@lopt@hoffset{\pc@gopt@hoffset}%
-  \gdef\pc@lopt@width{\pc@gopt@width}%
-  \gdef\pc@lopt@height{\pc@gopt@height}%
-  \gdef\pc@lopt@depth{\pc@gopt@depth}%
-  \gdef\pc@lopt@opacity{\pc@gopt@opacity}%
+  \pc@copy@gopt@lopt%
   % Change local options if specified
   \setkeys{pdffreetextcomment}{#1}%
   % Encode Contents, Author and Subject to pdf encodings (PD or PU) with hyperref's \pdfstringdef
-  \def\pc@pdfenc@contents{}%
-  \pdfstringdef\pc@pdfenc@contents{#2}%
-  \def\pc@pdfenc@author{}%
-  \pdfstringdef\pc@pdfenc@author{\pc@lopt@author}%
-  \def\pc@pdfenc@subject{}%
-  \pdfstringdef\pc@pdfenc@subject{\pc@lopt@subject}%
-  % transform color input to pdf color
-  \HyColor@XZeroOneThreeFour{\pc@lopt@color}{\pc@hyenc@color}{pdfcomment}{color}%
-  %define options for \pdfannot
-  \def\pc@pdfannotopt{}%
-  \ifx\pc@lopt@width\@empty%
-  \else%
-    \expandafter\def\expandafter\pc@pdfannotopt\expandafter{\pc@pdfannotopt width \pc@lopt@width\space}%
-  \fi%
-  \ifx\pc@lopt@height\@empty%
-  \else%
-    \expandafter\def\expandafter\pc@pdfannotopt\expandafter{\pc@pdfannotopt height \pc@lopt@height\space}%
-  \fi%
-  \ifx\pc@lopt@depth\@empty%
-  \else%
-    \expandafter\def\expandafter\pc@pdfannotopt\expandafter{\pc@pdfannotopt depth \pc@lopt@depth\space}%
-  \fi%
+  % and transform color input to pdf color
+  \pc@encode@PDF{#2}%
+  %create options for \pdfannot
+  \pc@create@pdfannotopt%
   \ifpc@gopt@final\else%
-    % typeset text annotation (see: PDF Reference)
+    % typeset freetext annotation (see: PDF Reference)
     \ifpdf%
       \vbox to 0pt%
       {%
@@ -773,12 +856,7 @@
           \expandafter\pdfannot \pc@pdfannotopt%
           {%
           /Subtype /FreeText%
-          /C [\pc@hyenc@color]%
-          /CA \pc@lopt@opacity%
-          /T (\pc@pdfenc@author)%
-          /Subj (\pc@pdfenc@subject)%
-          /Contents (\pc@pdfenc@contents)%
-          /F 4%
+          \pc@annot@freetext%
           }%
         \hss%
         }%
@@ -798,12 +876,7 @@
             \special{pdf: ann \pc@pdfannotopt%
               <<%
                 /Subtype /FreeText%
-                /C [\pc@hyenc@color]%
-                /CA \pc@lopt@opacity%
-                /T (\pc@pdfenc@author)%
-                /Subj (\pc@pdfenc@subject)%
-                /Contents (\pc@pdfenc@contents)%
-                /F 4%
+                \pc@annot@freetext%
               >>%
             }%
             \hss%
@@ -822,19 +895,12 @@
           {%
             \vsize=0pt%
             \hskip\pc@lopt@hoffset%
-            %create dimensions of annoation
+            %create dimensions of annotation
             \pdfmark[\rule{0pt}{\pc@lopt@height}\rule{\pc@lopt@width}{0pt}]%
             {%
               pdfmark=/ANN,%
               Subtype=/FreeText,%
-              Raw={% 
-                /C [\pc@hyenc@color]%
-                /CA \pc@lopt@opacity%
-                /T (\pc@pdfenc@author)%
-                /Subj (\pc@pdfenc@subject)%
-                /Contents (\pc@pdfenc@contents)%
-                /F 4%
-              }%
+              Raw={\pc@annot@freetext}%
             }%
             \hss%
           }%
@@ -842,7 +908,91 @@
         }%
       \fi%
     \fi%
-    \hspace{\pc@lopt@hspace}%
+  \fi%
+}%
+%
+\newcommand{\pdfmarkupcomment}[3][subject={\pc@gopt@subject},color={\pc@gopt@color},author={\pc@gopt@author},icon={\pc@gopt@icon},open={\pc@gopt@open},hspace={\pc@gopt@hspace},voffset={\pc@gopt@voffset},hoffset={\pc@gopt@hoffset},width={\pc@gopt@width},height={\pc@gopt@height},depth={\pc@gopt@depth},opacity={\pc@gopt@opacity},markup={\pc@gopt@markup}]%
+{%
+  \hspace*{0pt}%
+  % Copy all global options to local options
+  \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}%
+  \setlength{\pc@Sposy}{\zposy{pdfcomment:\thezref@unique}sp}%
+  \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%
+    \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}%
+      \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%
+  #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%
 }%
 %
@@ -866,4 +1016,285 @@
 }%
 %
 %
+\newcommand{\pc@copy@gopt@lopt}%
+{%
+  \gdef\pc@lopt@subject{\pc@gopt@subject}%
+  \gdef\pc@lopt@color{\pc@gopt@color}%
+  \gdef\pc@lopt@author{\pc@gopt@author}%
+  \gdef\pc@lopt@icon{\pc@gopt@icon}%
+  \gdef\pc@lopt@open{\pc@gopt@open}%
+  \gdef\pc@lopt@hspace{\pc@gopt@hspace}%
+  \gdef\pc@lopt@voffset{\pc@gopt@voffset}%
+  \gdef\pc@lopt@hoffset{\pc@gopt@hoffset}%
+  \gdef\pc@lopt@width{\pc@gopt@width}%
+  \gdef\pc@lopt@height{\pc@gopt@height}%
+  \gdef\pc@lopt@depth{\pc@gopt@depth}%
+  \gdef\pc@lopt@opacity{\pc@gopt@opacity}%
+  \gdef\pc@lopt@markup{\pc@gopt@markup}%
+}%
+%
+\newcommand{\pc@encode@PDF}[1]%
+{%
+  \pdfstringdef\pc@pdfenc@contents{#1}%
+  \pdfstringdef\pc@pdfenc@author{\pc@lopt@author}%
+  \pdfstringdef\pc@pdfenc@subject{\pc@lopt@subject}%
+  \HyColor@XZeroOneThreeFour{\pc@lopt@color}{\pc@hyenc@color}{pdfcomment}{color}%
+}%
+%
+\newcommand{\pc@annot@text}%
+{%
+  /C [\pc@hyenc@color]%
+  /CA \pc@lopt@opacity%
+  /T (\pc@pdfenc@author)%
+  /Subj (\pc@pdfenc@subject)%
+  /Name /\pc@lopt@icon%
+  /Contents (\pc@pdfenc@contents)%
+  /Open \pc@lopt@open%
+  /F 4%
+}%
+%
+\newcommand{\pc@annot@freetext}%
+{% 
+  /C [\pc@hyenc@color]%
+  /CA \pc@lopt@opacity%
+  /T (\pc@pdfenc@author)%
+  /Subj (\pc@pdfenc@subject)%
+  /Contents (\pc@pdfenc@contents)%
+  /F 4%
+}%
+%
+\newcommand{\pc@annot@markup@pdf}%
+{%
+  \pdfannot width 0pt height 0pt depth 0pt%
+  {%
+    /Subtype /\pc@lopt@markup%
+    /C [\pc@hyenc@color]%
+    /CA \pc@lopt@opacity%
+    /T (\pc@pdfenc@author)%
+    /Subj (\pc@pdfenc@subject)%
+    /Contents (\pc@pdfenc@contents)%
+    /Open \pc@lopt@open%
+    /QuadPoints [\pc@annot@quadpoints]%
+    /F 4%
+  }%
+}%
+%
+\newcommand{\pc@annot@markup@dvipdfmx}%
+{%
+  \special{pdf: ann width 0pt height 0pt depth 0pt%
+    <<%
+      /Subtype /\pc@lopt@markup%
+      /C [\pc@hyenc@color]%
+      /CA \pc@lopt@opacity%
+      /T (\pc@pdfenc@author)%
+      /Subj (\pc@pdfenc@subject)%
+      /Contents (\pc@pdfenc@contents)%
+      /Open \pc@lopt@open%
+      /QuadPoints [\pc@annot@quadpoints]%
+      /F 4%
+    >>%
+  }%
+}%
+%
+\newcommand{\pc@annot@markup@dvips}%
+{%
+  \pdfmark[\rule{0pt}{0pt}]%
+  {%
+    pdfmark=/ANN,%
+    Subtype=/\pc@lopt@markup,%
+    Raw={
+      /Subtype /\pc@lopt@markup%
+      /C [\pc@hyenc@color]%
+      /CA \pc@lopt@opacity%
+      /T (\pc@pdfenc@author)%
+      /Subj (\pc@pdfenc@subject)%
+      /Contents (\pc@pdfenc@contents)%
+      /Open \pc@lopt@open%
+      /QuadPoints [\pc@annot@quadpoints]%
+      /F 4%
+    }%
+  }%
+}%
+%
+\newcommand{\pc@create@pdfannotopt}%
+{%
+  \gdef\pc@pdfannotopt{}%
+  \ifx\pc@lopt@width\@empty%
+  \else%
+    \expandafter\gdef\expandafter\pc@pdfannotopt\expandafter{\pc@pdfannotopt width \pc@lopt@width\space}%
+  \fi%
+  \ifx\pc@lopt@height\@empty%
+  \else%
+    \expandafter\gdef\expandafter\pc@pdfannotopt\expandafter{\pc@pdfannotopt height \pc@lopt@height\space}%
+  \fi%
+  \ifx\pc@lopt@depth\@empty%
+  \else%
+    \expandafter\gdef\expandafter\pc@pdfannotopt\expandafter{\pc@pdfannotopt depth \pc@lopt@depth\space}%
+  \fi%
+}%
+%
+% thanks to Heiko Oberdiek Msg-Id: <go1hi9$g1s$1@news.belwue.de>
+\newcommand{\pc@pttobp}[1]%
+{%
+  \strip@pt\dimexpr .996264\dimexpr #1\relax\relax%
+}%
+%
+\newcommand{\pc@copy@xy@to@anna}%
+{%
+  \renewcommand{\pc@anna@x@one}{\pc@x@one}%
+  \renewcommand{\pc@anna@x@two}{\pc@x@two}%
+  \renewcommand{\pc@anna@x@three}{\pc@x@three}%
+  \renewcommand{\pc@anna@x@four}{\pc@x@four}%
+  \renewcommand{\pc@anna@y@one}{\pc@y@one}%
+  \renewcommand{\pc@anna@y@two}{\pc@y@two}%
+  \renewcommand{\pc@anna@y@three}{\pc@y@three}%
+  \renewcommand{\pc@anna@y@four}{\pc@y@four}%
+}%
+%
+\newcommand{\pc@copy@anna@to@annb}%
+{%
+  \renewcommand{\pc@annb@x@one}{\pc@anna@x@one}%
+  \renewcommand{\pc@annb@x@two}{\pc@anna@x@two}%
+  \renewcommand{\pc@annb@x@three}{\pc@anna@x@three}%
+  \renewcommand{\pc@annb@x@four}{\pc@anna@x@four}%
+  \renewcommand{\pc@annb@y@one}{\pc@anna@y@one}%
+  \renewcommand{\pc@annb@y@two}{\pc@anna@y@two}%
+  \renewcommand{\pc@annb@y@three}{\pc@anna@y@three}%
+  \renewcommand{\pc@annb@y@four}{\pc@anna@y@four}%
+}%
+%
+\newcommand{\pc@annot@calc@pos}%
+{%
+    \renewcommand{\pc@x@one}{\pc@pttobp{\pc@Sposx}}%
+    \renewcommand{\pc@x@two}{\pc@pttobp{\pc@Eposx}}%
+    \renewcommand{\pc@x@three}{\pc@pttobp{\pc@Sposx}}%
+    \renewcommand{\pc@x@four}{\pc@pttobp{\pc@Eposx}}%
+    \renewcommand{\pc@y@one}{\pc@pttobp{\dimexpr \pc@Sposy + \pc@box@height + 1pt\relax}}%
+    \renewcommand{\pc@y@two}{\pc@pttobp{\dimexpr \pc@Eposy + \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@Eposy - \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}%
+{%
+  \ifdim\pc@dima=\pc@dimb%
+  {% one line
+    \pc@copy@anna@to@annb%
+    \xdef\pc@annot@quadpoints{\pc@annb@x@one\space\pc@annb@y@one\space\pc@annb@x@two\space\pc@annb@y@two\space\pc@annb@x@three\space\pc@annb@y@three\space\pc@annb@x@four\space\pc@annb@y@four}%
+    \ifpdf%
+      \pc@annot@markup@pdf%
+    \else%
+      \ifpc@gopt@dvipdfmx%
+        \pc@annot@markup@dvipdfmx%
+      \else%
+        \pc@annot@markup@dvips%
+      \fi%
+    \fi%
+  }%
+  \else%
+  {% more lines
+    %first line
+    \pc@calc@textblockpos%
+    \pc@copy@anna@to@annb%
+    \renewcommand{\pc@annb@x@two}{\pc@x@right@text}%
+    \renewcommand{\pc@annb@x@four}{\pc@x@right@text}%
+    \renewcommand{\pc@annb@y@two}{\pc@anna@y@one}%
+    \renewcommand{\pc@annb@y@four}{\pc@anna@y@three}%
+    \xdef\pc@annot@quadpoints{\pc@annb@x@one\space\pc@annb@y@one\space\pc@annb@x@two\space\pc@annb@y@two\space\pc@annb@x@three\space\pc@annb@y@three\space\pc@annb@x@four\space\pc@annb@y@four}%
+    \ifpdf%
+      \pc@annot@markup@pdf%
+    \else%
+      \ifpc@gopt@dvipdfmx%
+        \pc@annot@markup@dvipdfmx%
+      \else%
+        \pc@annot@markup@dvips%
+      \fi%
+    \fi%
+    %last line
+    \pc@copy@anna@to@annb%
+    \renewcommand{\pc@annb@x@one}{\pc@x@left@text}%
+    \renewcommand{\pc@annb@x@three}{\pc@x@left@text}%
+    \renewcommand{\pc@annb@y@one}{\pc@anna@y@two}%
+    \renewcommand{\pc@annb@y@three}{\pc@anna@y@four}%
+    \xdef\pc@annot@quadpoints{\pc@annb@x@one\space\pc@annb@y@one\space\pc@annb@x@two\space\pc@annb@y@two\space\pc@annb@x@three\space\pc@annb@y@three\space\pc@annb@x@four\space\pc@annb@y@four}%
+    \ifpdf%
+      \pc@annot@markup@pdf%
+    \else%
+      \ifpc@gopt@dvipdfmx%
+        \pc@annot@markup@dvipdfmx%
+      \else%
+        \pc@annot@markup@dvips%
+      \fi%
+    \fi%
+    %middle lines
+    \pc@copy@anna@to@annb%
+    \setlength{\pc@dimc}{\dimexpr \pc@annb@y@one bp + 0.1pt\relax}%
+    \setlength{\pc@dimd}{\dimexpr \pc@annb@y@two bp\relax}%
+    \setcounter{pc@annot@lines}{0}%
+    \setlength{\pc@dime}{\pc@dimc}%
+    \addtolength{\pc@dime}{-\pc@dimd}%
+    % count lines
+    \whiledo{\lengthtest{\pc@dime>0pt}}%
+    {%
+      \stepcounter{pc@annot@lines}%
+      \addtolength{\pc@dime}{-\the\baselineskip}%
+    }%
+    % subtract first and last line
+    \addtocounter{pc@annot@lines}{-2}%
+    \renewcommand{\pc@annb@x@one}{\pc@x@left@text}%
+    \renewcommand{\pc@annb@x@three}{\pc@x@left@text}%
+    \renewcommand{\pc@annb@x@two}{\pc@x@right@text}%
+    \renewcommand{\pc@annb@x@four}{\pc@x@right@text}%
+    \ifpc@annot@secondpage%
+      \ifthenelse{\equal{\pc@lopt@markup}{StrikeOut}}%
+      {%
+        \edef\pc@annb@y@one{\pc@pttobp{\dimexpr \pc@annb@y@one bp - \the\baselineskip + 1.5pt\relax}}%
+        \edef\pc@annb@y@three{\pc@pttobp{\dimexpr \pc@annb@y@one bp - \pc@box@depth - \pc@box@height -0.5pt \relax}}%
+      }%
+      {%
+      \edef\pc@annb@y@one{\pc@pttobp{\dimexpr \pc@annb@y@one bp - \the\baselineskip + 1pt\relax}}%
+      \edef\pc@annb@y@three{\pc@pttobp{\dimexpr \pc@annb@y@one bp - \pc@box@depth - \pc@box@height -1pt \relax}}%
+      }% 
+    \fi%
+    \whiledo{\value{pc@annot@lines}>0}%
+    {%
+      \addtocounter{pc@annot@lines}{-1}%
+      \edef\pc@annb@y@one{\pc@pttobp{\dimexpr \pc@annb@y@one bp - \the\baselineskip \relax}}%
+      \edef\pc@annb@y@three{\pc@pttobp{\dimexpr \pc@annb@y@three bp - \the\baselineskip \relax}}%
+      \xdef\pc@annot@quadpoints{\pc@annb@x@one\space\pc@annb@y@one\space\pc@annb@x@two\space\pc@annb@y@one\space\pc@annb@x@three\space\pc@annb@y@three\space\pc@annb@x@four\space\pc@annb@y@three}%
+      \ifpdf%
+        \pc@annot@markup@pdf%
+      \else%
+        \ifpc@gopt@dvipdfmx%
+          \pc@annot@markup@dvipdfmx%
+        \else%
+          \pc@annot@markup@dvips%
+        \fi%
+      \fi%
+    }%      
+  }%
+  \fi%
+}%
+%
+\newcommand{\pc@calc@textblockpos}%
+{%
+  \if@twoside%
+    \ifodd\thepage%
+      \renewcommand{\pc@x@left@text}{\pc@pttobp{\dimexpr \dimexpr 1in\relax + \hoffset + \oddsidemargin\relax}}%
+      \renewcommand{\pc@x@right@text}{\pc@pttobp{\dimexpr \dimexpr 1in\relax + \hoffset + \oddsidemargin + \textwidth\relax}}%
+    \else%
+      \renewcommand{\pc@x@left@text}{\pc@pttobp{\dimexpr \dimexpr 1in\relax + \hoffset + \evensidemargin \relax}}%
+      \renewcommand{\pc@x@right@text}{\pc@pttobp{\dimexpr \dimexpr 1in\relax + \hoffset + \evensidemargin + \textwidth\relax}}%  
+    \fi%
+  \else%
+    \renewcommand{\pc@x@left@text}{\pc@pttobp{\dimexpr \dimexpr 1in\relax + \hoffset + \oddsidemargin \relax}}%
+    \renewcommand{\pc@x@right@text}{\pc@pttobp{\dimexpr \dimexpr 1in\relax + \hoffset + \oddsidemargin + \textwidth\relax}}%
+  \fi%
+  \renewcommand{\pc@y@top@text}{\pc@pttobp{\dimexpr \paperheight - \dimexpr 1in\relax - \voffset - \topmargin - \headheight - \headsep\relax}}%
+  \renewcommand{\pc@y@bottom@text}{\pc@pttobp{\dimexpr \paperheight - \dimexpr 1in\relax - \voffset - \topmargin - \headheight - \headsep - \textheight\relax}}%
+}%
+%
+%
 \endinput%
\ No newline at end of file
-- 
cgit v1.2.3

