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 try to get out of a 3 days trouble, hope for your help !

I just want to find my bibliography in my font without bug...

I'm using \documentclass{scrbook}, & {Adobe Garamond Pro} font with \fontspec for writing my thesis, but I have a problem with my bibtex bibliography : two ways.

  1. when I compile xelatex-biblatex-xelatex, \printbibliography is done, it's printed in a font I don't know (may be a original font of Latex),
  2. and after if I try to force my {Adobe Garamond Pro} font with \renewcommand*{\bibfont}{\fontspec{Adobe Garamond Pro}}
  3. or with \newfontfamily\normalfont{Adobe Garamond Pro},

when I compile xelatex-biblatex-xelatex, come a lot of "Missing \endcsname inserted. \char"

Of course, I use accents in my Biblio.bib because my literacy is in french & I work with the Papers2 bibliography application…

I don't know if I have to search in any direction :

  • why \bibfont \natbibor \bibtex didn't accept accents ?
  • may \frenchbof \babel have a solution with a \frenchbsetup? I don't think
  • or in \fontenc or \fontspecdirections

Please help. Thanks

That's my config :

\documentclass[12pt]{scrbook}
    \addtokomafont{disposition}{\vfamily}
    \addtokomafont{pageheadfoot}{\vfamily}      
    \addtokomafont{pagenumber}{\vfamily\small}  
    \addtokomafont{footnote}{\vfamily}              
\usepackage{fontspec}                           
\usepackage[T1]{fontenc}                        
\usepackage{xltxtra}                            
    \newfontfamily\vfamily{Adobe Garamond Pro}
%   \newfontfamily\normalfont{Adobe Garamond Pro} % or point 3
\usepackage{xunicode}                           
\usepackage[applemac]{inputenc}             
\usepackage{lmodern, textcomp}          
\usepackage[english,frenchb]{babel}             
    \frenchbsetup{FrenchFootnotes=false}    
\usepackage[babel,french=guillemets*]{csquotes}
    \MakeOuterQuote{"}                          
    \frenchspacing                                  
    \usepackage[automark]{scrpage2}
\usepackage{lipsum}                         
\usepackage[natbib=true,style=authortitle-icomp,doi=false]{biblatex}
    \addbibresource{Biblio.bib}
    \AtBeginBibliography{\def\UrlFont{\\\scriptsize}}                       
%\renewcommand*{\bibfont}{\normalfont}  % point 2    

\begin{document}
\fontspec{Adobe Garamond Pro}
\lipsum[1]\footcite[13]{Deotte:1993ve}\lipsum[2]\footcite[13]{Ricoeur:2000ga}
\printbibliography % point 1
\end{document}

And my Biblio.bib

@article{Ricoeur:2000ga,
author = {Ric{\oe}ur, Paul}, % I know that the problem is here :s
title = {{L'{\'e}criture de l'histoire et la repr{\'e}sentation du pass{\'e}}},
journal = {ahess},
year = {2000},
volume = {55},
number = {4},
pages = {731--747},
doi = {10.3406/ahess.2000.279877},
rating = {0},
date-added = {2014-01-29T09:45:37GMT},
date-modified = {2014-01-29T09:46:30GMT},
url = {http://www.persee.fr/web/revues/home/prescript/article/ahess_0395-       2649_2000_num_55_4_279877},
uri = {\url{papers2://publication/doi/10.3406/ahess.2000.279877}}
}

@book{Deotte:1993ve,
author = {D{\'e}otte, Jean-Louis},
title = {{Le mus{\'e}e, l'origine de l'esth{\'e}tique}},
publisher = {L'Harmattan},
year = {1993},
address = {Paris},
language = {fran{\c c}ais},
rating = {0},
date-added = {2013-07-08T22:13:04GMT},
date-modified = {2014-01-29T10:03:20GMT},
uri = {\url{papers2://publication/uuid/4A77F971-C505-4B1A-AB84-6647B00EAAF0}}
}
share|improve this question
1  
When using Xe(La)TeX or Lua(La)TeX you should use utf as inputencoding (tough not loading package inputenc) and drop the loading of package fontenc as fontspec does the right thing for you. –  Johannes_B Jan 31 at 18:38
    
Is your .bib file utf8-encoded? Do you use bibtex or biber? On advantage of biber, among many others, is that it understands utf8. –  Bernard Jan 31 at 18:47
    
BTW: Not everyone has commercial fonts like Adobe Garamond, but testing your example with TeX Gyre Heros or Pagella works just fine. (all files utf8-encoded and using biber) –  Johannes_B Jan 31 at 18:49
1  
Added: utf8 is the recommended way these days: it will be read on any system without a problem. Also, delete any mention of inputenc & xunicode since you compile with xelatex, and fontenc since you use an opentype font. Why do you load lmodern ? –  Bernard Jan 31 at 18:56
    
thank @Bernard & @Johannes_B for your help. I used bibtex but I'm migrating to biberaccording yours advices. For answer yours questions : - I don't know my .bib encoding, but now I try [bibencoding=utf8]{biblatex} to attempt respond to your recommendations ;). I don't know why I use lmodern, is it outdated ? I suppose. –  Zouib Feb 2 at 10:32
show 1 more comment

1 Answer 1

up vote 4 down vote accepted

You're misusing XeLaTeX. Your files must be saved as UTF-8 (well, it's possible to have other encodings, but it's definitely not recommended).

The inputenc package mustn't be loaded; fontenc may, but in your case it's completely useless. Don't load lmodern, which is not tailored for XeLaTeX. Also textcomp is generally useless with XeLaTeX. Finally, xunicode shouldn't be called for (but it's not a problem, because it's already loaded by fontspec). Use xltxtra only if you need its features.

Moreover, the main font should be declared with \setmainfont. Defining \normalfont as a font family is wrong. After using \setmainfont you can use \normalfont for returning to a "clean state", as I did in the \addtokomafont. You can use\rmfamily`, instead, if you just don't want the default sans serif font that's used by default in section titles, but you want to keep boldface.

Avoid direct calls of \fontspec.

Here's a polished version of your document. The filecontents* environment and \addbibresource{\jobname.bib} are just for making the example selfcontained. Use \addbibresource{Biblio.bib} in your document. Finally, since I don't have the font you want, I changed it, but you find the good call commented out.

\begin{filecontents*}{\jobname.bib}
@article{Ricoeur:2000ga,
author = {Ric{\oe}ur, Paul}, % I know that the problem is here :s
title = {{L'{\'e}criture de l'histoire et la repr{\'e}sentation du pass{\'e}}},
journal = {ahess},
year = {2000},
volume = {55},
number = {4},
pages = {731--747},
doi = {10.3406/ahess.2000.279877},
rating = {0},
date-added = {2014-01-29T09:45:37GMT},
date-modified = {2014-01-29T09:46:30GMT},
url = {http://www.persee.fr/web/revues/home/prescript/article/ahess_0395-2649_2000_num_55_4_279877},
uri = {\url{papers2://publication/doi/10.3406/ahess.2000.279877}}
}

@book{Deotte:1993ve,
author = {D{\'e}otte, Jean-Louis},
title = {{Le mus{\'e}e, l'origine de l'esth{\'e}tique}},
publisher = {L'Harmattan},
year = {1993},
address = {Paris},
language = {fran{\c c}ais},
rating = {0},
date-added = {2013-07-08T22:13:04GMT},
date-modified = {2014-01-29T10:03:20GMT},
uri = {\url{papers2://publication/uuid/4A77F971-C505-4B1A-AB84-6647B00EAAF0}}
}
\end{filecontents*}

\documentclass[12pt]{scrbook}

\usepackage[english,frenchb]{babel}
\usepackage{fontspec}

\usepackage[automark]{scrpage2}
\usepackage[babel,french=guillemets*]{csquotes}
\usepackage[natbib=true,style=authortitle-icomp,doi=false]{biblatex}

\usepackage{lipsum}                         

\frenchbsetup{FrenchFootnotes=false}
\MakeOuterQuote{"}
%\frenchspacing % already done by French

%\setmainfont{Adobe Garamond Pro} % I don't have it
\setmainfont{Linux Libertine O}

\addtokomafont{disposition}{\normalfont}
\addtokomafont{pageheadfoot}{\normalfont}
\addtokomafont{pagenumber}{\normalfont\small}
\addtokomafont{footnote}{\normalfont}

\addbibresource{\jobname.bib}
\AtBeginBibliography{\def\UrlFont{\\\scriptsize}}                       

\begin{document}

\lipsum[1]\footcite[13]{Deotte:1993ve}\lipsum[2]\footcite[13]{Ricoeur:2000ga}

\printbibliography % point 1

\end{document}

Here's a picture of the bibliography that I got after running Biber.

enter image description here


With TeXShop it's easy to change the encoding of a file: don't touch the general preferences, but simply add at the beginning of the file the line

% !TEX encoding = UTF-8 Unicode

Close and reopen the file. It should work correctly.

share|improve this answer
    
Thanks a lot @egreg. I cleaned my code according to your advices, but the problem persists (missing endcsname inserted... \char). I'm installing biber and the new version of biblatex (& At the same time I discovered Tex Live Utility that I update) & after, it should run… After your cleaning, I returned to [applemac]{inputenc} for accents in my text & title… I try with biber & I tell you how it happened. –  Zouib Feb 2 at 10:20
    
Ok, I try with biber & biblatex updated, it's perfect without applemac{inputenc}: no error message, all right. But, in my really text (how isn't really lipsum) my french accents aren't recognized... What package could replace my old friend applemac{imputenc} ? –  Zouib Feb 2 at 23:49
1  
@Zouib You must choose UTF-8 as encoding for your document. What editor are you using? –  egreg Feb 2 at 23:55
    
Dear @egreg in my preferences->general TexShop, I used the encodage Latin 1. I change this morning to UTF-8… but I imagine that in preferences->composition I have to change something (because it don't change anything when I compose). Sorry, I'm so newbie… –  Zouib Feb 3 at 11:44
1  
@Zouib I'll add to my answer how you can do. –  egreg Feb 3 at 12:18
show 4 more comments

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.