使用 utf8 编码和 LaTeX 的参考书目中的希腊语和英语

使用 utf8 编码和 LaTeX 的参考书目中的希腊语和英语

我正在创建一个文档,其主要语言是希腊语。我试图用希腊语和英语两种语言来编写参考书目条目,但没有成功。

我的代码是

\RequirePackage{filecontents}
\begin{filecontents*}{testbib.bib}
@comment Datei testbib.bib

@article{Mayer,
title = "The 11B(p,a)8Be nuclear reaction and 11B(p,p)11B backscattering cross sections for analytical purposes ",
journal = "Nuclear Instruments and Methods in Physics Research Section B: Beam Interactions with Materials and Atoms ",
volume = "143",
number = "3",
pages = "244 - 252",
year = "1998",
note = "",
issn = "0168-583X",
doi = "http://dx.doi.org/10.1016/S0168-583X(98)00383-8",
url = "http://www.sciencedirect.com/science/article/pii/S0168583X98003838",
author = "M. Mayer and A. Annen and W. Jacob and S. Grigull",
language  ="English",
hyphenation="english"
}

@Mastersthesis{Vpaneta,
    author = "Συγγραφέας",
    title  = "Τίτλος",
    year   = "2012",
    month  = "μήνας",
    school = "Κατι",
    language  ="Greek",
    hyphenation="greek"
}
\end{filecontents*}

\documentclass[11pt,a4paper]{book}

\usepackage[english,greek]{babel}
\usepackage[iso-8859-7]{inputenc}
%\usepackage[utf8]{inputenc}
\usepackage{kerkis}
\usepackage{pifont}
\usepackage[unicode]{hyperref}
% \usepackage[bibencoding=auto,backend=biber,babel=other]{biblatex}
% \addbibresource{testbib.bib}

\newcommand{\sw}{\selectlanguage{english}}
\newcommand{\sq}{\selectlanguage{greek}}
\newcommand{\eng}[1]{\latintext#1\greektext}
\newcommand{\gre}[1]{\greektext#1\latintext}

\begin{document}
 \tableofcontents
 \chapter{Κεφάλαιο}
  \section{Ενότητα}
  σδφγηξκλ\cite{Mayer}hgfkhgjfkhgfkhg\cite{Vpaneta}
  \section{Ενότητα}
 \addcontentsline{toc}{chapter}{Βιβλιογραφία}
  \bibliographystyle{plain}
  %\selectlanguage{english}
  \bibliography{testbib}
  %\printbibliography
\end{document}

我最好使用utf8编码,以便在 pdf 查看器中显示希腊语内容。但是,使用utf8编码时无法生成.pdf文件。有错误指出

包 inputenc 错误:Unicode 字符 \u8:��2 未设置为用于 LaTeX

因此我必须使用iso-8859-7编码。请注意,我相应地更改了编辑器的编码。

我该怎么做才能最好地使用utf8编码来创建参考书目并使用两种不同的语言,或者作为最后的解决方案,使用iso-8859-7编码以相同的方式(即使用两种语言)创建参考书目?

我使用iso-8859-7编码的输出是

在此处输入图片描述

当将语言更改为英语时,输出为

在此处输入图片描述

答案1

您不需要使用XeLaTeXbiblatexpdflatex也可以与 一起使用。对于我来说pdflatex,使用、utf8选项和(用于 unicode 书目支持)以及使用和选项(用于字体支持)的软件包,您的示例编译得很好(尽管似乎即使没有 也可以工作):fontencbiblatexbiberfontencT1LGRfontenc

\RequirePackage{filecontents}
\begin{filecontents*}{testbib.bib}

@article{Mayer,
title = "The 11B(p,a)8Be nuclear reaction and 11B(p,p)11B backscattering cross sections for analytical purposes ",
journal = "Nuclear Instruments and Methods in Physics Research Section B: Beam Interactions with Materials and Atoms ",
volume = "143",
number = "3",
pages = "244 - 252",
year = "1998",
note = "",
issn = "0168-583X",
doi = "http://dx.doi.org/10.1016/S0168-583X(98)00383-8",
url = "http://www.sciencedirect.com/science/article/pii/S0168583X98003838",
author = "M. Mayer and A. Annen and W. Jacob and S. Grigull",
language  ="English",
hyphenation="english"
}

@Mastersthesis{Vpaneta,
    author = "Συγγραφέας",
    title  = "Τίτλος",
    year   = "2012",
    month  = "μήνας",
    school = "Κατι",
    language  ="Greek",
    hyphenation="greek"
}
\end{filecontents*}

\documentclass[11pt,a4paper]{book}

\usepackage[english,greek]{babel}
\usepackage[T1,LGR]{fontenc}
\usepackage[utf8]{inputenc}
%\usepackage[utf8]{inputenc}
\usepackage{kerkis}
\usepackage{pifont}
\usepackage[unicode]{hyperref}
 \usepackage[bibencoding=auto,backend=biber,babel=other]{biblatex}
 \addbibresource{testbib.bib}

\newcommand{\sw}{\selectlanguage{english}}
\newcommand{\sq}{\selectlanguage{greek}}
\newcommand{\eng}[1]{\latintext#1\greektext}
\newcommand{\gre}[1]{\greektext#1\latintext}

\begin{document}
 \tableofcontents
 \chapter{Κεφάλαιο}
  \section{Ενότητα}
  σδφγηξκλ\cite{Mayer}hgfkhgjfkhgfkhg\cite{Vpaneta}
  \section{Ενότητα}
 \addcontentsline{toc}{chapter}{Βιβλιογραφία}
 % \bibliographystyle{plain}
  \selectlanguage{english}
  %\bibliography{testbib}
  \printbibliography
\end{document}

编译它

 pdflatex filename.tex
 biber filename
 pdflatex filename.tex

当然,文件filename.tex必须采用utf8编码 在此处输入图片描述

相关内容