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

@<href>{%} causes review-pdfmaker to die #304

Open
dmiyakawa opened this issue Jul 20, 2014 · 3 comments
Open

@<href>{%} causes review-pdfmaker to die #304

dmiyakawa opened this issue Jul 20, 2014 · 3 comments

Comments

@dmiyakawa
Copy link
Contributor

Reproducible with https://github.com/dmiyakawa/hrefpercent

Excerpt:

[1](./hrefpercent.tex
第1章)
Runaway argument?
{
! File ended while scanning use of \T@ref.

\par
l.225 \input{hrefpercent.tex}

?

@takahashim
Copy link
Collaborator

確かにマズイですね。
でも、LaTeXで\ref{%}はもちろん、\ref{\%}もエラーになるのはどうしたものなんですかね…。何かにエスケープすればいいんでしょうか。

ちなみにこれはどういう出力になるのを期待されていましたか?

(ついでに補足しておくと、このファイルは新review-epubmakerでも別の理由(見出しがないから?)でNGみたいです)

@dmiyakawa
Copy link
Contributor Author

ああ…… < 見出しがないから

具体的には、例えば@<href>{%URL%}と(誤って)書かれた際、platexの奥深いところでエラーが出てしまうというのを問題視しています。
原因となる行とのマッチングが取れないのでデバッグが厄介……

また、今回はRe:VIEWの文法レベルではエラーと出来る根拠が見当たりません。
review-compile のHTML出力は黙って出ますし。

#仕様でそういうのがあるのかと想ったのですが、なさそう

そもそもURIとしては"%"単体や"%URL%"自体が誤りです。
というわけで、出力として具体的に「こうでないとだめ><」というのはないです。

なお、ちゃんとしたURI(パーセントエンコーディングのために%が使われるケース)では、どうやら今回のエラーは出ないようです。

@kmuto
Copy link
Owner

kmuto commented Apr 15, 2016

compile_hrefの今の挙動としては、[a-z]+:としていてURIっぽく始まるものはhrefかurlのパッケージにいき、こっちはリテラルに扱われるので問題ない。それ以外の場合は\ref命令に落ちてこっちはTeX解釈になるのでまずい、と。

で実際のところエスケープもできないので、LaTeXBuilderのcompile_href refのところで文字チェックして、URLじゃない形式に%があったらrefにできないよ警告を出しつつ escape(url) な文字列を代替で置いておく、くらいが対処ではないでしょうか。

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

No branches or pull requests

3 participants