Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[xdvipdfmx] wrong annotation rectangle if the pstricks is involved #53

Open
aminophen opened this issue Mar 14, 2018 · 2 comments
Open
Labels

Comments

@aminophen
Copy link
Member

http://tug.org/pipermail/tex-live/2018-March/041125.html

というのがあったので,備忘録として。

@aminophen aminophen added the bug label Mar 14, 2018
@aminophen
Copy link
Member Author

aminophen commented Sep 23, 2018

少し調べてみました。例のテストケースを test.tex とでもして保存して

$ xelatex -no-pdf test
$ xdvipdfmx -vvvv test

とでもしてみると,処理の最後の方で

Current input buffer is -->pdf:bann<</Type/Annot/Subtype/Link/Border[0 0 1]/H...<--

Current input buffer is -->pst:  tx@Dict begin STP newpath /ArrowA { moveto }...<--
(Image:/var/folders/m8/j64xn09j2_xbqscws7skdbxc0000gn/T/dvipdfmx.tyivt6[/var/folders/m8/j64xn09j2_xbqscws7skdbxc0000gn/T/dvipdfmx.tyivt6][PDF],Page:1)
Current input buffer is -->pdf:eann<--

xdvipdfmx:warning: Annotation out of page boundary.
xdvipdfmx:warning: Current page's MediaBox: [0 0 612 792]
xdvipdfmx:warning: Annotation: [0 0 2375.09 3357.41]
xdvipdfmx:warning: Maybe incorrect paper size specified.

のようになります。ここに着目して,途中生成している一時ファイル(名前は毎回違う)を

for i in `seq 0 1000`; do cp /private/var/folders/m8/j64xn09j2_xbqscws7skdbxc0000gn/T/dvipdfmx* . ; done

とでもして捕まえてみると,この中身が PDF であることがわかります。そこで QPDF を使って

$ qpdf --qdf dvipdfmx.tyivt6 -

として読んでみると

%% Original object ID: 2 0
2 0 obj
<<
  /CreationDate (D:20180923135719+09'00')
  /ModDate (D:20180923135719+09'00')
  /Producer (GPL Ghostscript 9.23)
>>
endobj
%% Page 1
%% Original object ID: 4 0
6 0 obj
<<
  /Contents 7 0 R
  /MediaBox [
    0
    0
    2384
    3370
  ]
  /Parent 5 0 R
  /Resources <<
    /ExtGState 9 0 R
    /ProcSet [
      /PDF
    ]
  >>
  /Type /Page
>>
endobj

という情報が取れます。この結果を見ると,

  • xdvipdfmx は PSTricks の描画命令を Ghostscript に渡している
  • Ghostscript が作った PDF の /MediaBox が [0 0 2384 3370] である

ことがわかります。この値は前掲の xdvipdfmx:warning: Annotation: [0 0 2375.09 3357.41] と近い(2375.09 = 2384*72/72.27)ことからも

  • xdvipdfmx は PDF の /MediaBox を正常に読み取って長方形サイズを決定した

と言えます。さらに,「Ghostscript が作った PDF の /MediaBox が [0 0 2384 3370] である」の理由は dvipdfmx.cfg の rungs 向けパラメータに -sPAPERSIZE=a0 が与えられていることですね。

ところで,何故 72/72.27 を掛けているのだろう…?

@aminophen
Copy link
Member Author

aminophen commented Sep 23, 2018

ここまでの調査結果は

https://tug.org/pipermail/tex-live/2018-September/042436.html

に投稿しました。まだよくわからないのが

  • annotation rectangle のサイズ計算で 72/72.27 を掛けているのはなぜか
  • EPS を scale != 1 で取り込むとやはり annotation rectangle サイズが変なのはなぜか

たぶん,本題の PsTricks の件は後者と同根だと思います。普通の PDF を取り込む時はなんとなくうまくいっていそうなので,そちらのルーチンを借りれば何とかなるのかも?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant