racket / racket/scribble

bibtex doesn't handle escapes properly

Open
#266 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Racket
Stars
250
Forks
102
Avg merge
11d 11h
Merged PRs (30d)
1

Description

There are three kinds of mishandled escapes below:

  • bibtex escapes:
    • escaping # when it appears in a string \#. The \ gets rendered as a URL escape character, but should have been ignored.
    • escaping capital letters {CPS}. This escapes gets rendered as capital but eats the whitespace following it.
  • latex such as {\"u} and {$\Sigma$}.

I suppose handling the latex escapes is non-trivial, but the bibtex escapes should probably be handled properly. Could possibly handle the latex escapes by passing them on as literal, and assuming the backend knows how to handle them.

#lang scribble/base
@(require
  racket/dict
  racket/port
  scriblib/bibtex
  scriblib/autobib
  rackunit)

@(require/expose scriblib/bibtex (generate-bib))

@(define mybibs
  (call-with-input-string
     @string-append|{@Article{bowman2018:cps-sigma,
       author   = {Bowman, William J. and Cong, Youyou and Rioux, Nick and Ahmed, Amal},
       title    = {Type-preserving {CPS} Translation of {$\Sigma$} and {$\Pi$} Types Is Not Not Possible},
       url      = {https://www.williamjbowman.com/papers\#cps-sigma},
       journal  = {Proceedings of the {ACM} on Programming Languages},
       year = 2018,
     }

     @Article{flueckiger2018:jit,
       author    = {Fl{\"u}ckiger, Olivier and Scherer, Gabriel and Yee, Ming-Ho and Goel, Aviral and Ahmed, Amal and Vitek, Jan},
       title     = {Correctness of speculative optimizations with dynamic deoptimization},
       year = 2018,
       journal  = {Proceedings of the {ACM} on Programming Languages},
       }}| bibtex-parse))

@(define-cite a~cite acitet generate-bibliography)

@(define (~cite str)
  (a~cite (generate-bib mybibs str)))

@~cite{bowman2018:cps-sigma}
@~cite{flueckiger2018:jit}

@(generate-bibliography)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the supplied scriblib/bibtex example, especially bibtex-parse and the generate-bib entry point, and reproduce the three escape cases. Done means BibTeX escapes no longer encode the URL hash or consume following whitespace, with the LaTeX escape behavior made explicit for the shown inputs.

Written by the indexing model from the issue text.

Assessment

Tech stack
latex
Domain
documentation
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.