[tex-k] HyperTeX tags

Oleg Katsitadze olegkat at gmail.com
Mon Feb 27 13:03:36 CET 2006


Dear all,

I have a couple of questions about hyperTeX with Ghostscript
(ps2pdf) and dvipdfm(x).  Sorry if this is a wrong place to
ask, but I could not get an answer on the texhax mailing
list, and pdftex mailing list seems to be even more
off-topic.

For the test case I've created two files, from.tex and
to.tex, like this:

--------------------from.tex--------------------
{\catcode`\#=11
\gdef\hash{#}}

\noindent
\special{html:<a href="file:to.pdf\hash dest">}%
  Link to to.pdf%
\special{html:</a>}

\bye
--------------------from.tex--------------------

---------------------to.tex---------------------
{\catcode`\#=11
\gdef\hash{#}}

\null\vfill\eject % Empty first page.

\noindent
\special{html:<a name="dest">}%
  Destination in to.pdf%
\special{html:</a>}

\vfill

\noindent
\special{html:<a href="\hash dest">}Reference to force
creation of the target anchor\special{html:</a>}

\bye
---------------------to.tex---------------------

So I have a link from from.tex pointing to a destination
on the second page of to.tex.

I compile the files with the commands

  $ tex from.tex
  $ dvips -z from.dvi -o
  $ ps2pdf from.ps

  $ tex to.tex
  $ dvips -z to.dvi -o
  $ ps2pdf to.ps

and obtain two files, from.pdf and to.pdf.

The first problem:  the link from from.pdf opens to.pdf on
the _first_ page (both in Xpdf and Acrobat Reader).  When I
look at the `raw' from.pdf, I see:

  9 0 obj
  <</Type/Annot
  /T(file:to.pdf#dest)
  /Rect [72 757 133 769]
  /Border [1 1 1[]]
  /C [0 0 1]
  /A<</Type/Action
  /S/GoToR
  /D/dest
  /F(to.pdf)>>
  /Subtype/Link>>endobj

Alright.  Now I open to.pdf and see:

  10 0 obj
  <</Type/Page/MediaBox [0 0 595 842]
  /Rotate 0/Parent 3 0 R
  /Resources<</ProcSet[/PDF /Text]
  /Font 14 0 R
  >>
  /Annots[13 0 R]/Contents 11 0 R
  >>
  endobj

  [...]

  3 0 obj
  << /Type /Pages /Kids [
  4 0 R
  10 0 R
  ] /Count 2
  >>
  endobj

  [...]

  13 0 obj
  <</Type/Annot
  /T(dest)
  /Rect [72 437 279 449]
  /Border [1 1 1[]]
  /C [0 0 1]
  /Dest [10 0 R /FitH 841]
  /Subtype/Link>>endobj
  14 0 obj

This is the link on the second page of to.pdf to the
destination on the same page, but instead of creating a
named destination "dest" and linking to it, ps2pdf created
link using explicit destination.  There is no destination
named "dest" defined in to.pdf, so this explains why viewers
can't find it when I click on the link in from.pdf.  This
appears to be the problem with ps2pdf, because when I look
at to.ps, I see:

  HPSdict begin
  /TargetAnchors
  1 dict dup begin
  (dest) [2 [72 757 163 769] 841] def
  end targetdump-hook def end

  [...]

  TeXDict begin HPSdict begin 2 1 bop 0 166 a
  Fa(Destination)55
  b(in)h(to.p)5 b(df)0 5507 y(Reference)55
  b(to)g(force)f(creation)h(of)g
  (the)g(target)g(anc)-5 b(hor)p
   (#dest) [[72 437 279 449] [1 1 1 [3 3]] [0 0 1]] pdfm 
  3858 11078 a(2)p eop end end

which I think means that the destination is defined in
to.ps.  Furthermore, if I run

  $ dvipdfmx to.dvi

to produce to.pdf, the inter-document link starts to work,
and to.pdf contains:

  15 0 obj
  <<
  /Names[(dest) 8 0 R]
  >>
  endobj

  [...]

  8 0 obj
  [7 0 R /XYZ null 783.9271239 null]
  endobj

  [...]

  7 0 obj
  <<
  /Contents[10 0 R]
  /Resources 11 0 R
  /Type/Page
  /Parent 17 0 R
  /Annots 18 0 R
  >>
  endobj

  [...]

  17 0 obj
  <<
  /Type/Pages
  /Count 2
  /Kids[3 0 R 7 0 R]
  /MediaBox[0 0 595.28 841.89]
  >>
  endobj

So the named destination "dest" is in place.  So my question
is, how do I force ps2pdf to create real named destinations
in the produced PDFs?


The second question is about dvipdfmx.  As I mentioned
above, dvipdfmx correctly creates destinations in to.pdf,
but when I run it on from.dvi to create the inter-document
link:

  $ dvipdfmx from.dvi

unlike dvips, dvipdfmx seems to fail to parse the `#'
extension, and creates the following link in from.pdf:

  4 0 obj
  <<
  /Type/Action
  /S/URI
  /URI(file:to.pdf#dest\000)
  >>
  endobj

Is this just a fact of life, or there is a way to make
dvipdfmx create correct local inter-document links?  (Of
course, this is possible using "native" \special's of
dvipdfmx, but I need to use only hyperTeX tags and/or
dvipdfmx command line options.)


While I am at it, here's another quick question about
hyperTeX:  what is the reason for creating a target spanning
some text, instead of marking just a spot on a page?  In
other words, what is the difference (functionally) between
these two pieces of code:

  \special{html:<a name="DEST">}Destination\special{html:</a>}

and

  \special{html:<a name="DEST">}\special{html:</a>}Destination


Versions of the programs I use:

 - TeX (Web2C 7.4.5) 3.14159
 - dvips(k) 5.92b
 - dvipdfmx-20040411 by the DVIPDFMx project team
 - ESP Ghostscript 8.15.0 (2005-08-11)
 - Xpdf 3.01
 - Acrobat Reader 7.0


Thanks in advance for any help,
Oleg Katsitadze



More information about the tex-k mailing list