[XeTeX] Hypertarget preview in Skim

Peter Dyballa Peter_Dyballa at Web.DE
Mon Jun 29 23:26:59 CEST 2009


Am 27.06.2009 um 02:07 schrieb Ross Moore:

> The view that Skim shows you would be dependent upon
> the position of the destination anchor that specifies
> the hyperlink target.
>
> The pictures that you present would then suggest that with
> pdfTeX, the anchor is raised by 1cm or so, whereas with XeTeX
> it just occurs on the baseline of the text constituting the
> (sub)section heading.

I'm having a bit of trouble with pdfTeX and hyperref. The  
hypertargets are created inside a longtable environment, at top of  
the page. The code is like this:

	\hypertarget{Projekte}{\ifxetex
	  & \multicolumn{2}{l}{\textcolor{Maroon}{\kopf{Projekte}}}\\[9.375mm]
	\else
	  & \multicolumn{2}{l}{\textcolor{DarkRed}{\LARGE\so{Projekte}}}\ 
\[9.375mm]
	\fi}

which pdfTeX does not seem to accept:

	[2]
	pdftex: define anchor at line 402: Projekte
	! Incomplete \iffalse; all text was ignored after line 402.
	<inserted text>
	                \fi
	l.402 \fi}
	
	! Missing \endgroup inserted.
	<inserted text>
	                \endgroup
	l.402 \fi}
	
	! Undefined control sequence.
	<argument> \kopf
	                 {Projekte}
	l.402 \fi}
	
	! Extra \else.
	<argument> \ifxetex & \multicolumn {2}{l}{\textcolor {Maroon}{\kopf  
{Projekte}}}\\[9.375mm]\else
	                                                                        
                           & \multicolumn {2}{l}{\textcolor {DarkRed} 
{\LARGE \so {Projekte}}}\\[9.375mm]\fi
	l.402 \fi}
	
	! Extra \fi.
	\hypertarget #1#2->\ifHy at nesting \hyper@@anchor {#1}{#2}\else  
\hyper@@anchor {#1}{\relax }#2\fi
	
	l.402 \fi}
	
	pdftex: define anchor at line 433: page.3
	[3]

because I don't want to write so complicated:

	\ifxetex
	  & \multicolumn{2}{l}{\hypertarget{Praxis}{\textcolor{Maroon}{\kopf 
{Berufliche Praxis}}}}\\[9.375mm]
	\else
	  & \multicolumn{2}{l}{\hypertarget{Praxis}{\textcolor{DarkRed} 
{\LARGE\so{Berufliche Praxis}}}}\\[9.375mm]
	\fi

XeTeX accepts both… PdfTeX created a second line of text above the  
target, and actually this became the target! When I corrected the  
hypertarget error I could observe Skim falling back to the XeTeX  
behaviour – and then I saw the second line. So there is no bug,  
except that I would like to see a different behaviour.

>
> You should be able to check this using other PDF viewers:
> scale up to 300% or so, then click the hyperlink.
> Does the window position the view of the target at the top
> of the anchor text, or to its baseline?
>
>
>  hyperref  has an option  'raiselinks'  to control this extra
> vertical positioning. So try setting
>             \hypersetup{raiselinks=true}
> and see if that changes anything.

With or without this option all PDF viewers (Adobe Reader, Preview,  
TeXShop, and Skim) jump at 300 % to the baseline. At around 100 %  
Skim positions the upper corner of the view exactly at the baseline  
while the other viewers raise their corners… The LOG file tells  
whether raiselinks was set to true.

>
>
> Note that driver files   hdvips.def   hdvipson.def   hvtexmrk.def
> each have a line:    \def\Hy at raisedlink{}
> which cancels any possible implementation of raising anchors.

This would have been a too silly mistake! Interestingly I found that  
when I pass any of the options dvipdfmx or xetex or none to hyperref,  
different things are reported:

	dvipdfmx	=> *hyperref using driver hdvipdfm*
	xetex		=> *hyperref using driver hdvipdfm*
	<nothing>	=> *hyperref using default driver hdvipdfm*

so with hyperref v6.78r it works to not set any driver.


A strange message is inserted just before geometry reports parameters  
and dimensions or in the console before the auxiliary files are read in:

	*geometry detected driver: pdftex*

Is this just a typo or is this a serious bug?

--
Greetings

   Pete

Make it simple, as simple as possible but no simpler.
				– Albert Einstein





More information about the XeTeX mailing list