It produces the error:
invalid token near line 19351 (text was '\')
/tmp/YNw9oayY5k/nat-sci.bib_14227.utf8, line 19351, syntax error:
found "Grady1988", expected ","
WARN - Entry O does not parse correctly: skipping
When I also edit the key in the bibtex file manually to read
@INBOOK{O\'Grady.... I get the same error.
I create bibtex files with jabref. When I escape the apostrophe in
jabref's author field, it shows up in bibtex author field but the key
remains bibtex @INBOOK{O'Grady....
What is the proper way to escape an apostrophe?
Haines Brown
I have never had to do that. I have lots of Irish names in author and
editor fields in my .bib files without escaping anything.
But never put apostrophes in key values. Stick to alphanumerics.
///Peter
is this true 'now'? (with biber..?). i still use bibtex(8), and you
certainly don't want to do that, which is read as if you were trying
to put an accent over the 'G' (e.g., Ǵ --- which you should do by
enclosing it in braces --> {\'G}). the line ---
author = {O'Grady, Richard},
--- should work fine as part of a .bib entry.
otherwise, you're going to need to post a minimal example.
cheers,
jon.
> On 28/08/11 22:12, Haines Brown wrote:
>> I understand that now the apostrophe must be escaped, and so in bibtex
>> author field I put, for example, {Richard O\'Grady ...
> I have never had to do that. I have lots of Irish names in author and
> editor fields in my .bib files without escaping anything.
Yes, but still get error. Here is the bibtex:
@INBOOK{O'Grady1988,
author = {Richard T. O'Grady and Daniel R. Brooks},
editor = {Bruce Weber and et al. and Bruce Weber and et al.},
...
When I run biber on the file I get:
invalid token near line 19351 (text was ''')
/tmp/sNs7Ganmc8/nat-sci.bib_32235.utf8, line 19351,
syntax error: found "rady1988", expected ","
I understood this to mean that biber gagged on the apostrophe because it
is an invalid token. Does this imply it needs to be escaped? I also
tried {O'Grady1988}, but that didn't help.
When I run latex on the file after running biber on it, I get:
LaTeX Warning: Citation 'O'Grady1988' on page 1 undefined on
input line 65.
Line 65 of my .tex file is:
... \cite{O'Grady1988}.
When I run xdvi on the .dvi file, O'Grady key for some reason is
highlighted, but not the other keys in the file. This citation does not
appear in the list of References.
The .log file tells me that:
...
Package biblatex Info: No input encoding detected.
(biblatex) Assuming 'ascii'.
Package biblatex Info: Automatic encoding selection.
(biblatex) Assuming data encoding 'ascii'.
\openout3 = `test-biber.bcf'.
...
LaTeX Warning: Citation 'O'Grady1988' on page 1 undefined on
input line 65.
Since you never had to do anything about apostophes in the author names,
I should mention my version of TeXLive, which is 20110822. I'm running
Debian Squeeze, and I'm issuing the commands in a terminal. I'm using
package csquotes.
Haines Brown
Just don't use the apostrophe in the key:
@INBOOK{OGrady1988,
author = {Richard T. O'Grady and Daniel R. Brooks},
editor = {Bruce Weber and et al. and Bruce Weber and et al.},
and \cite{OGrady1988}. The key is an arbitrary string, but special
characters should be avoided. I didn't know biber doesn't like '.
Ciao
Enrico
Thanks, simply removing the apostrophe from the key value works. It
makes no difference if there is an apostrophe in the author's name. I
find that I must escape # and = anywhere in the record, but not an
apostrophe.
Haines Brown
yeah, i misread your post. i didn't notice it was about the key,
rather than simply some of the fields. (i do the same thing with the
keys, only i use all lowercase, and disambiguate keys where necessary
with the same last name and year by adding the first letters of the
first few words of the article/book/etc. titles. it makes it easy to
find them with auctex.)
on the plus side, it made me (finally) try out biber!
cheers,
jon.
No, what I said was, never have apostrophes in the key value.
@inbook{ogrady1988,
will work.
///Peter
Thanks, Peter. By trial and error I came to realize that. I have found
the situation to be a bit complex (different rules for bibtex key, for
author and for rest of fields), and the only guidance I've been able to
find, http://www.bibtex.org/SpecialSymbols/ may be incomplete and in one
case may not work. Can you recommend a reference the covers escaped
characters in bibtex?
Haines
I think you are misunderstanding the nature of data. It's not actually
very complex: it uses a common way of working that computing has been
using for decades. Unfortunately, if you haven't been exposed to working
with data before, you won't have come across the rules.
KEYS (in the sense of the BiBTeX key) are traditionally only ever single
words using letters, digits, and the period or hyphen. This applies to
many systems, and has nothing to do with BiBTeX or fields, although some
systems do allow a greater range of characters (BiBTeX allows a colon,
for example). There is a good reason for restricting this: it makes
programs easier to write, and makes identifying the data less prone to
error. There is nowadays a good case to be made in many circumstances
for changing this and allowing any character, but that raises all kinds
of questions about data reliability, parsing, backward-compatibility,
and identity; right down to how can you possibly quote a key in a
program if it actually contains one of the characters (like " or ') you
are quoting it with.
FIELDS are different. They just contain text. Text can be anything,
subject only to the rules of the language. In BiBTeX that means 7-bit
characters only (ASCII: you may get away with ISO-8859-1, but certainly
not UTF-8), with all accented letters done using the standard TeX
escapes with the letter in curly braces, and any delimiters (eg " and
the curly braces) also escaped.
> and the only guidance I've been able to
> find, http://www.bibtex.org/SpecialSymbols/ may be incomplete and in one
> case may not work. Can you recommend a reference the covers escaped
> characters in bibtex?
That's as good as you'll get online, I think. Most pages talk about the
semantics of the key (should it be short and cryptic and easy to type,
or long and self-explanatory?) rather than the range of characters
allowed. I think that the assumption is that because it's a key,
everyone knows you mustn't use non-alphanumeric characters.
Otherwise, buy the LaTeX Companion (2nd ed) and read section 13.2 "The
BiBTeX database format" which is fairly exhaustive.
///Peter
Haines Brown
Another character that I often put in BibTeX keys and that has never caused
me trouble is the "at sign" @, but I have never made it the first character
of a key. (In case you're curious, I use keys like Jo96 for Jones 1996,
JS96 for Jones and Smith 1996, or J@96 for Jones et al. 1996 to save
keystrokes unless, of course, such short keys could cause ambiguity.)
--
John Harper