5

Consider the following code:

\documentclass{article}
\usepackage{stix}
\usepackage{listings,xcolor}
\lstdefinelanguage{test}{sensitive=true,
  morekeywords={TEST},
morecomment=[l]{--}}
\lstnewenvironment{testcode}
{\lstset{breaklines=true,language=test, basicstyle=\color{blue}\tiny}}
{}
\begin{document}
\begin{testcode}
TEST

-- Testing 8*8=64
\end{testcode}
\end{document}

compiling with pdflatex gives the following output:

enter image description here

As seen, the asterix * does not show up in the listings comment..

If I don't use the stix package, it works fine:

enter image description here

6

If you look in the log file, you see the origin of the problem:

Missing character: There is no * in font ts1-stixgeneral-italic!

This happens as soon as you try to output an italic * with listings. That's because listings tries to substitute * with \textasteriskcentered which unfortunately doesn't exist in the right variant when using the current stix fonts release (STIXv1.1.0-latex). A simple workaround is to redefine \textasteriskcentered to be a mathematical *:

\documentclass{article}
\usepackage{stix}
\renewcommand{\textasteriskcentered}{\ensuremath{*}}
\usepackage{listings}
\lstset{basicstyle=\itshape}
\begin{document}
\begin{lstlisting}
Testing 8*8=64
\end{lstlisting}
\end{document}

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.