Using the listings
package, one can define a format for some arbitrary set of delimiters and the characters enclosed within. However, when using double delimiters, the specified format doesn't apply to the closing delimiter.
Consider the following MWE.
\documentclass{article}
\usepackage{listings}
\usepackage{upquote}
\usepackage{xcolor}
\lstset{
moredelim = [s][\color{blue}]{`}{'},
}
\begin{document}
\begin{lstlisting}
macros u i
`u`i''
\end{lstlisting}
\end{document}
This code yields the following output:
Notice how the last closing delimiter '
is not formatted in blue. Is there a way to fix this?
Note: I used the upquote
package to get the desired look of verbatim apostrophes, but if not used the problem persists.