0

Unsuccessful with a global question Annotation on a pdf : copyable, moveable, and including LaTeX maths and Comments/tips on a (non Latex) pdf including mathematical formulas, I come back with very precise questions :

  1. What is the (pdf) nature of the nice copyable and moveable "notes" pdfcomment is producing ? annotation ? another pdf object ?
  2. What is the secret of pdfcomment (the LaTeX macro used by pdfcomment) to produce those copyable and moveable pdf objects ?
  3. Is there a way to compile a LaTeX macro (e.g. \frac{1}{2}) to be put in the pdfcomment comment/annotation ?
  • 1
    Would be much more useful to link directly to your earlier asking of the same question, https://tex.stackexchange.com/questions/301189/comments-tips-on-a-non-latex-pdf-including-mathematical-formulas. – cfr Jul 29 '17 at 22:26
  • @cfr : meta : I am quite desperate with the redaction of these questions ! I try hard to be precise but failed. The question I referred to was considered duplicate with the question you quote but I don't consider it duplicate : as a proof, the solution proposed for the question you quoted is not a solution of the question I quoted. The key difference stands in the "copyable" and "moveable" properties. – user1771398 Jul 30 '17 at 03:56
  • meta : Is there a place, forum for instance, to help write a good question when the question is difficult ? – user1771398 Jul 30 '17 at 03:57
  • Your questions haven't been redacted. (Questions can't be redacted as far as I know, except in the sense that people could edit them to remove parts. I suppose they could leave XXXX or something instead. Never seen it, though.) Both questions talk about copying and moving comments, so I don't see the difference you're referring to. But one reason the question I linked is more likely to be useful is just that there's a lot more background there in terms of solutions and discussion. By the way, your link goes to the version history page and not the question itself. – cfr Jul 30 '17 at 04:10
  • by "redaction" I meant my own writing of the question, not some editing by other as you seem to refer to (English is not my mother language so I may have misused "redaction"). I included the other question as suggested. – user1771398 Jul 30 '17 at 04:23
  • Oh, I see. I think there's a misunderstanding. Usually 'redact' means removing or obscuring parts of a text. For example, the government might black out people's names before releasing a document publicly, to protect individuals. Or an official might black out part of a soldier's letter home, to avoid details of military operations being made public. Or a newspaper might leave blank space to show that a story had been banned by a censor. I think you probably mean something else .... – cfr Jul 30 '17 at 13:21

1 Answers1

7

pdfcomment offers an interface to PDF annotations (section 8.4, page 604 in PDF Reference, sixth edition ,Adobe® Portable Document Format, Version 1.7, November 2006, Adobe Systems Incorporated)

There's no secret, pdfcomment just uses pdflatex's \pdfannot primitive. It takes care of the 'over head' and pdfcomment just adds some meat to the bone, e.g.:

\newcommand{\pc@annot@markup@pdf}%
{%
  \pdfannot width 0pt height 0pt depth 0pt%
  {%
    /Subtype /\pc@lopt@markup\space%
    /C [\pc@hyenc@color]\space%
    \pc@lopt@cdate\space%
    /CA \pc@lopt@opacity\space%
    /T (\pc@pdfenc@author)\space%
    /Subj (\pc@pdfenc@subject)\space%
    /Contents (\pc@pdfenc@contents)\space%
    /Open \pc@lopt@open\space%
    /QuadPoints [\pc@annot@quadpoints]\space%
    /F 4\space%
  }%
}%

Other engines need different approaches like \special{pdf: ann width 0pt height 0pt depth 0pt% (dvipdfmx) or \pdfmark[\rule{0pt}{0pt}]% (dvips).

You can not really add a LaTeX macro like \frac{1}{2} into a \pdfcomment macro, as the standard text PDF annotations (there are also others like audio annotations, stamps, ...) are designed as 'text only' in the PDF format by Adobe. You may add some mathematical symbols and so on in Unicode

For complex material you need a completly different approach like fancytooltip or AlexG's hacking in Javascript, see e.g. Move-around box in PDF display

Josef
  • 7,432
  • To keep the essential moveable/copyable property, I used Unicode characters within the pdfcomment macro as indicated. In fact, I write the Latex phrase I need and then I use a Latex to Unicode online engine to produce the Unicode sequence. Workable. – user1771398 Jul 30 '17 at 14:32
  • What is the nature of LaTeX maths formulaes as seen by the pdf document ? An image ? Created by pdflatex for instance ? – user1771398 Jul 30 '17 at 14:34
  • Since it seems that all unicode characters are OK with the pdf definition of "text only", can we imagine to use the "unicode-math" package together with Lualatex to produce the Unicode sequence from a standard LaTeX maths formula ? I tried, but it failed with a "! Improper alphabetic constant" error. – user1771398 Jul 30 '17 at 14:39