作者直接写了一个新的宏包,使用的时候只需要引入宏包,注意把宏包放在当前路径下:
\usepackage{lstcustom}那么我们就可以使用如下代码编译了。
\begin{lstlisting}[caption={A simple listing.}, label={lst:simple}]
/**
* @param args
* Program arguments
*/
public static void main(String[] args) {
// Now for the enlightening message.
System.out.println("Hmm... hello big world!";
// @TODO Finish this example
// Just some comment that is probably too long to fit in the space provided....
}
\end{lstlisting}直接导入源代码:
\lstinputlisting[caption={A listing from the file
\ttfamily{Rectangle.java}}, label={lst:file}]{Rectangle.java}那么得到的效果如下图:




发表评论 取消回复