[XeTeX] Hypertarget preview in Skim

Ross Moore ross at ics.mq.edu.au
Tue Jun 30 08:28:58 CEST 2009


Hi Peter,

On 30/06/2009, at 7:26 AM, Peter Dyballa wrote:

>
> 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}

This cannot work, because the & delimits cells in a table.
So you'll have a cell containing:

     \hypertarget{Projekte}{\ifxetex

which clearly isn't fully-formed.

Why don't you organise your coding so that different kinds
of delimited layout and data structures do not overlap ?
e.g.,

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

If that doesn't work, then try

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

This is probably safer anyway...


>
> 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

No, but just put the \if... ...\fi test around the bits
that are actually different for the two cases.


>
> 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.

  ... since \hypertarget  is a complicated beastie, defined
by the hyperref package. I'd be very wary of passing anything
too complicated within *any* of its arguments.
If such a thing works, then count yourself as being lucky.


>>  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!

Or a mistake that you didn't think you were making.
   :-)

> 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?

Please send an example with the complete preamble that you
are using.  Often a problem is caused by something other
that what seems the most obvious command or package.


>
> --
> Greetings
>
>   Pete
>
> Make it simple, as simple as possible but no simpler.
> 				– Albert Einstein

   And heed Al's fine words !!!


>
>


Hope this helps,

	Ross

------------------------------------------------------------------------
Ross Moore                                       ross at maths.mq.edu.au
Mathematics Department                           office: E7A-419
Macquarie University                             tel: +61 (0)2 9850 8955
Sydney, Australia  2109                          fax: +61 (0)2 9850 8114
------------------------------------------------------------------------





More information about the XeTeX mailing list