\verb| |
在示例中使用无法实现自动换行。
使用:
%! TEX = xelatex
\documentclass[a4paper, titlepage]{book}
\usepackage{listings}
\lstset{
breaklines=true
}
\newcommand{\inlineCode}{\lstinline[basicstyle=\normalsize\ttfamily]}
\usepackage{hyperref}
\usepackage{memhfixc}
\usepackage[nameinlink,noabbrev,capitalise]{cleveref}
\usepackage{cgloss4e}
\usepackage{enumerate}
\usepackage{gb4e}
\sloppy
\begin{document}
\begin{exe}
\ex \begin{lstlisting}
some code here
\end{lstlisting}
\end{exe}
% or
\begin{enumerate}
\item \begin{lstlisting}
some code here
\end{lstlisting}
\end{enumerate}
% fails to produce the text flush with the example number, in exactly the same way beyond the different numbering style (I would prefer to be using the gb4e package for consistency).
% Using:
\begin{exe}
\ex \inlineCode{some code}\\
\inlineCode{some more code}\\
\end{exe}
% works, but makes telling lines apart very difficult, unless I input indentation manually.
% Likewise, using:
\begin{exe}
\ex \begin{xlistn}
\ex some code
\ex some code continued
\end{xlistn}
\end{exe}
% spaces them too far apart (or it did in my other document... I'm unsure of why there is a difference, perhaps it is to do with my fonts: Gentium Plus for the body; Noto Sans Mono as for the ttfamily - mono DOES = ttfamily? - though this might change if I can find a tt font to fit Gentium better.)
% Thank you.
\end{document}