I want to type the angle bracket inside a listings inline code.
like ⟨this⟩
I set up listings to be (globally) typed in the Latin Modern Mono.
With the following
% !TEX TS-program = xelatex
% !TEX encoding = UTF-8 Unicode
\documentclass[a4paper,11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{fontspec,hyperref,listings}
\lstset{%
basicstyle=\ttfamily\small,
breaklines=true,
language=TeX,
extendedchars=true
}
\usepackage{polyglossia}
\setdefaultlanguage{english}
\setotherlanguage{hebrew}
\makeatletter
\lst@InputCatcodes
\def\lst@DefEC{%
\lst@CCECUse \lst@ProcessLetter
^^^^27e8% Left-Pointing Angle Bracket
^^^^27e9% Right-Pointing Angle Bracket}
^^00}
\lst@RestoreCatcodes
\makeatother
\setmainfont{Latin Modern Roman}
\newfontfamily\hebrewfont{Arial}
\begin{document}
The command is \lstinline$\newfontfamily⟨cmd⟩{font}{options}$.
\end{document}
I get this output:
Even after adding the makeatletter-makeatlatter code suggested in the comments, the brackets are not displayed in the output.
What is it that I am missing here?


listingsis known not to play well with "extended" characters. There's a whole section about it in the documentation, including some suggestions (such as "escape to LaTeX"). 3. With typewriter font, why not just use<and>?\lst@InputCatcodes \def\lst@DefEC{%) comes from? – tush Jan 29 '22 at 15:32