3

I have a XeLaTeX document which worked once, today no more, despite that I have installed texlive-full. The document contains a lot of mysterious code which I have grabbed from different sources, and the now improper part resides on the mysterious side.

To be specific, there is a command \varul which probably turns a letter into its variation or whatever, which I can not check because the document does not compile. The definition of the command looks as follows (together with a minimal running example)

\documentclass{article}
\usepackage{fontspec}
\usepackage{lmodern}
\usepackage{soul}
\usepackage{xcolor}


\makeatletter

\ExplSyntaxOn
\cs_new:Npn \white_text:n #1
  {
    \fp_set:Nn \l_tmpa_fp {.01}
    \fp_mul:Nn \l_tmpa_fp {#1}
    \llap{\textcolor{white}{\the\SOUL@syllable}\hspace{\fp_to_decimal:N \l_tmpa_fp em}}
    \llap{\textcolor{white}{\the\SOUL@syllable}\hspace{-\fp_to_decimal:N \l_tmpa_fp em}}
  }
\NewDocumentCommand{\whiten}{ m }
    {
      \int_step_function:nnnN {1}{1}{#1} \white_text:n
    }
\ExplSyntaxOff

\NewDocumentCommand{ \varul }{ D<>{5} O{0.33ex} O{0.1ex} +m } {%
\begingroup
\setul{#2}{#3}%
\def\SOUL@uleverysyllable{%
   \setbox0=\hbox{\the\SOUL@syllable}%
   \ifdim\dp0>\z@
      \SOUL@ulunderline{\phantom{\the\SOUL@syllable}}%
      \whiten{#1}%
      \llap{%
        \the\SOUL@syllable
        \SOUL@setkern\SOUL@charkern
      }%
   \else
       \SOUL@ulunderline{%
         \the\SOUL@syllable
         \SOUL@setkern\SOUL@charkern
       }%
   \fi}%
    \ul{#4}%
\endgroup
}

\makeatother

\begin{document}
    \varul{v}
\end{document}

Searching for ancestors of this scroll yielded a single result https://github.com/dfm/imprs/blob/master/mcmc/dfm_stylez.tex. Interestingly, it exists there in a commented out state. I thus know no more, but this friendly communicate:

! Undefined control sequence.
\white_text:n ...et:Nn \l_tmpa_fp {.01}\fp_mul:Nn 
                                                  \l_tmpa_fp {#1}\llap {\tex...
l.47 ^^I\varul{v}

?

An attempt at a return to the command line with a stochastic combination of ^C and ^D possibly gives some more hints:

? ^C! Interruption.
<to be read again> 
                   \s__fp 
l.47 ^^I\varul{v}

? 
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! LaTeX error: "kernel/misused-fp"
! 
! A floating point with value '0.01' was misused.
! 
! See the LaTeX3 documentation for further information.
! 
! For immediate help type H <return>.
!...............................................  

l.47 ^^I\varul{v}

? ! Undefined control sequence.
<argument> \textcolor 
                      {white}{\the \SOUL@syllable }\hspace {\fp_to_decimal:N...
l.47 ^^I\varul{v}

? [1] (./test.aux
^C
! Interruption.
l.7397927

?

Could you help me make the document compile with the current XeLaTeX? I guess it is something easy for someone using TeX directly. I would just want to compile the document and have it look more or less like it id.

I am open to any modifications of the \varul macro. Unfortunately, I do not know how it exactly changes/decorates the letter. Might be it was some kind of dotted underline? Can it be guessed from its definition?

Edit: Thanks egreg and TeXnician. So it is now seen that this command makes a white outline around text so that it does not clash with the underscore. I should have added a relevant comment to it. Egreg did not want his answer to be edited so I add an example output, which illustrates the outline:enter image description here

  • Well, \fp_mul seems to be outdated. What do you really try to achieve? – TeXnician May 25 '17 at 10:48
  • TeXnician, I would just want to compile the document and have it look more or less like it id. I am open to any modifications of the \varul macro. – arataj May 25 '17 at 10:50
  • Use \fp_set:Nn \l_tmpa_fp {0.01*#1} – egreg May 25 '17 at 10:54
  • And include \usepackage{xcolor}. Then it works (if you abandon D<>{5} and replace that code). – TeXnician May 25 '17 at 10:57
  • TeXnician, yes, I forgot xcolor in the mwe, corrected. It works now after your suggestions. So the command was just an underscore under an elevated letter? – arataj May 25 '17 at 11:03
6

It's not clear what the purpose of the macro is. However, \fp_mul:Nn does not exist any more.

\documentclass{article}
\usepackage{xparse}
\usepackage{lmodern}
\usepackage{xcolor,soul}

\makeatletter

\ExplSyntaxOn
\cs_new:Npn \white_text:n #1
  {
    \llap{\textcolor{white}{\the\SOUL@syllable}\hspace{\fp_eval:n{0.01*#1} em}}
    \llap{\textcolor{white}{\the\SOUL@syllable}\hspace{-\fp_eval:n{0.01*#1} em}}
  }
\NewDocumentCommand{\whiten}{ m }
    {
      \int_step_function:nnnN {1}{1}{#1} \white_text:n
    }
\ExplSyntaxOff

\NewDocumentCommand{ \varul }{ D<>{5} O{0.33ex} O{0.1ex} +m } {%
\begingroup
\setul{#2}{#3}%
\def\SOUL@uleverysyllable{%
   \setbox0=\hbox{\the\SOUL@syllable}%
   \ifdim\dp0>\z@
      \SOUL@ulunderline{\phantom{\the\SOUL@syllable}}%
      \whiten{#1}%
      \llap{%
        \the\SOUL@syllable
        \SOUL@setkern\SOUL@charkern
      }%
   \else
       \SOUL@ulunderline{%
         \the\SOUL@syllable
         \SOUL@setkern\SOUL@charkern
       }%
   \fi}%
    \ul{#4}%
\endgroup
}

\makeatother

\begin{document}

X\varul{abc def}X

X\varul<20>[1ex][1ex]{abc def}X

\end{document}

enter image description here

  • egreg, I modified your answer so that the purpose of the command is apparent. – arataj May 25 '17 at 11:11
  • @arataj No, sorry, it wasn't at all clearer. – egreg May 25 '17 at 16:15
  • egreg ok I have put the relevant image in the question; btw here is a more versatile variant of the command tex.stackexchange.com/a/269858/97064 – arataj May 25 '17 at 21:44

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.