
솔루션을 사용하고 있습니다여기스칼라 지원을 위한 것이지만 스칼라 코드의 색상을 적절하게 지정하지 못하고 lstset를 처리할 때 많은 오류가 발생합니다. % ! Package keyval Error: breakatwhitespace undefined.
누구든지 이 간단한 예에서 무엇이 문제인지 파악하도록 도와줄 수 있습니까?
\documentclass[journal]{IEEEtran}
\usepackage{listings}
% "define" Scala
\lstdefinelanguage{scala}{
morekeywords={abstract,case,catch,class,def,%
do,else,extends,false,final,finally,%
for,if,implicit,import,match,mixin,%
new,null,object,override,package,%
private,protected,requires,return,sealed,%
super,this,throw,trait,true,try,%
type,val,var,while,with,yield},
otherkeywords={=>,<-,<\%,<:,>:,\#,@},
sensitive=true,
morecomment=[l]{//},
morecomment=[n]{/*}{*/},
morestring=[b]",
morestring=[b]',
morestring=[b]"""
}
\usepackage{color}
\definecolor{dkgreen}{rgb}{0,0.6,0}
\definecolor{gray}{rgb}{0.5,0.5,0.5}
\definecolor{mauve}{rgb}{0.58,0,0.82}
\lstset{frame=tb,
language=scala,
aboveskip=3mm,
belowskip=3mm,
showstringspaces=false,
columns=flexible,
basicstyle={\small\ttfamily},
numbers=none,
numberstyle=\tiny\color{gray},
keywordstyle=\color{blue},
commentstyle=\color{dkgreen},
stringstyle=\color{mauve},
frame=single,
breaklines=true,
breakatwhitespace=true
tabsize=3
}
% A number of keyval errors occur here - basically
% nothing in lstset is recognized. Errors look like:
% ! Package keyval Error: breakatwhitespace undefined.
\begin{document}
\begin{lstlisting}
object Test {
def main(args: Array[String]) {
var a = 0;
// for loop execution with a range
for( a <- 1 to 10){
println( "Value of a: " + a );
}
}
}
\end{lstlisting}
\end{document}
편집: 추가한 후 \listfiles
표시되는 파일 목록은 다음과 같습니다.
*File List*
IEEEtran.cls 2007/03/05 V1.7a by Michael Shell
ot1ptm.fd 2001/06/04 font definitions for OT1/ptm.
xspace.sty 2009/10/20 v1.13 Space after command names (DPC,MH)
epsfig.sty 1999/02/16 v1.7a (e)psfig emulation (SPQR)
graphicx.sty 1999/02/16 v1.0f Enhanced LaTeX Graphics (DPC,SPQR)
keyval.sty 1999/03/16 v1.13 key=value parser (DPC)
graphics.sty 2009/02/05 v1.0o Standard LaTeX Graphics (DPC,SPQR)
trig.sty 1999/03/16 v1.09 sin cos tan (DPC)
graphics.cfg 2010/04/23 v1.9 graphics configuration of TeX Live
pdftex.def 2011/05/27 v0.06d Graphics/color for pdfTeX
infwarerr.sty 2010/04/08 v1.3 Providing info/warning/error messages (HO)
ltxcmds.sty 2011/11/09 v1.22 LaTeX kernel commands for general use (HO)
url.sty 2006/04/12 ver 3.3 Verb mode for urls, etc.
cite.sty 2010/09/10 v 5.3
fancybox.sty 2010/05/15 1.4
listings.sty 2007/02/22 1.4 (Carsten Heinz)
lstmisc.sty 2007/02/22 1.4 (Carsten Heinz)
listings.cfg 2007/02/22 1.4 listings configuration
color.sty 2005/11/14 v1.0j Standard LaTeX Color (DPC)
color.cfg 2007/01/18 v1.5 color configuration of teTeX/TeXLive
lstlang1.sty 2004/09/05 1.3 listings language file
lstlang1.sty 2004/09/05 1.3 listings language file
supp-pdf.mkii
pdftexcmds.sty 2011/11/29 v0.20 Utility functions of pdfTeX for LuaTeX (HO)
ifluatex.sty 2010/03/01 v1.3 Provides the ifluatex switch (HO)
ifpdf.sty 2011/01/30 v2.3 Provides the ifpdf switch (HO)
epstopdf-base.sty 2010/02/09 v2.5 Base part for package epstopdf
grfext.sty 2010/08/19 v1.1 Manage graphics extensions (HO)
kvdefinekeys.sty 2011/04/07 v1.3 Define keys (HO)
kvoptions.sty 2011/06/30 v3.11 Key value format for package options (HO)
kvsetkeys.sty 2012/04/25 v1.16 Key value parser (HO)
etexcmds.sty 2011/02/16 v1.5 Avoid name clashes with e-TeX commands (HO)
epstopdf-sys.cfg 2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Live
ot1pcr.fd 2001/06/04 font definitions for OT1/pcr.
sections/introduction.tex
sections/background.tex
sections/challenges.tex
sections/solution.tex
figures/vnc-overview.pdf
sections/results.tex
omsptm.fd
figures/client-heap.png
figures/master-heap.png
sections/relatedwork.tex
sections/conclusion.tex
clasp.bbl
답변1
Peter가 자신의 의견에서 언급했듯이 TeX 배포판은 매우 오래된 것 같습니다. 녹을 제거하고 패키지 관리자를 실행할 시간입니다.
또한 뒤에 쉼표가 없습니다 breakatwhitespace=true
.
게다가 2013년 10월부터 listings
패키지에는 Scala에 대한 언어 정의가 함께 제공됩니다(lstdvrs.dtx
파일). TeX 배포판을 업데이트하는 경우 해당 언어 .tex
를 사용하기 위해 파일 에서 처음부터 해당 언어를 다시 정의할 필요가 없습니다 .
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{beramono}
\usepackage{listings}
\usepackage{xcolor}
\definecolor{dkgreen}{rgb}{0,0.6,0}
\definecolor{gray}{rgb}{0.5,0.5,0.5}
\definecolor{mauve}{rgb}{0.58,0,0.82}
\lstdefinestyle{myScalastyle}{
frame=tb,
language=scala,
aboveskip=3mm,
belowskip=3mm,
showstringspaces=false,
columns=flexible,
basicstyle={\small\ttfamily},
numbers=none,
numberstyle=\tiny\color{gray},
keywordstyle=\color{blue},
commentstyle=\color{dkgreen},
stringstyle=\color{mauve},
frame=single,
breaklines=true,
breakatwhitespace=true,
tabsize=3,
}
\begin{document}
\begin{lstlisting}[style=myScalastyle]
object Test {
def main(args: Array[String]) {
var a = 0;
// for loop execution with a range
for( a <- 1 to 10){
println( "Value of a: " + a );
}
}
}
\end{lstlisting}
\end{document}