brucemiller/LaTeXML

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.

hyperref.sty.ltxml throws error for \url containing underscores in \footnote #992

Closed
opened this Issue May 8, 2018 · 4 comments

Projects
None yet
3 participants

siegfriedzoetzsche commented May 8, 2018 • edited by dginev

 LaTeXML throws an Error:unexpected:_ Script _ can only appear in math mode  for  \documentclass{article} \usepackage{hyperref} \begin{document} \footnote{\url{url.with.under_score}} \end{document} but does not complain about  \documentclass{article} \usepackage{hyperref} \begin{document} \url{url.with.under_score} \footnote{\url{url.without.underscore}} \end{document} or  \documentclass{article} \usepackage{url} \begin{document} \footnote{\url{url.with.under_score}} \end{document} Despite the error message, LaTeXML seems to produce correct output.

Collaborator

dginev commented May 8, 2018

 Indeed, it seems that the hyperref binding keeps underscores as is? @brucemiller may know more, the relevant line is: my @toks = map { (((($cc =$_->getCatcode) == CC_CS) || ($cc == CC_SUB)) ?$_ : T_OTHER(ToString($_))) }$url->unlist; Thanks for the report and the pointed examples!
Collaborator

dginev commented May 8, 2018

 I have recently seen an increase with these Error:unexpected:_ Script _ can only appear in math mode  errors while testing over recent batches of papers from arXiv, so a fix here may be an easy win for improving the statistics there.
Owner

brucemiller commented May 10, 2018

 Curious... that's part of it, but url.sty and hyperref.sty differ slightly, and the above doesn't quite capture the difference. I'll have to create some good tests (and testcases!)
Owner

brucemiller commented May 10, 2018

 Boy, once I started digging and comparing url & hyperref, and trying out tests, it got a bit messier. hyperref expands, url doesn't, which carries with it a few peculiarities. I think I've got it sorted out and added a couple of more thorough test cases. Thanks for the report! (and hopefully it'll help arXiv as well :> )

brucemiller closed this May 10, 2018

to join this conversation on GitHub. Already have an account? Sign in to comment