3

I was looking for the way to create a strikeout text in XeTeX. After some googling I found two packages that supposedly could do that: ulem and soul. However, it turned out that both of them have some issues with my text.

ulem doesn't offer automatic hyphenation, which probably wouldn't be a problem if I only had couple of words to strike through, but that's not the case-I'm dealing with quite a large chunk of text and to manually hyphenate it would be difficult.

sout without additional configuration doesn't work properly with Cyrillic text in XeTeX: it only strikes out words that border punctuation marks and swallows the rest of text. It seems to work fine with LaTeX but I'd like to use Unicode fonts which would be much easier with XeTeX.

To illustrate the above, here's a small example:

\documentclass[draft=true]{scrartcl}
\usepackage[cm-default]{fontspec}
\usepackage{xltxtra}
\setmainfont{Palatino Linotype}
\usepackage{polyglossia}
\setdefaultlanguage{russian}
\usepackage{microtype}

\usepackage{ulem}
\usepackage{soulutf8}  

\begin{document}
ulem:

\sout{Сшит колпак не по-колпаковски, вылит колокол не по-колоколовски. 
Надо колпак переколпаковать-перевыколпаковать, надо колокол 
переколоколовать-перевыколоколовать.}\\

soulutf8:

\st{Сшит колпак не по-колпаковски, вылит колокол не по-колоколовски. 
Надо колпак переколпаковать-перевыколпаковать, надо колокол 
переколоколовать-перевыколоколовать.}
\end{document}

It is rendered as follows:

ulem and soul comparison

As you see, there are line line overfulls with ulem variant and the soul variant is a complete mess. So I was wondering if there is any other way to achieve my goal.

4

Eventually I found this discussion: Discussion in XeTeX mailing list. It explained the soul behavior:

soul.sty defines the fix font \SOUL@tt (\font\SOUL@tt=ectt1000) and use it in various places when analyzing the input. And obviously one gets problems as soon as words ends with glyphs not existing in the font as this leads to boxes of width 0 and so soul thinks that there is no longer something to process.

And later in that thread a solution was suggested. Adding the following code makes soul work correctly with Cyrillic script:

\makeatletter
\font\SOUL@tt="Palatino Linotype"
\setbox\z@\hbox{\SOUL@tt-}
\SOUL@ttwidth\wd\z@
\makeatother

soul with additional options

I don't completely understand the purpose of lines 3 and 4 here. I thought line 2 would be enough but with only it I'm getting a "Reconstruction failed" error message. soul documentation didn't really make it clear.

Well, as long as I achieved my goal I'm satisfied, but if someone could explain how these settings work I'd be grateful.

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.