我希望\texttt{}
在原始复制文本中插入一个项目符号列表。有办法吗?当列表直接从原始文本复制时,内部渲染\texttt{}
会将其转换为我假设的 ASCII 或 Unicode 转换。下面给出了一个 MWE。在 MWE 中,我希望用<bullet>
合适的语法替换,以模拟复制文本中的项目符号。
\documentclass[11pt]{report}
\begin{document}
\texttt{
<bullet> item 1
<bullet> item 2
....
}\\
\end{document}
答案1
这是另一种enumitem
方法,但会自动切换到\ttfamily
使用before={\ttfamily}
。
\documentclass[11pt]{report}
\usepackage[utf8]{inputenc}
\usepackage{textcomp}
\usepackage[T1]{fontenc}
\usepackage{enumitem}
\newlist{itemtt}{itemize}{1}
\setlist[itemtt,1]{label={\textbullet},before={\ttfamily}}
\begin{document}
\begin{itemtt}
\item This is in typewriter font
\item This is in typewriter font again
\item \itshape\textrm{This is explicitly written in another font}
\item And typewriter again, but with italics
\end{itemtt}
And this is in normal font
\end{document}
答案2
像这样:
\documentclass{article}
\usepackage{enumitem}
\begin{document}
\ttfamily
\begin{itemize}[label=\textbullet]
\item item1
\item item2
\end{itemize}
\end{document}