|
Packit Service |
76cb02 |
%%
|
|
Packit Service |
76cb02 |
%% PDF Text Annotations to handle comments/remarks
|
|
Packit Service |
76cb02 |
%%
|
|
Packit Service |
76cb02 |
%% This code has been based on the following sources, where other variants can be
|
|
Packit Service |
76cb02 |
%% found too:
|
|
Packit Service |
76cb02 |
%%
|
|
Packit Service |
76cb02 |
%% * http://www.tug.org/pipermail/pdftex/2002-December/003330.html
|
|
Packit Service |
76cb02 |
%% * http://www.ce.cmu.edu/~kijoo/latex2pdf.pdf
|
|
Packit Service |
76cb02 |
%% * ConTeXt
|
|
Packit Service |
76cb02 |
%%
|
|
Packit Service |
76cb02 |
%% See also the Adobe PDF Reference directly for the syntax of the Annotation object:
|
|
Packit Service |
76cb02 |
%%
|
|
Packit Service |
76cb02 |
%% * http://partners.adobe.com/public/developer/en/pdf/PDFReference16.pdf
|
|
Packit Service |
76cb02 |
%% (section 8.4 Annotations)
|
|
Packit Service |
76cb02 |
%%
|
|
Packit Service |
76cb02 |
%% Example of use: \comment[width=5cm,symbol=Balloon,title={Note}]{...}
|
|
Packit Service |
76cb02 |
%%
|
|
Packit Service |
76cb02 |
\NeedsTeXFormat{LaTeX2e}
|
|
Packit Service |
76cb02 |
\ProvidesPackage{dbk_annot}[2006/11/19 v0.1 PDF Text Annotations]
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
\@ifundefined{define@key}{\RequirePackage{keyval}}{}%
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
%% Default text annotation parameter values
|
|
Packit Service |
76cb02 |
\let\defaultPDFlocation\empty%
|
|
Packit Service |
76cb02 |
\let\defaultPDFopen\empty
|
|
Packit Service |
76cb02 |
\let\defaultPDFtitle\empty
|
|
Packit Service |
76cb02 |
\let\defaultPDFheight\baselineskip
|
|
Packit Service |
76cb02 |
\def\defaultPDFwidth{10cm}
|
|
Packit Service |
76cb02 |
\def\defaultPDFdepth{0cm}
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
\def\commentdefault{%
|
|
Packit Service |
76cb02 |
\let\PDFsymbol\empty%
|
|
Packit Service |
76cb02 |
\let\PDFlocation\defaultPDFlocation%
|
|
Packit Service |
76cb02 |
\let\PDFtitle\defaultPDFtitle%
|
|
Packit Service |
76cb02 |
\let\PDFopen\defaultPDFopen%
|
|
Packit Service |
76cb02 |
\let\PDFwidth\defaultPDFwidth%
|
|
Packit Service |
76cb02 |
\let\PDFheight\defaultPDFheight%
|
|
Packit Service |
76cb02 |
\let\PDFdepth\defaultPDFdepth%
|
|
Packit Service |
76cb02 |
}
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
%% Set values from key values
|
|
Packit Service |
76cb02 |
\def\commentsetsymbol#1{%
|
|
Packit Service |
76cb02 |
\expandafter\ifx\csname PDFsymbol#1\endcsname\relax%
|
|
Packit Service |
76cb02 |
\else\def\PDFsymbol{/Name \csname PDFsymbol#1\endcsname}\fi}
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
\define@key{comment}{symbol}{\commentsetsymbol{#1}}
|
|
Packit Service |
76cb02 |
\define@key{comment}{width}{\def\PDFwidth{#1}}
|
|
Packit Service |
76cb02 |
\define@key{comment}{height}{\def\PDFheight{#1}}
|
|
Packit Service |
76cb02 |
\define@key{comment}{depth}{\def\PDFdepth{#1}}
|
|
Packit Service |
76cb02 |
\define@key{comment}{title}{\def\PDFtitle{/T (#1)}}
|
|
Packit Service |
76cb02 |
\define@key{comment}{location}{\def\PDFlocation{#1}}
|
|
Packit Service |
76cb02 |
\define@key{comment}{open}[true]{%
|
|
Packit Service |
76cb02 |
\ifthenelse{\equal{#1}{true}}%
|
|
Packit Service |
76cb02 |
{\def\PDFopen{/Open true}}%
|
|
Packit Service |
76cb02 |
{\let\PDFopen\empty}%
|
|
Packit Service |
76cb02 |
}
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
%% Actions to do for default setting
|
|
Packit Service |
76cb02 |
\define@key{defcomment}{width}{\def\defaultPDFwidth{#1}}
|
|
Packit Service |
76cb02 |
\define@key{defcomment}{height}{\def\defaultPDFheight{#1}}
|
|
Packit Service |
76cb02 |
\define@key{defcomment}{depth}{\def\defaultPDFdepth{#1}}
|
|
Packit Service |
76cb02 |
\define@key{defcomment}{title}{\def\defaultPDFtitle{/T (#1)}}
|
|
Packit Service |
76cb02 |
\define@key{defcomment}{location}{\def\defaultPDFlocation{#1}}
|
|
Packit Service |
76cb02 |
\define@key{defcomment}{open}[true]{%
|
|
Packit Service |
76cb02 |
\ifthenelse{\equal{#1}{true}}%
|
|
Packit Service |
76cb02 |
{\def\defaultPDFopen{/Open true}}%
|
|
Packit Service |
76cb02 |
{\let\defaultPDFopen\empty}%
|
|
Packit Service |
76cb02 |
}
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
%% Text annotation symbols
|
|
Packit Service |
76cb02 |
\def\PDFsymbolBalloon {/Comment}
|
|
Packit Service |
76cb02 |
\def\PDFsymbolHelp {/Help}
|
|
Packit Service |
76cb02 |
\def\PDFsymbolNew {/Insert}
|
|
Packit Service |
76cb02 |
\def\PDFsymbolKey {/Key }
|
|
Packit Service |
76cb02 |
\def\PDFsymbolAddition {/NewParagraph}
|
|
Packit Service |
76cb02 |
\def\PDFsymbolNote {/Note}
|
|
Packit Service |
76cb02 |
\def\PDFsymbolParagraph {/Paragraph}
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
%% Global comment setup
|
|
Packit Service |
76cb02 |
\def\commentsetup#1{\setkeys{defcomment}{#1}}
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
%% Insert a remark/comment as a text annotation
|
|
Packit Service |
76cb02 |
\def\comment{\@ifnextchar[\docomment{\docomment[]}}
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
\def\docomment[#1]#2{%
|
|
Packit Service |
76cb02 |
\begingroup%
|
|
Packit Service |
76cb02 |
\commentdefault%
|
|
Packit Service |
76cb02 |
\setkeys{comment}{#1}%
|
|
Packit Service |
76cb02 |
\ifthenelse{\equal{\PDFlocation}{margin}}%
|
|
Packit Service |
76cb02 |
{\marginpar{\dodocomment{#2}}}%
|
|
Packit Service |
76cb02 |
{\dodocomment{#2}}%
|
|
Packit Service |
76cb02 |
\endgroup%
|
|
Packit Service |
76cb02 |
}
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
\def\dodocomment#1{%
|
|
Packit Service |
76cb02 |
\pdfstringdef\@tempa{#1}%
|
|
Packit Service |
76cb02 |
\pdfannot width \PDFwidth height \PDFheight depth \PDFdepth{%
|
|
Packit Service |
76cb02 |
/Subtype /Text
|
|
Packit Service |
76cb02 |
/Contents (\@tempa)
|
|
Packit Service |
76cb02 |
\PDFtitle
|
|
Packit Service |
76cb02 |
\PDFopen
|
|
Packit Service |
76cb02 |
\PDFsymbol
|
|
Packit Service |
76cb02 |
}%
|
|
Packit Service |
76cb02 |
\let\@tempa\relax%
|
|
Packit Service |
76cb02 |
}
|
|
Packit Service |
76cb02 |
|
|
Packit Service |
76cb02 |
%% Apply only when using pdflatex
|
|
Packit Service |
76cb02 |
\RequirePackage{ifpdf}
|
|
Packit Service |
76cb02 |
\ifpdf
|
|
Packit Service |
76cb02 |
\else
|
|
Packit Service |
76cb02 |
\def\docomment[#1]#2{}
|
|
Packit Service |
76cb02 |
\fi
|