(以内容“How to insert source code into a latex document. == listings == First method: use listings package === Package === <source lang="latex"> \usepackage{listings} </sourc...”创建新页面) |
(→Usage) |
||
第13行: | 第13行: | ||
\lstset{language=c} | \lstset{language=c} | ||
\lstset{caption=Some caption} | \lstset{caption=Some caption} | ||
− | \lstset{captionpos=b} | + | \lstset{captionpos=b} % caption at bottom, default to top |
\lstinputlisting{some source code.c} | \lstinputlisting{some source code.c} | ||
</source> | </source> |
2012年5月12日 (六) 07:22的最新版本
How to insert source code into a latex document.
listings
First method: use listings package
Package
\usepackage{listings}
Usage
\lstset{language=c}
\lstset{caption=Some caption}
\lstset{captionpos=b} % caption at bottom, default to top
\lstinputlisting{some source code.c}
For short code:
\begin{lstlisting}
Your source code here
\end{lstlisting}