![使用“code”语法插入一些代码](https://linux22.com/image/382474/%E4%BD%BF%E7%94%A8%E2%80%9Ccode%E2%80%9D%E8%AF%AD%E6%B3%95%E6%8F%92%E5%85%A5%E4%B8%80%E4%BA%9B%E4%BB%A3%E7%A0%81.png)
而不是使用
\usepackage{listings}
...
lstinline{for} or \lstinline{while} or \lstinline{main}
Here you \codeword{see} an \codeword{example} of \codeword{code}
如何为内联代码定义这种语法,类似于Markdown:
Here you `see` an `example` of `code`
?
答案1
您可以使用fancyvrb
包来执行此操作。我建议使用不同的分隔符(如|
),以避免与引号等发生冲突。
\documentclass{article}
\usepackage{fancyvrb}
\DefineShortVerb{\`}
\begin{document}
Here you `see` an `example` of `code`
\end{document}