16

I would like to give XeLaTeX a try. I've been using pdflatex to process the following:

\listfiles

\documentclass{article}

\usepackage[backend=biber]{biblatex}

\usepackage{filecontents}

\AtEveryBibitem{\clearfield{eprintclass}}
\AtEveryBibitem{\clearfield{doiclass}}

\begin{filecontents}{\jobname.bib}


@Article{Aubert:2007sea,
 author    = "Aubert, Bernard and others",
 collaboration = "BABAR",
 title     = "{Evidence for b ---> d gamma Transitions From a Sum of
              Exclusive Final States in the Hadronic Final State Mass
              Range 1.0-GeV/c**2 < M(X(d)) < 1.8-GeV/c**2}",
 year      = "2007",
 eprint    = "0708.1652",
 archivePrefix = "arXiv",
 primaryClass  =  "hep-ex",
 SLACcitation  = "%%CITATION = 0708.1652;%%"
}

@Article{:2010ip,
 author    = "del Amo Sanchez, P. and others",
 collaboration = "BABAR",
 title     = "{Dalitz-plot Analysis of B0 --> D0bar pi+ pi-}",
 journal   = "PoS",
 volume    = "ICHEP2010",
 year      = "2010",
 pages     = "250",
 eprint    = "1007.4464",
 archivePrefix = "arXiv",
 primaryClass  =  "hep-ex",
 SLACcitation  = "%%CITATION = 1007.4464;%%"
}

@Article{delAmoSanchez:2010rq,
 author    = "del Amo Sanchez, P. and others",
 collaboration = "BABAR",
 title     = "{Evidence for direct CP violation in the measurement of the
              Cabibbo-Kobayashi-Maskawa angle gamma with B-+ --> D(*)
              K(*)-+ decays}",
 journal   = "Phys. Rev. Lett.",
 volume    = "105",
 year      = "2010",
 pages     = "121801",
 eprint    = "1005.1096",
 archivePrefix = "arXiv",
 primaryClass  =  "hep-ex",
 doi       = "10.1103/PhysRevLett.105.121801",
 SLACcitation  = "%%CITATION = 1005.1096;%%"
}

@Article{:2008ii,
 author    = "Aubert, Bernard and others",
 collaboration = "BABAR",
 title     = "{Measurement of $|V_cb|$ and the form-factor slope for
              $\bar{B} \to D \ell^- \bar{\nu}_\ell$ decays on the recoil
              of fully reconstructed $B$ mesons}",
 year      = "2008",
 eprint    = "0807.4978",
 archivePrefix = "arXiv",
 primaryClass  =  "hep-ex",
 SLACcitation  = "%%CITATION = 0807.4978;%%"
}

@Article{:2008if,
 author    = "Aubert, Bernard and others",
 collaboration = "BABAR",
 title     = "{Measurements of ${\cal B}(\bar{B}^0 \to \Lambda_{c}^{+}
              \bar{p})$ and ${\cal B}(B^- \to \Lambda_{c}^{+} \bar{p}
              \pi^-)$ and Studies of $\Lambda_{c}^{+}\pi^-$ Resonances}",
 journal   = "Phys. Rev.",
 volume    = "D78",
 year      = "2008",
 pages     = "112003",
 eprint    = "0807.4974",
 archivePrefix = "arXiv",
 primaryClass  =  "hep-ex",
 doi       = "10.1103/PhysRevD.78.112003",
 SLACcitation  = "%%CITATION = 0807.4974;%%"
}

@Article{Aubert:2008zh,
 author    = "Aubert, Bernard and others",
 collaboration = "BABAR",
 title     = "{Measurement of D0 - anti-D0 mixing from a time-dependent
              amplitude analysis of D0 ---> K+ pi- pi0 decays}",
 journal   = "Phys. Rev. Lett.",
 volume    = "103",
 year      = "2009",
 pages     = "211801",
 eprint    = "0807.4544",
 archivePrefix = "arXiv",
 primaryClass  =  "hep-ex",
 doi       = "10.1103/PhysRevLett.103.211801",
 SLACcitation  = "%%CITATION = 0807.4544;%%"
}

@Article{Aubert:2008sb,
 author    = "Aubert, Bernard and others",
 collaboration = "BABAR",
 title     = "{Measurement of CP Asymmetries and Branching Fractions in
              B0 -> ---> pi+ pi-, B0 ---> K+ pi-, B0 ---> pi0 pi0, B0 ---
              > K0 pi0 and Isospin Analysis of B ---> pi pi Decays}",
 year      = "2008",
 eprint    = "0807.4226",
 archivePrefix = "arXiv",
 primaryClass  =  "hep-ex",
 SLACcitation  = "%%CITATION = 0807.4226;%%"
}

@Article{Aubert:2008ri,
 author    = "Aubert, Bernard and others",
 collaboration = "BABAR",
 title     = "{Search for B+ ---> mu+ nu mu with inclusive reconstruction
              at BaBar}",
 year      = "2008",
 eprint    = "0807.4187",
 archivePrefix = "arXiv",
 primaryClass  =  "hep-ex",
 SLACcitation  = "%%CITATION = 0807.4187;%%"
}

@Article{Aubert:2008ps,
 author    = "Aubert, Bernard and others",
 collaboration = "BABAR",
 title     = "{Direct CP, Lepton Flavor and Isospin Asymmetries in the
              Decays B ---> K(*) l+ l-}",
 journal   = "Phys. Rev. Lett.",
 volume    = "102",
 year      = "2009",
 pages     = "091803",
 eprint    = "0807.4119",
 archivePrefix = "arXiv",
 primaryClass  =  "hep-ex",
 doi       = "10.1103/PhysRevLett.102.091803",
 SLACcitation  = "%%CITATION = 0807.4119;%%"
}

@Article{Aubert:2008fq,
 author    = "Aubert, Bernard and others",
 collaboration = "BaBar",
 title     = "{Searches for B meson decays to phiphi, phirho,
              phifzero(980), and fzero(980)fzero(980) final states}",
 journal   = "Phys. Rev. Lett.",
 volume    = "101",
 year      = "2008",
 pages     = "201801",
 eprint    = "0807.3935",
 archivePrefix = "arXiv",
 primaryClass  =  "hep-ex",
 doi       = "10.1103/PhysRevLett.101.201801",
 SLACcitation  = "%%CITATION = 0807.3935;%%"
}

\end{filecontents}

\addbibresource{\jobname.bib}

\begin{document}

\nocite{*}

\printbibliography

\end{document}

I have been using this message as a reference Frequently loaded packages: Differences between pdfLaTeX and XeLaTeX. Ideally I'm looking for methods to preserve UTF-8 after the document has been processed (see my previous thread: Error message when using biber) . Could anyone give me a skeleton that I could use to fully implement the xelatex packages described in the first link?

Also, I've been getting a lot of "—¿" in my finished pdf. Any idea what could be the culprit?

1

1 Answer 1

25

There's very little that you need to change to transition from pdflatex to xelatex. There are four main things to remember:

  1. Your input file must be UTF-8 encoded
  2. You must not load the inputenc package.
  3. You use the fontspec package to load fonts.
  4. You can use any font installed on your system.

Other than that, most things work similarly.

In general, characters that you might have used LaTeX commands to input (e.g. accented characters) can be entered directly into your source.

The fontspec package allows you to do automatic substitution for the common TeX shorthands (--, ---, ``...'', etc) by using the option [Ligatures=TeX]. Here's a sample document:

\documentclass{article}
\usepackage{fontspec}
\defaultfontfeatures{Ligatures=TeX} 
\setmainfont{Linux Libertine O} % or any font on your system
\setsansfont{Linux Biolinum O} % or any font on your system
\begin{document}
This is some text.
\end{document}
6
  • 1
    And AFAIK you cannot load microtype package yet. Hopefully it will be fixed in future.
    – przemoc
    Jun 27, 2011 at 19:14
  • Thanks! Is there anyway to preserve sub/superscript? When I upload the file to a UTF-8 supported database, all sub/superscripts get altered. Is there a specific package that handles sub/superscripts in unicode? Thanks!
    – Richard
    Jun 27, 2011 at 19:29
  • 3
    You can load the microtype package if you use the beta version at xetex.tk/mediawiki/index.php/…
    – Emre
    Jun 27, 2011 at 19:31
  • 1
    @Richard I'm not sure what you mean by preserving sub/superscripts. You can load the realscripts package, which implements \textsubscript and \textsuperscript commands properly using OpenType font features.
    – Alan Munn
    Jun 27, 2011 at 19:46
  • @Alan Munn: Take a look at tex.stackexchange.com/questions/21497/… -- this should help explain what I'm trying to accomplish. What I mean by preserving sub/superscripts is that ᴹₒ, gets converted into MO when it gets uploaded. I'm curious if I can add something so sub/superscript gets converted into UTF-8. Also, do you know of a good Mac font for unicode?
    – Richard
    Jun 27, 2011 at 20:04

Not the answer you're looking for? Browse other questions tagged .