Debian Codegraph @

texmf-dist/doc/latex/pdfmarginpar/pdfmarginpar.tex

raw
1 \documentclass[a4paper]{ltxdoc}
2
3 \usepackage{ifpdf}
4 \ifpdf
5 \usepackage[pdftex]{hyperref}
6 \else
7 \usepackage[dvipdfm]{hyperref}
8 \fi
9 \hypersetup{pdfborder={0 0 0}}
10
11 \def\choicesep{$\vert$}%
12 \def\choicearg#1{\texttt{#1}}
13
14
15 \usepackage{textcomp}
16
17 \usepackage{calc}
18 \usepackage[formats]{listings}
19 %\usepackage{courier} % don't use it - the '^' character can't be copy-pasted in courier
20
21 %--------------------------------------------------
22 % \usepackage{array}
23 %--------------------------------------------------
24 \lstset{%
25 % basicstyle=\ttfamily,
26 % language=[LaTeX]tex, % Seems as if \lstset{language=tex} must be invoked BEFORE loading tikz!?
27 tabsize=4,
28 % breaklines=true,
29 breakindent=0pt
30 backgroundcolor=\color{codebackground},
31 columns=fullflexible,
32 emph={\pdfmarginpar},emphstyle={\color{yellow}},
33 basicstyle=\normalfont\ttfamily\footnotesize\frenchspacing,
34 language=,
35 }
36
37 \ifpdf
38 \pdfinfo {
39 /Author (Christian Feuersaenger)
40 }
41 \fi
42
43 \usepackage{tikz}
44
45 \usepackage[a4paper,left=2.25cm,right=2.25cm,top=2.5cm,bottom=2.5cm,nohead]{geometry}
46 \usepackage{amsmath,amssymb}
47 \usepackage{xxcolor}
48 \usepackage{pifont}
49 \usepackage{makeidx}
50 \usepackage[latin1]{inputenc}
51 \usepackage{amsmath}
52 \usepackage{eurosym}
53
54 \input pgfplots-macros.tex
55
56 \pgfqkeys{/codeexample}{%
57 every codeexample/.style={
58 width=8cm,
59 },
60 tabsize=4,
61 }
62
63 \usetikzlibrary{backgrounds,patterns}
64 % Global styles:
65 \tikzset{
66 shape example/.style={
67 color=black!30,
68 draw,
69 fill=yellow!30,
70 line width=.5cm,
71 inner xsep=2.5cm,
72 inner ysep=0.5cm}
73 }
74
75 \newcommand{\FIXME}[1]{\textcolor{red}{(FIXME: #1)}}
76
77 % fuer endvironment 'sidewaysfigure' bspw
78 % \usepackage{rotating}
79
80 \newcommand\PDFMRG{\textsc{pdfmarginpar}}
81
82
83 \makeindex
84
85 % Fix overful hboxes automatically:
86 \tolerance=2000
87 \emergencystretch=10pt
88
89 \usepackage{pdfmarginpar}
90
91 \author{%
92 Christian Feuers\"anger\footnote{\url{http://wissrech.ins.uni-bonn.de/people/feuersaenger}}\\%
93 Institut f\"ur Numerische Simulation\\
94 Universit\"at Bonn, Germany}
95
96 \title{
97 Manual for Package \PDFMRG\\
98 {\small Version 0.92}}
99
100 \begin{document}
101 \maketitle
102 \begin{abstract}%
103 \PDFMRG\ provides the |\pdfmarginpar| command which is similar in spirit to |\marginpar|. However, it creates \pdf-annotations which can be viewed with Adobe Reader instead of normal text margins: small icons\pdfmarginpar[Comment]{The viewer application supplies the small icons} indicate the in-text position where the message originates, popups provide detailed messages. The advantage over |\marginpar| is that bugfixes and communication is clearly visible together with its text source and the document as such is not obscured.
104 \end{abstract}
105 \tableofcontents
106 \section{Introduction}
107 This package provides a debugging tool which is more comfortable and powerful than |\marginpar|. It employs \pdf\ annotations\pdfmarginpar[Note]{These annotations are a PDF Feature, together with their appearance options.} as they can be generated with the commercial Adobe Acrobat program, making them clearly visible and as detailed as needed while still avoiding obscured documents or problems with small margins.
108
109 The package is also useful as communication device for articles written by multiple authors. Often, one would like to use Adobe Reader to insert, edit and write pdf annotations as this does not require to exchange all \TeX-sources. There has been a lot of discussion of this problem recently in web forums. As far as I know, the result was always the same: create the \pdf\ document with the commercial Adobe Acrobat, then (and only then) is it possible to insert, edit and save \pdf\ annotations. This package is a light-weight free tool to create \emph{read-only} annotations which can be viewed with Adobe Reader. Despite this limitations of Acrobat Reader I guess it is still useful for interactions between multiple authors because it's not so difficult\footnote{I admit, version control still requires attention.} to exchange |.tex| files along with the |.pdf| files.
110
111 \paragraph{Hint:} View this document in Adobe Reader as it contains several annotations.
112
113 \paragraph{Hint:} Josef Kleber has incorporated ideas of this package into his newer package |pdfcomment|. As long as the Acrobat Reader can't edit \TeX\ annotations, I won't continue development on |pdfmarginpar|.
114
115 \section{Installation and Requirements}
116 The package is very small. It requires \pgfname\ 2.0 installed. In fact, it is nothing but a light-weight command which invokes the |pdflatex| primitive |\pdfannot| with a high-level user interface which encapsulates all supported \pdf\ annotation parameters with key-value options.
117
118 Simply copy |pdfmarginpar.sty| somewhere into your \TeX\ search path (or the article's directory).
119
120 \paragraph{Requirements:} The package relies on |pdflatex| primitives, so it is necessary to translate the document with |pdflatex| (|dvips| or |dvipdfm| combinations are \emph{not} supported yet). As far as I know, only Adobe Reader views annotations properly.
121
122 \section{Usage}
123 Simply write
124 \begin{codeexample}[code only]
125 \usepackage{pdfmarginpar}
126 \end{codeexample}
127 \noindent into your preable. Then, write |\pdfmarginpar|\marg{Annotation Contents} into your |.tex| file whereever you want annotations and translate the document with |pdflatex|.
128
129 \begin{command}{\pdfmarginpar\oarg{Options}\marg{Annotation Contents}}
130 This command creates a text annotation with \marg{Annotation Contents}. A small mark will be placed just where the command occurs and a popup window appears after clicking on it.
131
132 \lstinputlisting[
133 backgroundcolor=\color{codebackground},
134 columns=fullflexible,
135 emph={\pdfmarginpar},emphstyle={\color{yellow}},
136 basicstyle=\normalfont\ttfamily\footnotesize\frenchspacing,
137 language=,
138 ]{pdfmarginparexample.tex}
139
140 \colorbox{graphicbackground}{\includegraphics[width=12cm]{pdfmarginparexample}}
141 \end{command}
142
143 \subsection{Configuration options}
144 It is possible to customize annotation appearance either per annotation or once for all annotations.
145
146 All options have a key prefix, |/pdfmarginpar/|. This prefix is optional (it has technical relevance when used with |\pgfkeys|) and can be ignored.
147
148 \begin{command}{\pdfmarginparset\marg{Options}}
149 This command can be used to set options for all annotations (for example, in the document's preamble).
150 \begin{codeexample}[]
151 \pdfmarginparset{Open=true,color={[0.5 0.5 0.5]}}
152
153 This is an example of already opened annotations with gray color
154 \pdfmarginpar{This is an example of already opened annotations with gray color.}.
155 \end{codeexample}
156
157 It is \emph{not} necessary to prefix every option with |/pdfmarginpar/|, see above.
158 \end{command}
159
160
161 \begin{key}{/pdfmarginpar/Name=\mchoice{Comment,Key,Note,Help,NewParagraph,Paragraph,Insert,none} (initially Comment)}
162 Allows to choose a different type of annotation.
163 \begin{codeexample}[]
164 Comment Annotation\pdfmarginpar[Comment]{Comment}\end{codeexample}
165 \begin{codeexample}[]
166 Key Annotation\pdfmarginpar[Key]{Key}\end{codeexample}
167 \begin{codeexample}[]
168 Note Annotation\pdfmarginpar[Note]{Note}\end{codeexample}
169 \begin{codeexample}[]
170 Help Annotation\pdfmarginpar[Help]{Help}\end{codeexample}
171 \begin{codeexample}[]
172 NewParagraph
173 Annotation\pdfmarginpar[NewParagraph]{NewParagraph}\end{codeexample}
174 \begin{codeexample}[]
175 Paragraph
176 Annotation\pdfmarginpar[Paragraph]{Paragraph}\end{codeexample}
177 \begin{codeexample}[]
178 Insert Annotation\pdfmarginpar[Insert]{Insert}\end{codeexample}
179
180 If |Name=| is omitted, the annotation is chosen directly -- and some more style options take place. For example, the |Comment| annotation will be raised somewhat and the |Insert| Annotation will be moved somewhat. Using |Name=Comment| will just select the |Comment| annotation without any further modifications.
181
182 Use the |none| value to disable this variable in the |.pdf|. This may be necessary for types different than Sticky Notes.
183 \end{key}
184
185 \begin{key}{/pdfmarginpar/Open=\mchoice{true,false} (initially true)}
186 Defines whether annotation popups shall be opened at start-up.
187
188 \paragraph{Attention:} Only opened popups will be printed!
189 \end{key}
190
191 \begin{keylist}{
192 /pdfmarginpar/C=\oarg{\meta{R} \meta{G} \meta{B}} (initially [1 1 0]),
193 /pdfmarginpar/color=\oarg{\meta{R} \meta{G} \meta{B}} (initially [1 1 0])}
194 Defines the annotation's color with \meta{R},\meta{G},\meta{B}$ \in [0,1]$.
195 \end{keylist}
196
197 \begin{keylist}{
198 /pdfmarginpar/CA=\marg{opacity} (initially 0.5),
199 /pdfmarginpar/opacity=\marg{opacity} (initially 0.5)}
200 Sets the annotation's opacity as a number between $1$ (not transparent) and $0$ (transparent).
201 \end{keylist}
202
203 \begin{keylist}{
204 /pdfmarginpar/Subj=\marg{Subject} (initally Comment),
205 /pdfmarginpar/Subject=\marg{Subject} (initally Comment)}
206 Sets the annotations title line.
207 \end{keylist}
208
209 \begin{key}{/pdfmarginpar/voffset=\marg{dimension}}
210 Specifies a vertical shift for the annotation. This parameter is set automatically if |Comment| instead of |Name=Comment| is specified.
211 \end{key}
212 \begin{key}{/pdfmarginpar/hoffset=\marg{dimension}}
213 Specifies a horizontal shift for the annotation. This parameter is set automatically if |Comment| instead of |Name=Comment| is specified.
214 \end{key}
215
216 \begin{key}{/pdfmarginpar/Subtype=\marg{Type} (initially Text)}
217 Currently, only |Text| is accepted.
218
219 Use
220
221 |\pdfmarginpar[Subtype/Other=|\meta{pdf name}|]|\marg{$\dotsc$}
222
223 to supply unsupported sub types.\pdfmarginpar[Name=none,Subtype=FreeText]{ZEUG!}
224 \end{key}
225
226 \begin{key}{/pdfmarginpar/caption=\marg{text caption} (initially Author's Note)}
227 Sets a caption.
228 \end{key}
229
230 \begin{key}{/pdfmarginpar/width=\marg{dimen} (initially empty)}
231 Defines a width for an annotation. This is not necessary for sticky notes.
232 \begin{codeexample}[width=2cm]
233 \pdfmarginpar[Subtype=FreeText,width=4cm,height=0.5cm]
234 {A free text.}
235 \end{codeexample}
236 Please note that the |\pdfmarginpar| won't occupy any space in the final document -- |width| refers only to the appearance of the annotation.
237
238 Use can use |hoffset| and |voffset| to move the annotation around (relative to the occurance of |\pdfmarginpar| in the document). However, it may be better to use the |textpos| package for absolute positioning on the page.
239 \begin{codeexample}[width=2cm]
240 \pdfmarginpar[Subtype=FreeText,width=4cm,height=2cm,hoffset=9cm,voffset=-5cm]
241 {A free text, shifted relatively to the occurance of pdfmarginpar.}
242 Here comes the marginpar!
243 \end{codeexample}
244 \end{key}
245
246 \begin{key}{/pdfmarginpar/height=\marg{dimen} (initially empty)}
247 Defines a height for an annotation. See |width|.
248 \end{key}
249 \begin{key}{/pdfmarginpar/depth=\marg{dimen} (initially empty)}
250 Defines a depth for an annotation. See |width|.
251 \end{key}
252
253
254 \subsection{Printing Popups and Comments}
255 Adobe Reader \emph{can} print both free texts and popups. The feature can be accesses using ``File $\gg$ Print: Comments and Forms = Document and Markups''.
256
257 To print popups, you need to configure Adobe Reader using ``Edit $\gg$ Preferences $\gg$ Commenting'' where the corresponding option needs to be set. Unfortunately, this option does not exist in many reader versions.
258
259 If it does not exist, the only possibility to activate it is to patch the configuration of Adobe Reader.
260
261 \begin{description}
262 \item[For Windows,]
263 the registry need to be changed. Please note that this is at your own risk.
264
265 For Reader 6 or 7, open the registry editor and browse to the following key:
266
267 |HKEY_CURRENT_USER\Software\ADOBE\Acrobat Reader\6.0| (or |7.0| or |8.0|)|\Annots\cPrefs|
268
269 Double click the |bprintCommentPopups| key and change the value to |1|.
270
271 For Adobe Reader 8, the same key needs to be changed to
272
273 |HKEY_CURRENT_USER\Software\Adobe\Acrobat Reader\8.0\Annots\cPrefs|
274
275 |"bprintCommentPopups"=dword:00000001|.
276 \item[For Linux,]
277 edit
278
279 |~/.adobe/Acrobat/8.0/Preferences/reader_prefs|
280
281 with a text editor and change |/printCommentPopups [/b false]| to |/printCommentPopups [/b true]|.
282 \end{description}
283 Please note that only opened popups will be printed.
284
285 \subsection{Implementation note}
286 All these variables boil down to the |pdflatex| primitive
287
288 \noindent
289 |\pdfannot { |
290
291 |/Subtype /|\meta{the Subtype} |/Open [|\mchoice{true,false}|]|
292
293 |/Name /|\meta{the Type's Name}
294
295 |/C |\meta{color} |/CA |\meta{the opacity}
296
297 |/Subj (|\meta{the Subject}|)| |/Contents (|\meta{the Annotation's contents}|) }|
298
299 \noindent
300 which results in a \pdf-object together with |/Rect [* * * *]| and |/Type /Annot|.
301
302 \end{document}