Showing posts with label xelatex. Show all posts
Showing posts with label xelatex. Show all posts

Wednesday, September 26, 2012

xelatex, polyglossia - french and verbatim

An interesting problem with the combination of circumstances in the title has cropped up today. A minimal sample like this exhibits the problem:

\documentclass[a4paper]{article}
\usepackage{polyglossia}
\setdefaultlanguage{french}
\begin{document}
\verb|00:11:43:D4:86:A0|
\end{document}


 This code produces:
 whereas it correctly should look like this:
A bug about this has been reported, for now work around it with:
\newenvironment{\mverbatim}{\makeatletter \nofrench@punctuation\begin{verbatim}\makeatother}{\end{verbatim}\makeatletter\french@punctuation\makeatother}
The \verb is a little trickier, i'll think about that for a while. It probably boils down to copying the def from latex.ltx and adding an aftergroup or similar.
For now
\makeatletter\nofrench@punctuation
\verb|00:11:43:D4:86:A0|
\french@punctuation\makeatother

does the trick.

Tuesday, August 28, 2012

(Xe-|Lua-)LaTeX, Fontspec and endash, emdash

Historically we have used xelatex to typeset a larger publication. When we tried to convert to lualatex we hit a problem with emdashes and endashes showing in the document as --- and -- respectively.
The problem is not entirely clear to me. It appears to be caused by two different chars representing -  and is apparently related to the fontspecmode node, the renderer full and the fact that the loader is implemented differently in luatex and xetex. Contex had the same problem but has been fixed, luatex not apparently

If you care about the details read this discussion on stackexchange and this thread on comp.text.tex.

The problem as well as the solution unfortunately depends on the font. Try
the option  Ligatures=TeX for the font and if that doesn't work also try Renderer=basic, like
\setmainfont[Ligatures=TeX,Renderer=Basic,SmallCapsFont={* SC}]{LMU CompatilText}
or in
\defaultfontfeatures{Ligatures=TeX,Renderer=Basic}

Hopefully this works for you. It did for us.