포스터에 코드 목록을 넣으려고 하는데 다음 오류가 발생합니다.
TeX 용량을 초과했습니다. 죄송합니다. [입력 스택 크기=5000]
내가 도대체 뭘 잘못하고있는 겁니까?
\documentclass[portrait, a0paper, 25pt]{tikzposter}
\title{title}
\author{}
\institute{}
\usepackage{color}
\definecolor{bluekeywords}{rgb}{0.13,0.13,1}
\definecolor{greencomments}{rgb}{0,0.5,0}
\definecolor{redstrings}{rgb}{0.9,0,0}
\usepackage{listings}
\lstset{language=[Sharp]C,
showspaces=false,
showtabs=false,
breaklines=true,
showstringspaces=false,
breakatwhitespace=true,
escapeinside={(*@}{@*)},
commentstyle=\color{greencomments},
keywordstyle=\color{bluekeywords}\bfseries,
stringstyle=\color{redstrings},
basicstyle=\ttfamily
}
\begin{document}
\maketitle
\block{Block title}{
\begin{lstlisting}
%some code
\end{lstlisting}
}
\end{document}
\endinput
답변1
안돼... 코드 형식-... 형식화... 뭐..그래서...절대로... 난... 죽을거야...
더 심각한 문제는 환경의 내용이 lstlisting
다루어진다 는 것입니다.말 그대로, 이는 명령 인수( \block
여기서는 ) 내에 그러한 환경을 가질 수 없음을 의미합니다.
일반적인 해결 방법은 환경 내에 목록을 포함하는 대신 외부 파일(패키지 유무에 관계없이 filecontents
)에 목록을 작성하고 명령을 사용하여 삽입하는 것입니다 .\lstinputlisting
lstlisting
\documentclass[portrait, a0paper, 25pt]{tikzposter}
\title{title}
\author{}
\institute{}
\usepackage{color}
\definecolor{bluekeywords} {rgb}{0.13, 0.13, 1}
\definecolor{greencomments}{rgb}{0 , 0.5 , 0}
\definecolor{redstrings} {rgb}{0.9 , 0, 0}
\usepackage{listings}
\lstset{
language = [Sharp]C,
showspaces = false,
showtabs = false,
breaklines = true,
showstringspaces = false,
breakatwhitespace = true,
escapeinside = {(*@}{@*)},
commentstyle = \color{greencomments},
keywordstyle = \color{bluekeywords}\bfseries,
stringstyle = \color{redstrings},
basicstyle = \ttfamily,
}
% -----
% the following writes to an external file called 'foo.hs'
\usepackage{filecontents}
\begin{filecontents*}{foo.hs}
fibs = 0 : 1 : zipWith (+) fibs (tail fibs)
\end{filecontents*}
% -----
\begin{document}
\maketitle
\block{Block title}{%
\lstinputlisting{foo.hs}
}
\end{document}