Debian Codegraph @

texmf-dist/doc/latex/pdfcomment/example_xelatex.tex

raw
1 % This file works with lualatex as well!
2 % Make sure to write the page size into the dvi file!
3 % That's possible with the pagesize option of KoMa-Script
4 % Otherwise the positioning of the annotations will fail!
5 \documentclass[pagesize]{scrartcl}
6 % for other classes use, e.g. the pagesize option
7 % of package typearea
8 %\documentclass{article}
9 %\usepackage[pagesize]{typearea}
10 %
11 \usepackage[no-math]{fontspec}
12 %\usepackage{xunicode}
13 %\usepackage{xltxtra}
14 \usepackage{lipsum}
15 \usepackage[svgnames,rgb]{xcolor}
16 \usepackage{tikz}
17 \usetikzlibrary{calc}
18 \usepackage{amsmath,array,bm}
19 \usepackage[absolute]{textpos}
20 \usepackage[subject={Top1},author={Ånsgar Lund},version=1]{pdfcomment}
21 \setmainfont[Mapping=tex-text]{Tahoma}
22 \begin{document}
23 \defineavatar{Joe}{author=Joe,color=yellow}
24 \defineavatar{Bob}{author=Bob,color=green}
25 \definecolor{myblue}{rgb}{0.045,0.278,0.643}
26 \colorlet{myorange}{red!30!yellow}
27 \pdfcommentsetup{timezone={+01'00'}}
28 A\pdfcomment[subject={Top2},author={Daisy Duck},color={0.234 0.867 0.211},voffset=8pt,opacity=0.5]{This is a comment.} little Test! \pdfcomment[color=myblue,icon=Note,open=true,hspace=100pt]{This is another comment.} test the hspace!%
29 \defineavatar{CaptainJack}{color=myorange,author={Captain Jack}}%
30 \definestyle{MyStar}{icon=Star,opacity=0.7,voffset=12pt}%
31 \pdfcomment[avatar=CaptainJack,style=MyStar,date={}]{It's enough now!}
32 \pdffreetextcomment[avatar=CaptainJack,subject={Top2},height=3cm,type=freetext,width=4.5cm,voffset=-4.8cm,hoffset=-2.7cm,opacity=0.5,justification=right]{This is also a comment, but it's a FreeText annotation! Your, Captain Jack}
33 \pdflinecomment[avatar=CaptainJack,subject={Top2},type=line,opacity=1,line={100 680 250 680},color=green,icolor=blue,caption=top,linebegin={/ROpenArrow},lineend={/OpenArrow},linewidth=2bp,captionhoffset=-5pt,captionvoffset=15pt]{This is a Line comment!}
34 \pdffreetextcomment[avatar=CaptainJack,subject={typewriter},height=1.8cm,width=6.8cm,voffset=-7.2cm,hoffset=-1.2cm,opacity=1.0,justification=right,type=typewriter,font=LucidaConsole,fontsize=14pt,fontcolor=CornflowerBlue]{This is a typewriter FreeText annotation!}
35
36 \marginnote{\begin{textblock*}{1cm}(7cm,14.5cm)
37 \pdffreetextcomment[avatar=CaptainJack,height=1.9cm,width=9cm,opacity=0.5,voffset=0pt,hoffset=0pt,opacity=1.0,font=Georgia,fontsize=9pt,fontcolor=red,justification=left,linewidth=2bp,bse=cloudy,bsei=1.3,type=callout,line={170 515 120 460 200 460},lineend=/ClosedArrow]{This one was placed with absolute coordinates (textpos.sty) (font=Georgia, fontsize=9pt, fontcolor=red, linewidth=2bp, bse=cloudy, bsei=1.3, type=callout, line=\{170 515 120 460 200 460\}, lineend=/ClosedArrow)}
38 \end{textblock*}}
39 {\small
40 \marginnote{\begin{textblock*}{2cm}(6cm,11.9cm){($x_1, y_1$)}\end{textblock*}}
41 \marginnote{\begin{textblock*}{2cm}(3cm,13.3cm){($x_2, y_2$)}\end{textblock*}}
42 \marginnote{\begin{textblock*}{2cm}(5.6cm,13.6cm){($x_3, y_3$)}\end{textblock*}}
43 }
44 \pdfmarkupcomment[author={Donald Duck},color=red,markup=StrikeOut]{A little Test!}{Why is this repeated? This is a StrikeOut markup annotation}
45
46 \colorlet{KernFarbe}{red}
47 \colorlet{HuelleFarbe}{blue}
48 \vspace{35mm}
49 \begin{tikzpicture}[
50 Huelle/.style = {ball color=HuelleFarbe!25},
51 Kern/.style = {ball color=KernFarbe!25},
52 Proton/.style = {ball color=HuelleFarbe!80},
53 Elektron/.style = {ball color=KernFarbe!80},
54 ]
55
56 \shade[Huelle] (8,0) circle (2cm);
57 \shade[Kern] (8,0) circle (.7cm);
58
59 % Elektronen
60 \foreach \cx/\cy in {8/0,8/.3,8/-.3,8.2/.25,8.2/-.25,%
61 8.3/.09,8.3/-.09,7.8/.25,7.8/.-.25,7.7/.09,%
62 7.7/-.09,7.5/.09,8.5/-.09,7.6/-.3,8/-.5,8/.5,8.4/.4}{
63 \shade[Elektron] (\cx,\cy) circle (.6mm);
64 }
65 % Protonen
66 \foreach \cx/\cy in {6.9/-.1,7.4/1.2,7/.7,7.9/1.5,9.2/0.2,%
67 9/1,7.5/-1.2,7/-0.8,9/-0.8,8.7/-1.2,7.7/-1.5,8.9/.5, %8.6,-1
68 7/1.3,6.6/.4,9.6/-.31,9.6/.6,8.3/1.2}{
69 \shade[Proton] (\cx,\cy) circle (.6mm);
70 }
71
72 \draw[<-] (8.25,.55) -- +(1.4,1.4) node[above] {Atomkern};
73 \draw[<-] (7,.4) -- +(-1.3,1) node[above] {Atomhülle};
74 \draw[<-] (6.8,-.085) -- +(-1.6,.4) node[above] {Elektron};
75 \draw[<-] (7.5,-.35) -- +(-2,-.7) node[below] {Proton};
76 \end{tikzpicture}
77 \defineavatar{Newton}{color=lime,subject={Top2},icon=Check,author={Dr. Albertus Newton}}
78 \pdfcommentsetup{avatar=Newton}
79 \pdfcomment{Wow, that's nice!}
80 \defineavatar{Dolittle}{color=NavyBlue,opacity=0.3,open=false,subject={Top1},icon=Circle,author={Prof. Dolittle}}
81 \pdfcommentsetup{avatar=Dolittle}\pdfmargincomment{Yeah nice, but stolen from the pgf-Users mailing list!}
82
83 \vspace{3cm}
84 \pdfmarkupcomment[author={Donald Duck},color=Khaki,opacity=1.0,markup=Underline]{For a long time \texttt{pdflatex} offers the command \texttt{\textbackslash pdfannot} for inserting arbitrary pdf annotations. However, in a form where additional knowledge of the pdf reference is indispensable. \texttt{pdfcomment.sty} is an answer to the -- from time to time -- emerging questions in newsgroups, how one could use the comment function of \texttt{Adobe Reader}. At least out of the \LaTeX{} code \texttt{pdfcomment.sty} offers a convenient and user-friendly possibility to use pdf annotations in pdf files}{It's better to use dark colors for annotations with lines, as you see! This is a Underline markup annotations}. \pdfmargincomment{Holy moly! Can anybody transfer that to real english!}
85
86 \pdfmarkupcomment[author={Donald Duck},color=Teal,opacity=1.0,markup=Squiggly]{Unfortunately the support of pdf annotations by pdf viewers is only partly available to nonexistent. The reference viewer for the development of this package is \texttt{Adobe Reader}.}{This is a Squiggly markup annotation}
87
88 \noindent\pdfsquarecomment[avatar=CaptainJack,subject={Top2},height=2.5cm,width=5.8cm,voffset=-2.8cm,hoffset=1cm,opacity=1.0,justification=right,icolor=CornflowerBlue,bse=cloudy,bsei=2.5,linewidth=8pt]{This is a Square annotation!}
89 \pdffreetextcomment[avatar=CaptainJack,subject={overlay},height=2.2cm,width=4.8cm,voffset=-2.8cm,hoffset=1.5cm,opacity=1.0,justification=right,type=typewriter,font=PalatinoLinotype,fontsize=13pt,fontcolor=black]{This typewriter annotation overlays the square!}
90 \pdfcirclecomment[avatar=CaptainJack,color=blue,subject={Top2},height=2.5cm,width=5.8cm,voffset=-2.8cm,hoffset=8cm,opacity=1.0,justification=right,icolor={yellow},linewidth=12pt,borderstyle=dashed,dashstyle={10 5}]{This is a Circle annotation!}
91 \pdflinecomment[type=polyline,avatar=CaptainJack,subject={Top2},opacity=1,line={150 120 260 120 300 150 400 80},color=green,icolor=blue,linebegin={/Slash},lineend={/Diamond},linewidth=3bp,bse=cloudy]{This is a Polyline comment!}
92
93 \vspace{3.5cm}
94 \pdfmarkupcomment[author={Donald Duck},color=yellow,opacity=1.0,markup=Highlight]{Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit, vestibulum ut,
95 placerat ac, adipiscing vitae, felis. Curabitur dictum gravida mauris. Nam arcu libero,
96 nonummy eget, consectetuer id, vulputate a, magna. Donec vehicula augue eu neque.
97 Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis
98 egestas. Mauris ut leo. Cras viverra metus rhoncus sem. Nulla et lectus vestibulum urna
99 fringilla ultrices. Phasellus eu tellus sit amet tortor gravida placerat. Integer sapien est,
100 iaculis in, pretium quis, viverra ac, nunc. Praesent eget sem vel leo ultrices bibendum.
101 Aeneanfaucibus.Morbidolornulla, malesuadaeu, pulvinarat, mollisac, nulla. Curabitur
102 auctor semper nulla. Donec varius orci eget risus. Duis nibh mi, congue eu, accumsan
103 eleifend, sagittis quis, diam. Duis eget orci sit amet orci dignissim rutrum.}{This is a Highlight markup annotations with page break}
104
105 \vspace{5cm}
106 \pdflinecomment[avatar=CaptainJack,subject={Top2},type=line,opacity=1,line={110 620 220 530},color=green,icolor=blue,caption=none,linebegin={/RClosedArrow},lineend={/Circle},linewidth=2bp]{This is another Line comment! Just to show all possible arrows!}
107 \pdflinecomment[type=polygon,avatar=CaptainJack,subject={Top2},opacity=1,line={275 590 355 600 400 570 350 530 270 540 276 590},color=green,icolor=CornflowerBlue,linewidth=5bp,bse=cloudy,bsei=2.2]{This is a Polygon comment!}
108
109 \begin{pdfsidelinecomment}[avatar=CaptainJack,subject={Top2},opacity=1,color=red,icolor=yellow,caption=inline,linebegin={/Butt},lineend={/Square},linewidth=3bp,linesep=1cm]{ ! Delete ! }
110 \lipsum[2-6]
111 \end{pdfsidelinecomment}
112
113 \vspace{2cm}
114 \definestyle{mathpopup}{author={},subject={},color=NavajoWhite,markup=Highlight}
115 \[
116 \begin{array}{c>{\displaystyle}c}
117 \text{Bernoulli Trials} &
118 \pdfmarkupcomment[style=mathpopup]{P(E)}{Probability of event E: Get exactly k heads in n coin flips.}%
119 =
120 \pdfmarkupcomment[style=mathpopup]{\dbinom{n}{k}}{Number of ways to get exactly k heads in n coin flips}%
121 {\pdfmarkupcomment[style=mathpopup]{p}{Probability of getting heads in one flip}%
122 }^{%
123 \pdfmarkupcomment[style=mathpopup,mathstyle=\scriptstyle]{k}{Number of heads}
124 }%
125 \pdfmarkupcomment[style=mathpopup]{(1-p)}{Probability of getting tails in one flip}^{%
126 \pdfmarkupcomment[style=mathpopup,mathstyle=\scriptstyle]{n-k}{Number of tails}%
127 }%
128 \end{array}
129 \]
130
131 \begin{tikzpicture}
132 \draw [<->,thick] (0,2) node (yaxis) [above] {$y$}
133 |- (3,0) node (xaxis) [right] {$x$};
134 \draw (0,0) coordinate (a_1) -- (2,1.8) coordinate (a_2);
135 \draw (0,1.5) coordinate (b_1) -- (2.5,0) coordinate (b_2);
136 \coordinate (c) at (intersection of a_1--a_2 and b_1--b_2);
137 \draw[dashed] (yaxis |- c) node[left] {$y'$}
138 -| (xaxis -| c) node[below] {$x'$};
139 %
140 \fill[red] (0,0) circle (2pt);
141 \draw (0,0) node {\pdftooltip{\rule{0pt}{0.5cm}\rule{0.5cm}{0pt}}{Origin}};
142 %
143 \draw[red] (1.5,2) node {\pdftooltip{\textbullet}{1.5,2.0}};
144 %
145 \fill[red] (c) circle (2pt)
146 let
147 \p1 = (current path bounding box.south west),
148 \p2 = (current path bounding box.north east)
149 in
150 node at (current path bounding box)
151 {\pdftooltip{\rule{\dimexpr\x2-\x1\relax}{0pt}\rule{0pt}{\dimexpr\y2-\y1\relax}}%
152 {This is the intersection point\textCR of the two lines!}};
153 \end{tikzpicture}
154 \hspace{1cm}
155 \begin{tikzpicture}
156 \draw (1.5,0) node[below] {countries};
157 \draw (0,1) node[left] {\pdftooltip{SCI}{Sausage Consumption Index}};
158 \fill[blue] (0.5,0) rectangle (1,1.2)
159 let
160 \p1 = (current path bounding box.south west),
161 \p2 = (current path bounding box.north east)
162 in
163 node at (current path bounding box)
164 % these calculations are based on scale factor 1 otherwise use:
165 % \dimexpr(scale factor)\dimexpr\x2-\x1\relax\relax
166 {\pdftooltip{\rule{\dimexpr\x2-\x1\relax}{0pt}\rule{0pt}{\dimexpr\y2-\y1\relax}}%
167 {USA: 120}};
168 \fill[red] (1.5,0) rectangle (2,1.8)
169 let
170 \p1 = (current path bounding box.south west),
171 \p2 = (current path bounding box.north east)
172 in
173 node at (current path bounding box)
174 {\pdftooltip{\rule{\dimexpr\x2-\x1\relax}{0pt}\rule{0pt}{\dimexpr\y2-\y1\relax}}%
175 {Germany: 180}};
176 \fill[green] (2.5,0) rectangle (3,0.65)
177 let
178 \p1 = (current path bounding box.south west),
179 \p2 = (current path bounding box.north east)
180 in
181 node at (current path bounding box)
182 {\pdftooltip{\rule{\dimexpr\x2-\x1\relax}{0pt}\rule{0pt}{\dimexpr\y2-\y1\relax}}%
183 {South Africa: 65}};
184 \draw [<->,thick] (0,2) node (yaxis) [above] {$y$}
185 |- (3.5,0) node (xaxis) [right] {$x$};
186 \end{tikzpicture}
187
188 \bigskip\bigskip
189 You can use tooltips with simple \pdftooltip{\textcolor{red}{words}}{This is a tooltip!} or chemical notation like: $\pdftooltip{H_{2}SO_{4}}{Sulfuric acid}$
190
191 \bigskip\bigskip
192 It also works in equations: \[\pdftooltip[mathstyle=\displaystyle]{\sum_{i=1}^{n}i=\frac{1}{2}n\cdot(n+1)}{little Gauß}\]
193 \end{document}