xelatex 使用 \StrBefore 时失败并显示“未定义的控制序列”

xelatex 使用 \StrBefore 时失败并显示“未定义的控制序列”

我运行命令时出现以下错误xelatex sj_mwe.tex

! Undefined control sequence.
\casecitation #1->\StrBefore 
                             {#1}{,}[\texttobold ] \StrBehind {#1}{, }[\text...
l.80 \casecitation{X v. Y, blah blah}

? X
No pages of output.
Transcript written on sj_mwe.log.

这是我的最小(非)工作示例:

\documentclass[12pt]{article}

\usepackage{fontspec}
\usepackage[%
    paperheight = 11in,
    paperwidth = 8.5in,
    top = 2.5cm,
    bottom = 2.5cm,
    left = 3.5cm,
    right = 3.5cm,
]{geometry}

% Main font, can use any system font, alternatively, copy fonts to project folder and specify path
\setmainfont{Times New Roman}

\setlength{\parindent}{0pt}

\usepackage[explicit]{titlesec}
\usepackage{titletoc}
\usepackage{fancyhdr}
\usepackage{setspace}
\usepackage{graphicx}
\usepackage{pdfpages}
\usepackage{ulem}

\usepackage{array}
\usepackage{tabularx}
\usepackage{mathtools}
\usepackage{booktabs}
\usepackage{pdflscape}

\newcolumntype{Y}{>{\centering\arraybackslash}X}

\setcounter{tocdepth}{4}
% Macro to bold and underline citations
\newcommand{\casecitation}[1]{%
    \StrBefore{#1}{,}[\texttobold]
    \StrBehind{#1}{, }[\texttoul]
    \textbf{\texttobold}, \uline{\texttoul}
}

\begin{document}
\casecitation{X v. Y, blah blah}
\casecitation{W v Z, hey who}
\end{document}

我认为我已经xstring安装了该软件包:

$ tlmgr install xstring
(running on Debian, switching to user mode!)
tlmgr: package repository http://mirror.its.dal.ca/ctan/systems/texlive/tlnet (verified)
tlmgr install: package already present: xstring

我正在使用 Debian 9.3 (Stretch)。以下是一些版本信息xelatex

 $ xelatex --version
XeTeX 3.14159265-2.6-0.99999 (TeX Live 2018/Debian)
kpathsea version 6.3.0
Copyright 2018 SIL International, Jonathan Kew and Khaled Hosny.
There is NO warranty.  Redistribution of this software is
covered by the terms of both the XeTeX copyright and
the Lesser GNU General Public License.
For more information about these matters, see the file
named COPYING and the XeTeX source.
Primary author of XeTeX: Jonathan Kew.
Compiled with ICU version 60.2; using 60.2
Compiled with zlib version 1.2.11; using 1.2.8
Compiled with FreeType2 version 2.8.1; using 2.8.1
Compiled with Graphite2 version 1.3.11; using 1.3.10
Compiled with HarfBuzz version 1.7.6; using 1.4.2
Compiled with libpng version 1.6.34; using 1.6.28
Compiled with poppler version 0.63.0
Compiled with fontconfig version 2.13.0; using 2.13.0

并且对于tlmgr

 $ tlmgr version
(running on Debian, switching to user mode!)
tlmgr revision 47303 (2018-04-05 19:52:22 +0200)
tlmgr using installation: /usr/share/texlive
TeX Live (http://tug.org/texlive) version 2018

有人能建议我如何使用包StrBefore中的其他宏吗xstring?谢谢。

相关内容