1

I am getting the following error when I run the command 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.

Here is my minimum (non)working example:

\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}

I think I have the xstring package installed:

$ 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

I am using Debian 9.3 (Stretch). Here is some version information for 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

and for 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

Could someone suggest how I can use the StrBefore and other macros from the xstring package? Thanks.

6
  • \usepackage{xstring}, maybe? May 30, 2018 at 23:37
  • See tex.stackexchange.com/questions/131502/…. You should additionally \protect your argument. (BTW: did we exchange messages a few hours before on another portal?) May 30, 2018 at 23:40
  • @Pheylype, Yes - dumb mistake on my part, owing to my lack of familiarity with TeX. I'll accept that as the answer (or maybe I should just delete this question?) Thanks. May 31, 2018 at 0:04
  • @PrzemysławScherwentke - thanks, I'll try that. And yes, that's me. May 31, 2018 at 0:05
  • 4
    I'm voting to close this question as off-topic because the OP just forgot to load xstring. May 31, 2018 at 0:10

0

Browse other questions tagged .