Using \pdfmarkupcomment in math mode
Josef Kleber
Saturday 21
stMay, 2011
1 Simple formulas
PDF annotations work in inline formula (Pni=1i = 12n·(n+ 1)), as well as in display mode:
f(x) =
n
Y
i=1
i− 1
2i
Of course, you can only comment parts of a formula:
(a+b=c)d+e
1 \[( a + b = c ) ^ { \p d f m a r k u p c o m m e n t[s t y l e=m a t h p o p u p]
2 { d + e }{ c o m m e n t } } \ ]
As you can see the size of the PDF annoation is too big! The math content is set into a box to measure the size. Unfortunately, the math context gets lost, which results in a wrong size, as the math snippets are set as inline formula into the box by default. You can correct this with the option mathstyle (\textstyle, \displaystyle, \scriptstyle,
\scriptscriptstyle)
(a+b=c)d+e
1 \[( a + b = c ) ^ { \p d f m a r k u p c o m m e n t[s t y l e=m a t h p o p u p,
2 m a t h s t y l e=\s c r i p t s t y l e]{ d + e }{ c o m m e n t } } \ ]
Of course, it also works with equations:
n
X
i=1
i= 1
2n·(n+ 1) (1)
1 \b e g i n{ e q u a t i o n }
2 \p d f m a r k u p c o m m e n t[s t y l e=m a t h p o p u p,
3 m a t h s t y l e=\d i s p l a y s t y l e]
4 {\sum_{ i = 1 } ^ { n } i =\f r a c{ 1 } { 2 } n
5 \c d o t( n + 1 ) } { c o m m e n t }
6 \end{ e q u a t i o n }\l a b e l{ eq : d i s p l a y }
In formula 1 mathsytle=\displaystyle was used.
1
2 Complex formulas
If you use more complex environments like eqnarry*, you can no longer comment the complete formula, as this would break the internals of the environment. Remember that you can only comment, what you can put into a math box ($math stuff$). Therefore, you can only comment parts of the complex formula:
left middle right
√1 n =
√n
n = n
n√ n
1 \b e g i n{ e q n a r r a y *}
2 \p d f m a r k u p c o m m e n t[s t y l e=m a t h p o p u p]
3 {\m a t h r m{ l e f t }}{ c o m m e n t } &
4 \p d f m a r k u p c o m m e n t[s t y l e=m a t h p o p u p]
5 {\m a t h r m{ m i d d l e }}{ c o m m e n t } &
6 \p d f m a r k u p c o m m e n t[s t y l e=m a t h p o p u p]
7 {\m a t h r m{ r i g h t }}{ c o m m e n t }\\
8 \p d f m a r k u p c o m m e n t[s t y l e=m a t h p o p u p,
9 m a t h s t y l e=\d i s p l a y s t y l e]
10 {\f r a c{ 1 } { \s q r t{ n } } } { c o m m e n t } = &
11 \p d f m a r k u p c o m m e n t[s t y l e=m a t h p o p u p,
12 m a t h s t y l e=\d i s p l a y s t y l e]
13 {\f r a c{\s q r t{ n }}{ n }}{ c o m m e n t } = &
14 \p d f m a r k u p c o m m e n t[s t y l e=m a t h p o p u p,
15 m a t h s t y l e=\d i s p l a y s t y l e]
16 {\f r a c{ n }{ n \s q r t{ n } } } { c o m m e n t }
17 \end{ e q n a r r a y *}
2