3

I'm new to Latex and related topics but I'm learning quickly and really loving it.

I'm taking a crack at adapting my CV to Dario Taraborelli's cvtex template for XeTex, and while I've gotten it to render (and quite beautifully, I should add - cheers to DT), it's behaving a unusually with regard to things like ampersands. Typing \& renders the character Ș, which I'd prefer not to have.

I'm using TexMaker and MikTex in Windows 10 to do all this, and within TexMaker I have this setup for compiling/rendering:

enter image description here

Because I'm such a novice, I'll also tell you that what I'm doing is first clicking the arrow on the left, waiting for it to finish without errors, and then clicking the arrow on the right to see my pdf.

Here's some hopefully reproducible code for you, much of which is untouched material from the original cvtex template:

\documentclass[10pt]{article}
\usepackage{fontspec}

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

\usepackage[usenames,dvipsnames]{color}
\usepackage{xunicode}
\usepackage{xltxtra}
\defaultfontfeatures{Mapping=tex-text}
\setromanfont{Adobe Garamond Pro}
\setmonofont[Scale=0.8]{Adobe Garamond Pro}

\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]}}}

\usepackage{marginnote}
\newcommand{\amper{}}{\chardef\amper="E0BD }
\newcommand{\years}[1]{\marginnote{\scriptsize #1}}
\renewcommand*{\raggedleftmarginnote}{}
\setlength{\marginparsep}{7pt}
\reversemarginpar

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

\usepackage[driverfallback=dvipdfm, bookmarks, colorlinks, breaklinks,
    pdftitle={Albert Einstein - vita},
    pdfauthor={My name},
    pdfproducer={http://nitens.org/taraborelli/cvtex}
]{hyperref}  
\hypersetup{linkcolor=blue,citecolor=blue,filecolor=black,urlcolor=MidnightBlue} `
`\begin{document}
Food \& Drug Administration \\
\end{document}

Any idea what could be happening here? (I've done a pretty thorough check of previous se/tex posts for anything similar, but I couldn't find anything. If I've missed something obvious, I apologize.)

  • 2
    Welcome to TeX.SX! Try removing \chardef\&="E050 from the preamble. – Ruixi Zhang Jan 31 at 21:04
  • YOU LEGEND! YOU MYTH! That worked! I can't thank you enough, Ruixi Zhang! You want to move that over to an answer, or shall I do so myself? – logjammin Jan 31 at 21:07
  • 2
    And remove also xunicode and xltxtra. – Ulrike Fischer Jan 31 at 21:10
  • @UlrikeFischer oh interesting! Why, exactly? What are those things doing? (No need to respond if too time-consuming, happy to poke around myself!) – logjammin Jan 31 at 21:13
  • they were needed in the past, but nowadays the stuff is in the latex kernel and in fontspec. – Ulrike Fischer Jan 31 at 21:15
3

According to http://nitens.org/taraborelli/cvtex and https://github.com/dartar/cvtex, the cvtex “template” has not been updated for more than 8 years (and judging by this issue I’d argue that it has not been maintained for over 6 years). During this period, fontspec no longer depended on xunicode and the alike. So you may safely remove those from the preamble as @UlrikeFischer commented.

Now, to address your specific question. The problematic line is this:

\chardef\&="E050

under the CUSTOM COMMANDS section of the preamble. I can only assume that the original author didn’t like how the default ampersand looked like in Adobe Garamond Pro, so he decided to use one of its alternative glyph ("E050 is in the private use area). There is another line:

\newcommand{\amper{}}{\chardef\amper="E0BD }

You should erase these two lines from existence ;-) Nowadays, you should select alternative glyph using advanced features of fontspec. See, for instance, the subsection titled “Character Variants” of the fontspec manual.

BTW, \setromanfont{Adobe Garamond Pro} is depreciated. Use \setmainfont{Adobe Garamond Pro} instead.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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