Created
June 23, 2012 15:05
-
-
Save t-uda/2978600 to your computer and use it in GitHub Desktop.
lstlisting の新しい環境を定義する \lstnewenvironment ref: http://qiita.com/items/a971b925fc6526d324c1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\documentclass{article} | |
\usepackage{listings} | |
\lstset{language=C++} | |
\newenvironment{C++}{\begin{lstlisting}}{\end{lstlisting}} | |
\begin{document} | |
\begin{C++} | |
#include <iostream> | |
int main () { | |
std::cout << "Hello, World!" << std::endl; | |
return 0; | |
} | |
\end{C++} | |
\end{document} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% platex bad-newenvironment-lstlisting.tex | |
This is pTeXk, Version 3.141592-p3.1.11 (euc) (Web2C 7.5.4) | |
%&-line parsing enabled. | |
(./bad-newenvironment-lstlisting.tex | |
pLaTeX2e <2006/11/10>+0 (based on LaTeX2e <2009/09/24> patch level 0) | |
(/usr/share/texmf-texlive/tex/latex/base/article.cls | |
Document Class: article 2007/10/19 v1.4h Standard LaTeX document class | |
(/usr/share/texmf-texlive/tex/latex/base/size10.clo)) | |
(/usr/share/texmf-texlive/tex/latex/listings/listings.sty | |
(/usr/share/texmf-texlive/tex/latex/graphics/keyval.sty) | |
(/usr/share/texmf-texlive/tex/latex/listings/lstmisc.sty) | |
(/usr/share/texmf-texlive/tex/latex/listings/listings.cfg)) | |
(/usr/share/texmf-texlive/tex/latex/listings/lstlang1.sty) | |
(/usr/share/texmf-texlive/tex/latex/listings/lstlang1.sty) | |
(/usr/share/texmf-texlive/tex/latex/listings/lstmisc.sty) | |
No file bad-newenvironment-lstlisting.aux. | |
(/usr/share/texmf-texlive/tex/latex/base/omlcmr.fd) | |
(/usr/share/texmf-texlive/tex/latex/base/omscmr.fd)) | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\documentclass{article} | |
\usepackage{listings} | |
\lstnewenvironment{C++} | |
{\lstset{language=C++}} | |
{} | |
\begin{document} | |
\begin{C++} | |
#include <iostream> | |
int main () { | |
std::cout << "Hello, World!" << std::endl; | |
return 0; | |
} | |
\end{C++} | |
\end{document} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment