Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am trying to use XeLaTeX to produce a document written in Greek that includes both English and Greek bibliography.

i am using for this purpose a combination of xgreek, biblatex packages and biber.

The problem that I have is that xelatex seems to ignore the hyphenation field in the bib. Here is an example of the style file i am using:

\RequirePackage{xltxtra}  % loads fixltx2e, etex, xunicode, fontspec
\RequirePackage{xgreek}   % for greek documents
\RequirePackage[language=greek,backend=biber,
bibencoding=utf8,natbib=true,bibstyle=authoryear,
citestyle=authoryear,babel=hyphen]{biblatex}

and here is an example of the bibliography:

@article{Ritchie_07,
Author = {Bob Ritchie and Esamaddin Khorwatt},
Journal = {The English Accounting Review},
Hyphenation = {english},
Language = {english},
Pages = {39--59},
Title = {The attitude of Libyan auditors to inherent control risk assessment},
Volume = {39},
Year = {2007}}

The problem is that I can have either hyphenation of greek bibliographies and not english, or vice-versa. I can't have both.

I am using MikTeX 2.8. Any feedback will be greatly appreciated

share|improve this question
    
somehow related to this one tex.stackexchange.com/questions/12224/… –  pmav99 May 21 '11 at 13:22

3 Answers 3

up vote 2 down vote accepted

To switch between different languages in the bibliography, biblatex uses babel's or polyglossia's macro \selectlanguage. xgreek seems to be similar to babel and polyglossia, but it doesn't define \selectlanguage.

You can try to put

\RequirePackage{polyglossia}
\newfontfamily\greekfont[Script=Greek]{Gentium} % or other font with support for greek
\setmainlanguage[variant=monotonic]{greek} % variant can be polytonic, monotonic, or ancient 
\setotherlanguage{english} % you need to put here \setotherlanguage for each language that you are using in the bibliography

to your style file instead of xgreek. Study polyglossia manual for more details.


maybe try to remove some unnecessary options of biblatex:

\RequirePackage[
  backend=biber
 ,bibencoding=utf8
 ,natbib=true
 ,style=authoryear
 ,babel=hyphen
]{biblatex}

part of problem was, that you have explicitly set bibliography language to greek.

share|improve this answer
    
I was under the impression that this is what the "hyphenation" tag would actually do in the bib file. (i.e. something similar to the \setotherlanguage). In any case though, I don't think that I can use \setotherlanguage in the bib file (can I?) and I am not keen on editing the bbl file either and manually inserting \setotherlanguage tags. Unless you suggest on using \setotherlanguage at a different place and I did not understand it correctly. –  Nick Papas May 21 '11 at 11:22
    
yes, you didnť understand me correctly. I mean not to put \setotherlanguage into the bib file, but to your style file. I edited my answer, I hope it is now more clear. –  michal.h21 May 21 '11 at 11:39
    
Polyglossia has a slight bug with the greek language. –  pmav99 May 21 '11 at 11:42
    
yes, I got some error messages, that is why there is \newfontfamily\greekfont –  michal.h21 May 21 '11 at 11:46
    
Perhaps another option would be to redefine the \selectlanguage macro but I don't know how it should be done to work without problems. –  pmav99 May 21 '11 at 12:06

A not so clean solution (actually a dirty hack), would be to write a macro and then use it at the text in your *.bib file.

%preamble
\newcommand{\en}[1]{\setlanguage{american}#1\setlanguage{monogreek}}

and then:

Title = {\en{The attitude of Libyan auditors to inherent control risk assessment}},

You can use this macro at your text too. The problem is that if you use something like mendeley to manage bibliographies you 'll have to add it yourself.

ps. I haven't checked it with biblatex, but it works with natbib.

share|improve this answer

As this is a different approach I am posting it in as a seperate answer.

XeLaTeX gives you the ability to define groups of glyphs, and issue commands automatically when you encounter a glyph that belongs to a different group.

Given that the greek glyphs are different from the latin ones, you can group them in seperate character classes. So each time you change classes, you can issue the command \setlanguage in order to load the correct hyphenation rules.

In order to use it, follow these instructions or more simply, save this code at a file named autohyph.sty, place it somewhere LaTeX can find it (in the same folder as your main file) and just give \usepackage{xgreek,autohyph} in your preamble.

Minimum Working Example

\documentclass[a4paper,draft]{article}

% Language declaration
\usepackage{xltxtra,xgreek,lipsum}
\usepackage{autohyph}

% Fonts
\setmainfont[Kerning=On,Mapping=tex-text]{Linux Libertine O}

\begin{document}

\section{Ελληνικά}
Παράγραφος με ελληνικό κείμενο στην οποία γίνονται υφενώσεις. Παράγραφος με ελληνικό κείμενο στην οποία γίνονται υφενώσεις. Παράγραφος με ελληνικό κείμενο στην οποία γίνονται υφενώσεις. Παράγραφος με ελληνικό κείμενο στην οποία γίνονται υφενώσεις. Παράγραφος με ελληνικό κείμενο στην οποία γίνονται υφενώσεις. Παράγραφος με ελληνικό κείμενο στην οποία γίνονται υφενώσεις. Παράγραφος με ελληνικό κείμενο στην οποία γίνονται υφενώσεις. Παράγραφος με ελληνικό κείμενο στην οποία γίνονται υφενώσεις. Παράγραφος με ελληνικό κείμενο στην οποία γίνονται υφενώσεις. Παράγραφος με ελληνικό κείμενο στην οποία γίνονται υφενώσεις. Παράγραφος με ελληνικό κείμενο στην οποία γίνονται υφενώσεις. Παράγραφος με ελληνικό κείμενο στην οποία γίνονται υφενώσεις.

\section{Αγγλικά}
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur dictum gravida mauris. Nam arcu libero, nonummy eget, consectetuer id, vulputate a, magna. Donec vehicula augue eu neque. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Mauris ut leo. Cras viverra metus rhoncus sem. Nulla et lectus vestibulum urna fringilla ultrices. Phasellus eu tellus sit amet tortor gravida placerat. Integer sapien est, iaculis in, pretium quis, viverra ac, nunc. Praesent eget sem vel leo ultrices bibendum. Aenean faucibus. Morbi dolor nulla, malesuada eu, pulvinar at, mollis ac, nulla. Curabitur auctor semper nulla. Donec varius orci eget risus. Duis nibh mi, congue eu, accumsan eleifend, sagiis quis, diam. Duis eget orci sit amet orci dignissim rutrum.

\end{document}

More info can be found at Apostolos Syropoulos Book Ψηφιακή Τυπογραφία με το XeLaTeX section 9.4 (in greek) and at XeTeX referece file at pages 13-14.

Notes

  1. I checked it for monotonic greek only. It shouldn't be too difficult to make it work with polytonic and ancient greek.
  2. This approach works only for languages that use different scripts (i.e Greek, Latin, Cyrillic etc)
  3. Instead of english, it can be used for any other language that uses the latin alphabet, but not for two of them at the same time.
  4. As far as I checked, everything works ok. Needs more testing though
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.