[XeTeX] wrong strikethrough?

Ross Moore ross at ics.mq.edu.au
Sun Feb 1 22:23:26 CET 2009


Hi Jonathan, and Pablo,

On 02/02/2009, at 6:44 AM, Jonathan Kew wrote:

> On 1 Feb 2009, at 18:48, Pablo Rodríguez wrote:

>> I'm using the following code:
>>
>> \documentclass{article}
>> \usepackage{soul,xcolor}
>> \setstcolor{red}
>> \begin{document}
>> \st{overstriking?}
>> \end{document}
>>
>> But the issue here is that the text is over the striking line and not
>> vice versa (as I guess it should be).
>>
>> Is there no way to fix this?
>
>
> Hi Pablo,
>
> I don't think this is a xetex issue; did you try the same thing in
> (pdf)latex?

This is correct; it's not a XeTeX issue per se, however
I think it is worth making a comment or two here.

> What does the soul package documentation have to say about
> it?

Here's what:

  \SOUL at stcolor
  \setstcolor
  Set the overstriking color. This won’t be used often, but is  
required in cases,
  where the underlines are colored. You wouldn’t want to overstrike  
in the same
  color. Note that overstriking lines are drawn beneath the text,  
hence bright colors
  won’t look good.

That last sentence says it all, in terms of what actually happens.


In fact, there is also an earlier comment:

  Not that colored overstriking was especially useful, but we want
  at least to keep it black while we might want to set underlines in  
some fancy color.


I find it strange that a package author would adopt such viewpoints.
It is quite common for users to find applications of some effects
that the author had not originally envisioned.
This can only add to the usefulness of the package, so the means
to obtain the effect should be programmed-in rather than out.

In this case, the package has implemented "under"-striking, rather
than "over"-striking, by placing the embellishment before the text,
rather than after. Either could have been done --- indeed *both*
effects could easily have been made available.


Here is some coding that you can add to your LaTeX preamble
that will switch the strikethrough line to being over, not under.

\makeatletter
\def\SOUL at uloverline#1{{%
    \setbox\z@\hbox{#1}%
    \dimen@=\wd\z@
    \dimen at i=\SOUL at uloverlap
    \advance\dimen at 2\dimen at i
    \unhcopy\z@
    \llap{%
     \null
     \kern-\dimen at i
     \SOUL at ulcolor{\SOUL at ulleaders\hskip\dimen@}%
   }%
}}

\def\SOUL at stsetup{%
   \SOUL at ulsetup
   \let\SOUL at preamble\SOUL at stpreamble
   %% RRM: use the new macro defined above
   \let\SOUL at ulunderline\SOUL at uloverline
}
\makeatother


The only possible problem that I can envision is that
the glue coming after the struck-through text may be
different to what would be there without the striking.
In most usages this will not be noticeable.


Of course you may want the understriking effect sometimes;
in which case extra coding would be needed to allow the
choice.


>
> JK


Hope this helps,

	Ross

------------------------------------------------------------------------
Ross Moore                                       ross at maths.mq.edu.au
Mathematics Department                           office: E7A-419
Macquarie University                             tel: +61 (0)2 9850 8955
Sydney, Australia  2109                          fax: +61 (0)2 9850 8114
------------------------------------------------------------------------





More information about the XeTeX mailing list