Coder Social home page Coder Social logo

pxjahyper's Introduction

PXjahyper Package

LaTeX: Hyperref support for pLaTeX

This package adjusts the behavior of hyperref on (u)pLaTeX so that authors can properly create PDF documents that contain document information in Japanese.

  • Support for PDF strings containing Japanese characters.
  • Support for magnification settings.

System Requirements

  • TeX format: LaTeX.
  • TeX engine: pTeX, upTeX, pTeX-ng.
    Some features require the e-TeX extension.
  • DVI-ware: dvipdfmx.
  • Dependent packages:
    • atbegshi
    • hyperref
  • Packages required by some features:
    • japanese-otf
    • etoolbox
    • bxjatoucs

Installation

  • *.sty, *.def → $TEXMF/tex/platex/PXjahyper

License

This package is distributed under the MIT License.

The pxjahyper Package ー main

Please refer to the manual pxjahyper.pdf (in Japanese) for detail.

The pxjahyper-enc Package ー Encoding setting

This is a single-feature package excerpted from the pxjahyper package, and is provided for internal use from other packages.

It only issues a "tounicode special” for specifying the encoding of the PDF strings in the output DVI file.

Revision History

  • Version 1.3 〈2023/03/01〉
  • Version 1.2a 〈2022/10/19〉
  • Version 1.2 〈2022/05/27〉
  • Version 1.1 〈2022/05/10〉
  • Version 1.0a 〈2022/04/15〉
  • Version 1.0 〈2022/04/01〉
  • Version 0.9d 〈2022/03/15〉
  • Version 0.9c 〈2021/06/06〉
  • Version 0.9b 〈2021/05/29〉
  • Version 0.9a 〈2021/05/11〉
  • Version 0.9 〈2021/05/10〉
  • Version 0.8 〈2021/05/05〉
  • Version 0.7b 〈2021/02/26〉
  • Version 0.7a 〈2021/02/23〉
  • Version 0.7 〈2021/02/13〉
  • Version 0.6a 〈2020/10/10〉
  • Version 0.6 〈2020/10/05〉
  • Version 0.5b 〈2020/10/04〉
  • Version 0.5a 〈2020/09/27〉
  • Version 0.5 〈2020/06/13〉
  • Version 0.4b 〈2020/04/24〉
  • Version 0.4a 〈2019/11/23〉
  • Version 0.4 〈2019/10/25〉
  • Version 0.3e 〈2019/06/20〉
  • Version 0.3d 〈2018/07/15〉
  • Version 0.3c 〈2018/01/25〉
  • Version 0.3b 〈2018/01/13〉
  • Version 0.3a 〈2017/10/17〉
  • Version 0.3 〈2012/05/28〉
  • Version 0.2 〈2012/05/27〉

Takayuki YATO (aka. "ZR")
https://github.com/zr-tex8r

pxjahyper's People

Contributors

h20y6m avatar tyato avatar wtsnjp avatar zr-tex8r avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

pxjahyper's Issues

pLaTeX+tounicodeモードの場合のjapanese-otfの”\\UTF”命令の対策

背景

  • pxjahyperは「和文を含むPDF文字列の処理を正常にする」ことを目的にしているので、japanese-otfパッケージの\UTF命令のPDF文字列中の動作についても、可能な限り妥当なものにしたい。
  • pxjahyperはPDF文字列中の和文の処理方式について2つのモードを持っている:
    • tounicodeモード:和文文字をdvipdfmxの「tounicode special」の機能で処理させる。
    • out2uniモード:和文を含むPDF文字列を「out2uniフィルタ」で変換することを前提とした出力を行う。
      • pLaTeX専用。
      • このモードを指定して実際にout2uniフィルタを使用しない場合の結果は未定義動作である。
  • モードの既定値はtounicodeモードである。以下ではtounicodeモードを前提とする。
    • 現在においてout2uniフィルタを利用している人はほとんどいないと思われる。out2uniはUTF-8にも非対応。
  • upLaTeX+tounicodeモードでは、\UTF命令は当該のUnicode文字に変換されるので、所望の結果が得られる。
    • 例えば森\UTF{9DD7}外森鷗外になる。
  • 対して、pLaTeX+tounicodeモードの場合、pxjahyper自体は\UTFに対して対策を行っていない
    • 一方で、japanese-otf自体がPDF文字列中における対策を行っていて、そこでは\UTFout2uni用のエスケープ表記である\0x...という表記に変換される。pxjahyperを使用する場合でもこの結果が保たれる。
    • 例えば森\UTF{9DD7}外森\0x9DD7外になる。
    • out2uniフィルタを使うのであれば最終的に正常な森鷗外が得られる。しかしtounicodeモードはtounicode specialで処理することが前提であり、その場合は「\0がNUL文字となり後続の文字はそのまま」と解釈される。つまり、森\UTF{9DD7}外+NUL+x9DD7外となる。Adobe Readerで文字情報を見た場合、NUL以降が削除されてと表示される。
    • 大前提として、pLaTeX+tounicodeモードの場合、dvipdfmxの仕様のため**“JIS外字”をPDF文字列に含めることは不可能**である。
    • しかし、少なくとも「\UTF以降の文字を巻き込んで消えてしまう」のは最善の結果とはいえない

問題

pLaTeX+tounicodeモードの場合の\UTFのPDF文字列中の表示(※JIS X 0208+ASCIIの範囲の文字列に限られる)はどうあるべきか。

  1. 従来通り:森\UTF{9DD7}外森\0x9DD7外(Adobe Readerでの表示は
  2. 削除する:森\UTF{9DD7}外森外
  3. ゲタ文字に変換する:森\UTF{9DD7}外森〓外
  4. フォールバックとして符号値を表示する:森\UTF{9DD7}外森[U+9DD7]外
  5. その他

platexrelease で Missing \begin{document}

@zr-tex8r

pxjahyper.sty 2020/09/27 v0.5a において,platexrelease で巻き戻すと

\listfiles
\RequirePackage[2020/02/02]{platexrelease}
\documentclass[dvipdfmx]{article}
\usepackage{hyperref}
\usepackage{pxjahyper}
\begin{document}
ここから\hfill ここまで
\end{document}
! LaTeX Error: Missing \begin{document}.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              
                                                  
l.315 ...\pxhy@out@special{pdf:tounicode EUC-UCS2}

のエラーが出ます。

pLaTeX での bigcode is invalid without upTeX 警告

最新 v0.3b を試しています。

\documentclass[dvipdfmx]{jarticle}
\usepackage{hyperref}
\usepackage{pxjahyper}

を pLaTeX でコンパイルすると,bigcode オプションを明示していないにもおかかわらず

Package pxjahyper Warning: bigcode is invalid without upTeX.

という警告が出ます。この動作は意図的でしょうか?

LaTeX2e 2020-10-01 対策

LaTeX2e 2020-10-01 で atbegshi に相当する機能が独立のパッケージでなくカーネルの機能の一部となり,従来の atbegshi.sty に存在した内部命令が未定義になります。そのため platex-dev では

! Undefined control sequence.
\pxhy@out@special ...ndafter {\AtBegShi@HookFirst 
                                                  }\xdef \AtBegShi@HookFirst...
l.307 ...\pxhy@out@special{pdf:tounicode EUC-UCS2}
                                                  
?

のエラーが出ます。

(Slack の general で 2020-09-06 にも報告がありました)

bxjscls、pxjahyper は \AtBegShi@HookFirst! Undefined control sequence. になります。atbegshi パッケージがカーネルに取り込まれた影響でしょうか?

(メモ:pxatbegshi も別のエラーが出たので aminophen/platex-tools@ed3b4e9 で対策しました)

You can't use `\spacefactor' in vertical mode.

Dear ZR 先生,

I am a uplatex user, when I use the latest version of pxjahyper(ver-57866) to do a tate work , the uplatex make a error as follow, when I rollback to pxjahyper(ver-56662) , then nothing to error, please help me, thanks.

(c:/texlive/2020/texmf-dist/tex/platex/pxjahyper/pxjahyper-ajm.def(guessed encoding: UTF-8 = utf8)
! You can't use `\spacefactor' in vertical mode.
\@->\spacefactor
                 \@m {}
l.39 \@
       gobbletwo\if\if \def\pxhy@cond#1\fi{%
?

フォントサイズが 10pt 以外の場合 PDF が白紙になる

\documentclass[10pt, dvipdfmx, uplatex]{jsarticle}
\usepackage{hyperref}
\usepackage{pxjahyper}

\begin{document}
\section{セクション}
本文
\end{document}

上のコードだときちんと出力されますが,フォントサイズを 10pt から 9pt11pt に変えると PDF が白紙になります(ノンブルもなし).

  • uplatex: 3.141592653-p4.0.0-u1.28-220214-2.6
  • jsarticle: 2022/09/13
  • hyperref: 2022-09-22 v7.00t
  • pxjahyper: 2022/05/27

upLaTeXにおける「hyperrefのunicodeオプション」のサポート

経緯

  • hyperrefのunicodeオプションの既定値がtrueに変更された。[v7.00g 2021-02-04]
    • 本来は、unicodeをfalseからtrueに変えても(論理的な)出力は変わらない。
    • ただし、pLaTeX+hyperref+pxjahyperはunicode有効をサポートしないので、この場合は非互換になる。
  • hyperrefのunicodeオプションの既定値がtrueに変更された。[v7.00h 2021-02-10]
    • そこで、pLaTeXにおいてunicodeの既定値がfalseに戻された。
    • upLaTeX+hyperrefについては、pxjahyperはunicodeに“試験的”に対応している状態だった。
    • 従って、upLaTeXでのunicodeの既定値はそのままにされた。
  • そこで、pxjahyperで「upLaTeXでのunicode有効」を正式サポートの扱いとした。[v0.7 2021-02-13]
    • unicode有効のときの不具合がいくつか修正された。

現状の不具合

upLaTeX上で、hyperref(unicodeが既定状態)の読込とpxjahyperの読込の間でPDF文字列を設定するとその文字列が異常になる。hyperrefパッケージのオプションでpdftitleなどを指定する場合などがこれに該当する。2021-02-04以前はこの使い方で正常動作していたので、非互換が発生している。

\documentclass[uplatex,dvipdfmx,a4paper]{jsarticle}
\usepackage[pdftitle={タイトルが化ける}]{hyperref}
\usepackage{pxjahyper}
\begin{document}
\section{しおりは正常}
\end{document}
  • つまり、現状のpxjahyperは「“間”でのPDF文字列の設定」に対応できていない。
    • そもそもpxjahyperを読み込む前の動作なので、pxjahyperの側で対応するのが困難。
  • 2021-02-04以前は既定でunicodeがfalseだったので正常動作していた。現状でもunicode=falseを明示指定すると正常になる。

対策案

hyperrefの側で、次の2つのうちいずれかの対策を施してもらう必要がある。

  1. upLaTeXの場合もunicodeの既定値をfalseにする。
    • 完全に2021-02-04以前の状態に戻る。
  2. upLaTeXの場合も「PDF文字列のUnicode変換処理」を有効にする。
    • 現状のhyperrefではXeTeX/LuaTeXの場合に「PDF文字列のUnicode変換処理」が有効になる。pdfTeXでは無効になる。そしてpTeX/upTeXでも無効になる。
    • 現状のpxjahyperではパッチをあてることで無理やり有効にしている。なので、pxjahyper読込前は失敗する。
    • 私見では、将来的にこちらの方が望ましいと思う。

問題

1と2のどちらを採用すべきか。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.