Using LaTeX Beamer to display code

岁酱吖の 提交于 2019-12-04 14:11:16

问题


I'm using the following LaTeX code in a Beamer presentation:

\begin{frame}
  \begin{figure}
  \centering
      \tiny
   \lstset{language=python}
         \lstinputlisting{code/get_extent.py}
   \end{figure}
\end{frame}

Is it possible to select specific lines from my get_extent.py file rather than displaying it all?


回答1:


This has nothing to do with beamer; it's about a listings feature. Its excellent manual has more. For example:

\lstinputlisting[firstline=2,lastline=5]{code/get_extent.py}


来源:https://stackoverflow.com/questions/2135339/using-latex-beamer-to-display-code

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!