2
%% PDF Text Annotations to handle comments/remarks
4
%% This code has been based on the following sources, where other variants can be
7
%% * http://www.tug.org/pipermail/pdftex/2002-December/003330.html
8
%% * http://www.ce.cmu.edu/~kijoo/latex2pdf.pdf
11
%% See also the Adobe PDF Reference directly for the syntax of the Annotation object:
13
%% * http://partners.adobe.com/public/developer/en/pdf/PDFReference16.pdf
14
%% (section 8.4 Annotations)
16
%% Example of use: \comment[width=5cm,symbol=Balloon,title={Note}]{...}
18
\NeedsTeXFormat{LaTeX2e}
19
\ProvidesPackage{dbk_annot}[2006/11/19 v0.1 PDF Text Annotations]
21
\@ifundefined{define@key}{\RequirePackage{keyval}}{}%
24
%% Default text annotation parameter values
25
\let\defaultPDFlocation\empty%
26
\let\defaultPDFopen\empty
27
\let\defaultPDFtitle\empty
28
\let\defaultPDFheight\baselineskip
29
\def\defaultPDFwidth{10cm}
30
\def\defaultPDFdepth{0cm}
34
\let\PDFlocation\defaultPDFlocation%
35
\let\PDFtitle\defaultPDFtitle%
36
\let\PDFopen\defaultPDFopen%
37
\let\PDFwidth\defaultPDFwidth%
38
\let\PDFheight\defaultPDFheight%
39
\let\PDFdepth\defaultPDFdepth%
42
%% Set values from key values
43
\def\commentsetsymbol#1{%
44
\expandafter\ifx\csname PDFsymbol#1\endcsname\relax%
45
\else\def\PDFsymbol{/Name \csname PDFsymbol#1\endcsname}\fi}
47
\define@key{comment}{symbol}{\commentsetsymbol{#1}}
48
\define@key{comment}{width}{\def\PDFwidth{#1}}
49
\define@key{comment}{height}{\def\PDFheight{#1}}
50
\define@key{comment}{depth}{\def\PDFdepth{#1}}
51
\define@key{comment}{title}{\def\PDFtitle{/T (#1)}}
52
\define@key{comment}{location}{\def\PDFlocation{#1}}
53
\define@key{comment}{open}[true]{%
54
\ifthenelse{\equal{#1}{true}}%
55
{\def\PDFopen{/Open true}}%
59
%% Actions to do for default setting
60
\define@key{defcomment}{width}{\def\defaultPDFwidth{#1}}
61
\define@key{defcomment}{height}{\def\defaultPDFheight{#1}}
62
\define@key{defcomment}{depth}{\def\defaultPDFdepth{#1}}
63
\define@key{defcomment}{title}{\def\defaultPDFtitle{/T (#1)}}
64
\define@key{defcomment}{location}{\def\defaultPDFlocation{#1}}
65
\define@key{defcomment}{open}[true]{%
66
\ifthenelse{\equal{#1}{true}}%
67
{\def\defaultPDFopen{/Open true}}%
68
{\let\defaultPDFopen\empty}%
71
%% Text annotation symbols
72
\def\PDFsymbolBalloon {/Comment}
73
\def\PDFsymbolHelp {/Help}
74
\def\PDFsymbolNew {/Insert}
75
\def\PDFsymbolKey {/Key }
76
\def\PDFsymbolAddition {/NewParagraph}
77
\def\PDFsymbolNote {/Note}
78
\def\PDFsymbolParagraph {/Paragraph}
80
%% Global comment setup
81
\def\commentsetup#1{\setkeys{defcomment}{#1}}
83
%% Insert a remark/comment as a text annotation
84
\def\comment{\@ifnextchar[\docomment{\docomment[]}}
86
\def\docomment[#1]#2{%
89
\setkeys{comment}{#1}%
90
\ifthenelse{\equal{\PDFlocation}{margin}}%
91
{\marginpar{\dodocomment{#2}}}%
97
\pdfstringdef\@tempa{#1}%
98
\pdfannot width \PDFwidth height \PDFheight depth \PDFdepth{%
108
%% Apply only when using pdflatex
109
\RequirePackage{ifpdf}
112
\def\docomment[#1]#2{}