Skip to content

LaTeX in titles is wrongly escaped #2135

@michamos

Description

@michamos

While trying to improve handling of LaTeX in arXiv titles in INSPIRE (which are basically unstructured strings and might or might not contain LaTeX macros, which is problematic when wanting to make sense of them in BibTeX/LaTeX citation snippets), I checked how you're doing things, and noticed that you're wrongly escaping backslashes, producing invalid LaTeX.

Apologies if this is not the right place to report this bug, I know nothing about your architecture and this repo seemed the most active.

Expected Behavior

bibtex would contain something like

title = "{Measurement of the $\Sigma$ beam asymmetry for the $\omega$ photo-production off the proton and the neutron at GRAAL}"

in order to get a compilable title (Greek letters are not allowed outside of math mode by default). That's very hard to achieve as you'd need to somehow interpret the title. A valid fix to your current approach would be

title = "{Measurement of the \textbackslash{}Sigma\textbackslash{} beam asymmetry for the \textbackslash{}omega\textbackslash{} photo-production off the proton and the neutron at GRAAL}"

Note the addition of {} after the inserted macros to make sure they're not glued to the next word and spaces after the macro don't get swallowed.

Actual Behavior

bibtex output contains

title = "{Measurement of the \textbackslashSigma\textbackslash beam asymmetry for the \textbackslashomega\textbackslash photo-production off the proton and the neutron at GRAAL}"

but \textbackslashSigma is not a valid macro, and \textbackslash beam eats the space, producing \beam in the output.

Steps to Reproduce

Go to https://ui.adsabs.harvard.edu/abs/2013arXiv1306.5943V/exportcitation and look at the title in the bibtex snippet.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions