Overzealous escaping of backslash
Issue #118
new
Reading and writing to file (at least with the default mechanisms) does not produce a transparent result (it should). The following Python
from pybtex.database.input import bibtex
bib_data = bibtex.Parser().parse_file('some_file_in.bib')
bib_data.to_file('some_file_out.bib')
...does not produce an output that is equivalent to the input for how latex bibliographic tools later handle the file. (That the file is not the same is not a problem, but there are latex-syntax errors.)
In my particular case I fed
% 'some_file_in'
@misc{Speth.2016,
abstract = {},
author = {Speth, Raymond L.},
year = {2016},
title = {adiabatic{\_}flame.py},
url = {http://cantera.org/docs/sphinx/html/cython/examples/onedim_adiabatic_flame.html}
}
and the output is
% 'some_file_out'
@misc{Speth.2016,
author = "Speth, Raymond L.",
abstract = "",
year = "2016",
title = "adiabatic{\\_}flame.py",
url = "http://cantera.org/docs/sphinx/html/cython/examples/onedim\_adiabatic\_flame.html"
}
Notice the title field; later on, {\_} is not parsed correctly by my lualatex/biber combination.
Comments (2)
-
-
Is it possible to extend the bibtex writer with an option “no-decode” (or similar)? Then the user might decide what to do, when calling
database.to_string(...)
- Log in to comment
I needed this when trying to reconstruct a bib file by merging subsets from other bib files. I managed by commenting out the ulatex encoding in …output.bibtex.py
Not satisfactory, but did the job.