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.

When I try to build Dario Taraborelli's CV example using fontspec font designations and Linux Libertine O, the ampersand glyph breaks. Here is the MWE:

%------------------------------------
% Dario Taraborelli
% Typesetting your academic CV in LaTeX
%
% URL: http://nitens.org/taraborelli/cvtex
% DISCLAIMER: This template is provided for free and without any guarantee 
% that it will correctly compile on your system if you have a non-standard  
% configuration.
% Some rights reserved: http://creativecommons.org/licenses/by-sa/3.0/
%------------------------------------

%!TEX TS-program = xelatex
%!TEX encoding = UTF-8 Unicode

\documentclass[10pt, a4paper]{article}
%\documentclass[10pt, a4paper]{scrartcl}

% DOCUMENT LAYOUT
\usepackage{geometry} 
\geometry{a4paper, textwidth=5.5in, textheight=8.5in, marginparsep=7pt, marginparwidth=.6in}
\setlength\parindent{0in}

% FONTS
\usepackage[usenames,dvipsnames]{color}
\usepackage{xunicode}
\usepackage{xltxtra}
\defaultfontfeatures{Mapping=tex-text}
\setromanfont [Ligatures={Common}, Numbers={OldStyle}, Variant=01]{Linux Libertine O}
\setmonofont[Scale=1]{Inconsolata}

% ---- CUSTOM COMMANDS
\chardef\&="E050
\newcommand{\html}[1]{\href{#1}{\scriptsize\textsc{[html]}}}
\newcommand{\pdf}[1]{\href{#1}{\scriptsize\textsc{[pdf]}}}
\newcommand{\doi}[1]{\href{#1}{\scriptsize\textsc{[doi]}}}
% ---- MARGIN YEARS
\usepackage{marginnote}
\newcommand{\amper{}}{\chardef\amper="E0BD }
\newcommand{\years}[1]{\marginnote{\scriptsize #1}}
\renewcommand*{\raggedleftmarginnote}{}
\setlength{\marginparsep}{7pt}
\reversemarginpar

% HEADINGS
\usepackage{sectsty} 
\usepackage[normalem]{ulem} 
\sectionfont{\mdseries\upshape\Large}
\subsectionfont{\mdseries\scshape\normalsize} 
\subsubsectionfont{\mdseries\upshape\large} 

% PDF SETUP
% ---- FILL IN HERE THE DOC TITLE AND AUTHOR
%\usepackage[dvipdfm, bookmarks, colorlinks, breaklinks, 
%% ---- FILL IN HERE THE TITLE AND AUTHOR
%   pdftitle={Albert Einstein - vita},
%   pdfauthor={My name},
%   pdfproducer={http://nitens.org/taraborelli/cvtex}
%]{hyperref}  
\usepackage[bookmarks, colorlinks, breaklinks, 
% ---- FILL IN HERE THE TITLE AND AUTHOR
    pdftitle={Albert Einstein - vita},
    pdfauthor={My name},
    pdfproducer={http://nitens.org/taraborelli/cvtex}
]{hyperref}  
\hypersetup{linkcolor=blue,citecolor=blue,filecolor=black,urlcolor=MidnightBlue} 

% DOCUMENT
\begin{document}

\section*{Grants, honors \& awards}
\noindent
\years{1921}Nobel Prize in Physics, Nobel Foundation

\section*{Publications \& talks}

\end{document}

On my system, the result looks like this:

enter image description here

Now, the obvious answer is that the font doesn't have the glyph, but it should be the same font! If I use \usepackage{libertineotf}, it works, but I would like to use Xelatex for this instead.

share|improve this question
    
What happens if you comment out the instruction \chardef\&="E050, and simplify the \amper macro to \newcommand\amper{\&}? –  Mico Oct 29 '12 at 7:53
    
@Mico: It works this way, but doesn't display the expected glyph. –  Stephen Bosch Oct 29 '12 at 9:13
2  
Also have a look at this answer her. You can load alternative glyphs by default in fontspec. tex.stackexchange.com/a/58185/11984 –  Jörg Oct 29 '12 at 9:23

2 Answers 2

up vote 2 down vote accepted

use it this way:

\documentclass{article}
\usepackage{fontspec}
\defaultfontfeatures{Mapping=tex-text}
\setromanfont [Ligatures={Common}, Numbers={OldStyle}, Variant=01, 
  Extension=.otf]{LinLibertine_R}
\setmonofont[Scale=1]{Inconsolata}

\chardef\&="E050
\begin{document}

\section*{Grants, honors \& awards}
Nobel Prize in Physics, Nobel Foundation

\section*{Publications \& talks}

\end{document}

and as Ulrike already pointed out, use package fontspec instead of the other two

share|improve this answer
    
Don't load xunicode before fontspec or xltxtra! –  Ulrike Fischer Oct 29 '12 at 10:27

Your example is not a MWE. It contains lot of irrelevant stuff. This here works fine for me:

\documentclass{article}
\usepackage{fontspec}
\setmainfont[Ligatures={Common}, Numbers={OldStyle}, Variant=01]{Linux Libertine O}
\chardef\&="E050
\begin{document}
Grants, honors \& awards
^^^^e050, \char"E050
\end{document}

I don't understand why you don't want to use libertineotf (which is meant to be used with xelatex), but if it works with this package and not if you call the font yourself this probably means that you have more than one libertine version – libertineotf calls fonts by file names. Add \XeTeXtracingfonts=1 to your document and check the font pathes in the log file.

Btw: Don't load xunicode before fontspec. This will break the working of the package. In a modern system you don't need to load it at all, fontspec will do it.

share|improve this answer
    
I want to have a consistent interface to fonts and not rely on font-specific packages. –  Stephen Bosch Oct 29 '12 at 9:08
    
Well then look in libertineotf how it loads the fonts and copy the commands. –  Ulrike Fischer Oct 29 '12 at 10:27

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.