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

与 newtxmath 合用时 \url 中包含 _ 可能报错 double subscript #42

Closed
muzimuzhi opened this issue Sep 21, 2019 · 1 comment
Closed

Comments

@muzimuzhi
Copy link
Contributor

编译环境

宏包版本:gbt7714 v1.1.1
标注样式:所有

描述问题

gbt7714 在与修改了 _ catcode 的宏包(例如 newtxmath)共用时,一定条件下 \url 里直接使用 _ 会报 Double subscript 的错误。

最小例

\documentclass{article}
\usepackage{newtxmath}
\usepackage{gbt7714}

\begin{document}
\url{https://www.abc.com/xx-_xx}
\end{document}

报错信息

! Double subscript.
\s@@b@ #1->\sb 
               {\futurelet \next \sb@ #1}
l.6 \url{https://www.abc.com/xx-_xx}
                                    
I treat `x_1_2' essentially like `x_1{}_2'.

已作的尝试

\UrlBreaks 包含 \do\_ 后,问题修复。目前,

  • url 宏包中 \UrlBreaks 非空且包含 \do\_
  • gbt7714 重定义 \UrlBreaks 后,其中不再包含 \do\_

补充

  • 因为 url 包定义的 \UrlBreaks 非空,可以考虑改重定义 \def\UrlBreaks 为 append list \g@addto@macro\UrlBreaks
  • gbt7714 的这部分代码源自 xurl 包,待问题和修复方式确认后, 也应报给 xurl 的维护者

相关源码段

https://github.com/CTeX-org/gbt7714-bibtex-style/blob/1b3ee5c529516c788a9d51538ab5f0a52f47abd4/gbt7714.dtx#L645-L652

@muzimuzhi muzimuzhi changed the title \UrlBreaks 缺失 \do\_,与 newtxmath 合用时报错 double subscript 与 newtxmath 合用时 \url 中包含 _ 可能报错 double subscript Sep 21, 2019
@zepinglee
Copy link
Owner

这……确实会有问题,我当时是直接 copy xurl 的代码

zepinglee added a commit that referenced this issue Sep 30, 2019
zepinglee added a commit that referenced this issue Sep 30, 2019
zepinglee added a commit that referenced this issue Sep 30, 2019
zepinglee added a commit that referenced this issue Nov 20, 2019
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

2 participants