summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/pdfmarginpar/pdfmarginpar.tex
blob: d386db784751cc825d176aea27bcad8efb372fcb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
\documentclass[a4paper]{ltxdoc}

\usepackage{ifpdf}
\ifpdf
	\usepackage[pdftex]{hyperref}
\else
	\usepackage[dvipdfm]{hyperref}
\fi
\hypersetup{pdfborder={0 0 0}}

\def\choicesep{$\vert$}%
\def\choicearg#1{\texttt{#1}}


\usepackage{textcomp}

\usepackage{calc}
\usepackage[formats]{listings}
%\usepackage{courier} % don't use it - the '^' character can't be copy-pasted in courier

%--------------------------------------------------
% \usepackage{array}
%-------------------------------------------------- 
\lstset{%
%	basicstyle=\ttfamily,
%	language=[LaTeX]tex, % Seems as if \lstset{language=tex} must be invoked BEFORE loading tikz!?
	tabsize=4,
%	breaklines=true,
	breakindent=0pt
	backgroundcolor=\color{codebackground},
	columns=fullflexible,
	emph={\pdfmarginpar},emphstyle={\color{yellow}},
	basicstyle=\normalfont\ttfamily\footnotesize\frenchspacing,
	language=,
}

\ifpdf
	\pdfinfo {
		/Author	(Christian Feuersaenger)
	}
\fi

\usepackage{tikz}

\usepackage[a4paper,left=2.25cm,right=2.25cm,top=2.5cm,bottom=2.5cm,nohead]{geometry}
\usepackage{amsmath,amssymb}
\usepackage{xxcolor}
\usepackage{pifont}
\usepackage{makeidx}
\usepackage[latin1]{inputenc}
\usepackage{amsmath}
\usepackage{eurosym}

\input pgfplots-macros.tex

\pgfqkeys{/codeexample}{%
	every codeexample/.style={
		width=8cm,
	},
	tabsize=4,
}

\usetikzlibrary{backgrounds,patterns}
% Global styles:
\tikzset{
  shape example/.style={
    color=black!30,
    draw,
    fill=yellow!30,
    line width=.5cm,
    inner xsep=2.5cm,
    inner ysep=0.5cm}
}

\newcommand{\FIXME}[1]{\textcolor{red}{(FIXME: #1)}}

% fuer endvironment 'sidewaysfigure' bspw
% \usepackage{rotating}

\newcommand\PDFMRG{\textsc{pdfmarginpar}}


\makeindex

% Fix overful hboxes automatically:
\tolerance=2000
\emergencystretch=10pt

\usepackage{pdfmarginpar}

\author{%
	Christian Feuers\"anger\footnote{\url{http://wissrech.ins.uni-bonn.de/people/feuersaenger}}\\%
	Institut f\"ur Numerische Simulation\\
	Universit\"at Bonn, Germany}

\title{
	Manual for Package \PDFMRG\\
	{\small Version 0.8}}

\begin{document}
\maketitle
\begin{abstract}%
\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]{As they are provided by the viewer application} 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.
\end{abstract}
\tableofcontents
\section{Introduction}
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.

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.

\paragraph{Hint:} View this document in Adobe Reader as it contains several annotations.

\section{Installation and Requirements}
The package is very small. 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.

Simply copy |pdfmarginpar.sty| somewhere into your \TeX\ search path (or the article's directory).

\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.

\section{Usage}
Simply write
\begin{codeexample}[code only]
\usepackage{pdfmarginpar}
\end{codeexample}
\noindent into your preable. Then, write |\pdfmarginpar|\marg{Annotation Contents} into your |.tex| file whereever you want annotations and translate the document with |pdflatex|.

\begin{command}{\pdfmarginpar\oarg{Options}\marg{Annotation Contents}}
	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.

\lstinputlisting[
	backgroundcolor=\color{codebackground},
	columns=fullflexible,
	emph={\pdfmarginpar},emphstyle={\color{yellow}},
	basicstyle=\normalfont\ttfamily\footnotesize\frenchspacing,
	language=,
]{pdfmarginparexample.tex}

\colorbox{graphicbackground}{\includegraphics[width=12cm]{pdfmarginparexample}}
\end{command}

\subsection{Configuration options}
It is possible to customize annotation appearance either per annotation or once for all annotations.

All options have a key prefix, |/pdfmarginpar/|. This prefix is optional (it has technical relevance when used with |\pgfkeys|) and can be ignored.

\begin{command}{\pdfmarginparset\marg{Options}}
	This command can be used to set options for all annotations (for example, in the document's preamble). 
\begin{codeexample}[]
\pdfmarginparset{Open=true,color={[0.5 0.5 0.5]}}

This is an example already opened annotations with gray color
\pdfmarginpar{This is an example already opened annotations with gray color.}.
\end{codeexample}
	
	It is \emph{not} necessary to prefix every option with |/pdfmarginpar/|, see above.
\end{command}


\begin{key}{/pdfmarginpar/Name=\mchoice{Comment,Key,Note,Help,NewParagraph,Paragraph,Insert} (initially Comment)}
	Allows to choose a different type of annotation.
\begin{codeexample}[] 
Comment Annotation\pdfmarginpar[Comment]{Comment}\end{codeexample}
\begin{codeexample}[] 
Key Annotation\pdfmarginpar[Key]{Key}\end{codeexample}
\begin{codeexample}[]
Note Annotation\pdfmarginpar[Note]{Note}\end{codeexample}
\begin{codeexample}[]
Help Annotation\pdfmarginpar[Help]{Help}\end{codeexample}
\begin{codeexample}[]
NewParagraph 
Annotation\pdfmarginpar[NewParagraph]{NewParagraph}\end{codeexample}
\begin{codeexample}[]
Paragraph
Annotation\pdfmarginpar[Paragraph]{Paragraph}\end{codeexample}
\begin{codeexample}[]
Insert Annotation\pdfmarginpar[Insert]{Insert}\end{codeexample}

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.
\end{key}

\begin{key}{/pdfmarginpar/Open=\mchoice{true,false} (initially false)}
	Defines whether annotation popups shall be opened at start-up.
\end{key}

\begin{keylist}{
	/pdfmarginpar/C=\oarg{\meta{R} \meta{G} \meta{B}} (initially [1 0 0]),
	/pdfmarginpar/color=\oarg{\meta{R} \meta{G} \meta{B}} (initially [1 0 0])}
	Defines the annotation's color with \meta{R},\meta{G},\meta{B}$ \in [0,1]$.
\end{keylist}

\begin{keylist}{
	/pdfmarginpar/CA=\marg{opacity} (initially 0.5),
	/pdfmarginpar/opacity=\marg{opacity} (initially 0.5)}
	Sets the annotation's opacity as a number between $1$ (not transparent) and $0$ (transparent).
\end{keylist}

\begin{keylist}{
	/pdfmarginpar/Subj=\marg{Subject} (initally Comment),
	/pdfmarginpar/Subject=\marg{Subject} (initally Comment)}
	Sets the annotations title line.
\end{keylist}

\begin{key}{/pdfmarginpar/voffset=\marg{dimension}}
	Specifies a vertical shift for the annotation. This parameter is set automatically if |Comment| instead of |Name=Comment| is specified.
\end{key}
\begin{key}{/pdfmarginpar/hoffset=\marg{dimension}}
	Specifies a horizontal shift for the annotation. This parameter is set automatically if |Comment| instead of |Name=Comment| is specified.
\end{key}

\begin{key}{/pdfmarginpar/Subtype=\marg{Type} (initially Text)}
	This option is here for future developments. I intended only |Text| (although it should be possible to use any other supported |Subtype| as found in the pdf reference).
\end{key}

\subsection{Implementation note}
All these variables boil down to the |pdflatex| primitive

\noindent
|\pdfannot { |

	|/Subtype /|\meta{the Subtype} |/Open [|\mchoice{true,false}|]|

	|/Name /|\meta{the Type's Name}

	|/C |\meta{color} |/CA |\meta{the opacity}

	|/Subj (|\meta{the Subject}|)| |/Contents (|\meta{the Annotation's contents}|) }|

\noindent
which results in a \pdf-object together with |/Rect [* * * *]| and |/Type /Annot|.

\end{document}