8

I am using xelatex and while formatting by \caps (packages soul, soulutf8, polyglossia), the ending utf8 signs get stripped ("gītā" gets "gīt", see image below). Did anybody notice this issue and could give some help please?

The document can be simplified as follows:

% xelatex, texlive 2013
\documentclass[]{scrbook}
\usepackage{polyglossia}
\usepackage{xltxtra}
\usepackage{soul,soulutf8}
\begin{document}

\caps{gītā}

\end{document}

enter image description here

Update:

Thanks to the kind help, I could redefine the document as follows and understand the matter better:

% xelatex, texlive 2013
\documentclass[]{scrbook}
\usepackage{polyglossia}  % calls fontspec
\setmainfont
[Ligatures=TeX,
SmallCapsFeatures={LetterSpace=3.0},  % \textsc{} rather than \caps{} from "soul"
Numbers=OldStyle,
]
{TeX Gyre Pagella}  % could be any unicode font which supports small capitals
\begin{document}

\textsc{gītā}

\end{document}

I would also appreciate if somebody could explain shortly the main difference between \textsc{} from "fontspec" with letter spacing, \caps{} from "soul" and a feature if provided by "microtype".

2
  • Why not use a font which supports this in conjunction with fontspec rather than trying to use something like soul? That is, you are using xelatex in any case, so why not use the features that enables you to access?
    – cfr
    Feb 4, 2014 at 2:52
  • Avoid xltxtra, unless you really need its features (I bet you don't). Load just fontspec.
    – egreg
    Feb 4, 2014 at 9:26

2 Answers 2

7

Package soul checks the character tokens with the font \SOUL@tt. This is defined in LaTeX as:

\newfont\SOUL@tt{ectt1000}

However, you are using a Unicode enabled TeX engine. There many characters are not available in font ectt1000. The .log file contains the messages:

Missing character: There is no ī in font ectt1000!
Missing character: There is no ā in font ectt1000!

The workaround is to redefine \SOUL@tt to use a better font:

\documentclass[]{scrbook}
\usepackage{polyglossia}
\usepackage{xltxtra}
\usepackage{soul}

\makeatletter
\sbox0{\ttfamily\global\let\SOUL@tt\ttfamily} 
\makeatother

\begin{document}
  \caps{gītā}
\end{document}

Result

Remark:

  • Package soulutf8 is intended to support UTF-8 for 8-bit TeX engines, where a Unicode character consists of several TeX chars/tokens with character codes < 256, encoded as UTF-8. This requires changes of the soul parser.

    However, XeTeX and LuaTeX support Unicode characters as single tokens/big chars. Thus the parser of soul does not need to be changed and soulutf8 is not needed and should not be used.

2
  • What is the difference between what soul does here and what is offered by fontspec's use of the different capitalisation/small-capitalisation/etc. features (for fonts which support those features)? (And maybe with microtype.)
    – cfr
    Feb 4, 2014 at 3:59
  • This problem is related. I tried to apply your solution from here, but it doesn't quite work for my case.
    – muk.li
    Jun 15, 2015 at 6:58
4

You don't need soul for this, as letter spacing can be defined directly through fontspec.

\documentclass{scrbook}
\usepackage{fontspec}

\setmainfont[
  Ligatures=TeX,
  SmallCapsFont=Latin Modern Roman Caps,
  SmallCapsFeatures={LetterSpace=2.5},
]{Latin Modern Roman}

\begin{document}
\textsc{gītā}

\scriptsize\MakeUppercase{gītā} % for checking

\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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