1

The following link Hyperref to external pdf that will open at particular label gives great answer for linking individual pdfs. However it seems to NOT working for platex with dvipdfmx that is mostly used for Japanese documents. Is there a way to create hypertarget with the engine, or necessary to use pdflatex which is not compatible with Japanese?

1

1 Answer 1

3

The problem you are facing is the default setting of dvipdfmx. By default, the PDF destination are optimized, so they cannot be accessed from other files. If you disable the optimization, the hypertarget works.

Ref. dvipdfmx.cfg ($TEXMFDIST/dvipdfmx/dvipdfmx.cfg)

%% Dvipdfmx Compatibility Flags
%%
%%   0x0002  Use semi-transparent filling for tpic shading command,
%%           instead of opaque gray color. (requires PDF 1.4)
%%   0x0004  Treat all CIDFont as fixed-pitch font.
%%           This is only for backward compatibility. Don't use that.
%%   0x0008  Do not replace duplicate fontmap entries.
%%           Dvipdfm's (not 'x') behaviour.
%%   0x0010  Do not optimize PDF destinations. Use this if you want to
%%           refer from other files to destinations in the current file.

%C  0x0000

So, you should invoke dvipdfmx as follows, to disable optimization of destinations inside the target file that is referenced:

dvipdfmx -C 0x0010 fileA

Alternatively, if you are using TeX Live 2016 or later, simply adding

\special{dvipdfmx:config C 0x0010}

to fileA.tex has the same effect.

4
  • tex.stackexchange.com/questions/275739/… is the same situation, since XeTeX uses xdvipdfmx, which shares the binary with dvipdfmx, as an output driver. Mar 13, 2017 at 0:10
  • Great answer! By the way, are there any problems when it is disabled? Anyway, I'm putting \special{dvipdfmx:config C 0x0010} in my target file for the current purpose.
    – MasaYan
    Mar 13, 2017 at 7:17
  • 1
    When the optimization is enabled, the target names are shortened (This is why references from external files are impossible). When the optimization is disabled, the original target names (e.g. "myhypertarget1" in fileA.tex you referred to) are preserved, which should mean that the file size may become bigger. Personally I don't think that is a serious problem. Mar 13, 2017 at 11:17
  • Thank you for the response. I definitely disable the optimization without worry :)
    – MasaYan
    Mar 14, 2017 at 2:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .