First of all, according to the LyX wiki BibTeX can't use UTF-8:
BibTeX does not support files encoded in UTF-8 (i.e., Unicode), which is nowadays the default file encoding on most OSes. The reason is that current BibTeX (v. 0.99c) was released in 1988 and thus predates the advent of unicode. Unless the long-announced BibTeX v. 1.0 or one of the many planned potential successing applications are ready, latin1 (ISO-8859-1) or another 8-bit encoding has to be used for the bib file (this does not affect the LaTeX encoding, which still can be utf8).
Usually, whatever is inside a BibTeX file gets copied verbatim to the LaTeX source code (with some formatting maybe and case changings, &c.), such as book titles, authors, &c.
So your BibTeX file encoding has to match the one used by your LaTeX file, otherwise things get funny. You also can't use babel-provided commands in BibTeX (such as "a for ä, provided by n?german) unless your document includes the right packages.
The canonical way is to make BibTeX files agnostic of any encoding or package issues by always specifying special characters with their appropriate commands.
This basically means that instead of writing ä you would have to use {\" a} if you want to be absolutely sure that it works. Seems to be fairly standard practice.
The BibTeX manual BibTeXing by Oren Patashnik also details this:
BibTeX now handles accented
characters. For example if you have an
entry with the two fields
author = "Kurt G{\"o}del",
year = 1931,
and if you're using the alpha
bibliography style, then BibTeX will
construct the label [Göd31] for this
entry, which is what you'd want. To
get this feature to work you must
place the entire accented character in
braces; in this case either {\"o} or {\"{o}} will do. Furthermore these
braces must not themselves be enclosed
in braces (other than the ones that
might delimit the entire field or the
entire entry); and there must be a
backslash as the very first character
inside the braces. Thus neither {G{\"{o}}del} nor {G\"{o}del} will
work for this example. This feature
handles all the accented characters
and all but the nonbackslashed foreign
symbols found in Tables 3.1 and 3.2 of
the LaTeX book. This feature behaves
similarly for "accents" you might
define; we'll see an example shortly.
For the purposes of counting letters
in labels, BibTeX considers everything
contained inside the braces as a
single letter.
BibTeX has huge problems with non-ASCII characters, even in the newest version. If you prefer a modern system, I'd like to recommend the combination of biblatex and biber. Both are still in beta stage, but they work quite well even in production environments. With this combination, most problems related to LaTeX bibliographies will vanish. As a side note, the biblatex documentation also contains a section about encoding issues with traditional BibTeX (§ 2.4.3).
Bibtex has random support for any non-standard character encodings -- essentially sometimes it works, most of the time it doesn't and officially it is not supported (More details ).
Personally, in .bib, I stick to the basic ASCII and LaTeX magic like \"o. For .tex, if I don't write in English, I keep .tex in UTF-8 with \usepackage[utf8]{inputenc} .
发布评论
评论(4)
首先,根据 LyX wiki BibTeX 不能使用 UTF-8:
通常,BibTeX 文件中的任何内容都会逐字复制到 LaTeX 源代码(可能会进行一些格式设置和大小写更改等),例如书名、作者等。
因此,您的 BibTeX 文件编码必须与您的 LaTeX 文件使用的编码相匹配,否则事情会变得很有趣。你也不能在 BibTeX 中使用 babel 提供的命令(例如 n?german 提供的
"a
forä
),除非你的文档包含正确的包。方法是通过始终使用适当的命令指定特殊字符来使 BibTeX 文件不知道任何编码或包问题。
这基本上意味着您必须使用
ä
而不是。{\" a}
如果您想绝对确定它是否有效。似乎是相当标准的做法。BibTeX 手册BibTeXing Oren Patashnik 也详细介绍了这一点:
First of all, according to the LyX wiki BibTeX can't use UTF-8:
Usually, whatever is inside a BibTeX file gets copied verbatim to the LaTeX source code (with some formatting maybe and case changings, &c.), such as book titles, authors, &c.
So your BibTeX file encoding has to match the one used by your LaTeX file, otherwise things get funny. You also can't use babel-provided commands in BibTeX (such as
"a
forä
, provided by n?german) unless your document includes the right packages.The canonical way is to make BibTeX files agnostic of any encoding or package issues by always specifying special characters with their appropriate commands.
This basically means that instead of writing
ä
you would have to use{\" a}
if you want to be absolutely sure that it works. Seems to be fairly standard practice.The BibTeX manual BibTeXing by Oren Patashnik also details this:
您可以即时更改输入编码:
\inputencoding
命令由inputenc
包提供。You can change the input encoding on the fly:
The
\inputencoding
command is provided by theinputenc
package.即使在最新版本中,BibTeX 在处理非 ASCII 字符时也存在巨大问题。如果您更喜欢现代系统,我想推荐 biblatex 和 biber。两者仍处于测试阶段,但即使在生产环境中它们也能很好地工作。通过这种组合,大多数与 LaTeX 参考书目相关的问题都将消失。作为旁注,biblatex 文档 还包含有关传统 BibTeX 编码问题的部分(第 2.4.3 节)。
BibTeX has huge problems with non-ASCII characters, even in the newest version. If you prefer a modern system, I'd like to recommend the combination of biblatex and biber. Both are still in beta stage, but they work quite well even in production environments. With this combination, most problems related to LaTeX bibliographies will vanish. As a side note, the biblatex documentation also contains a section about encoding issues with traditional BibTeX (§ 2.4.3).
Bibtex 对任何非标准字符编码都有随机支持——本质上有时它可以工作,大多数时候它不能,并且官方不支持它(更多详细信息)。
就我个人而言,在 .bib 中,我坚持基本的 ASCII 和 LaTeX 魔法,如 \"o。对于 .tex,如果我不用英语编写,我会使用 \usepackage[utf8]{inputenc} 将 .tex 保留为 UTF-8 。
Bibtex has random support for any non-standard character encodings -- essentially sometimes it works, most of the time it doesn't and officially it is not supported (More details ).
Personally, in .bib, I stick to the basic ASCII and LaTeX magic like \"o. For .tex, if I don't write in English, I keep .tex in UTF-8 with \usepackage[utf8]{inputenc} .