jupyterlab-citation-manager icon indicating copy to clipboard operation
jupyterlab-citation-manager copied to clipboard

Exporting citations as Latex source code doesn't escape ampersand characters

Open bsdz opened this issue 2 years ago • 0 comments

This seemed to work for a while but then started causing issues. I've created a raw cell with latex raw nbconvert output and i can see new references appearing in this cell when I add a citation. When I try to run pdflatex on the generated tex source code I get errors like "Misplaced alignment tab character &. Foo, B. A., &". If I manually escape the ampersands then pdflatex compiles successfully. Not sure why it was working for a while then stopped.

Edit: Since I export my notebook to tex using a cell command with nbconvert, I've appended the following as a workaround:

!jupyter nbconvert notebook.ipynb --to latex --no-prompt
!sed -i -e '/\\bibitem/{n;s/\([&_]\)/\\\1/g}' notebook.tex 

Edit2: This also appears to affect underscores too. So I've updated my workaround snippet to reflect that.

bsdz avatar Jan 03 '23 19:01 bsdz