jkrod
jkrod

Reputation: 135

How to supress any title or caption for \lstinputlisting?

I am using

\lstinputlisting[]{javacode/DatabaseManager-getUser}

to show some java code. However the following caption appears underneath the listing (see picture marked with red arrow):

Listing with caption

In my preamble I have used \lstset to set title={}, however I don't want anything there, no title or caption. Is this possible? And if so how would I go about doing it?

Upvotes: 1

Views: 3325

Answers (1)

jkrod
jkrod

Reputation: 135

See MattAllegros comment in OP. It made me find the issue. In my preamble I had the following setup:

\usepackage{listings}
\lstset{ %
  backgroundcolor=\color{grayC},
  basicstyle=\ttfamily\small,
  breakatwhitespace=false,        
  breaklines=true,             
  captionpos=b,                 
  commentstyle=\color{greencomments},   
  deletekeywords={...},    
  escapeinside={(*@}{@*)},
  extendedchars=true,            
  frame=single,                   
  keepspaces=true,                
  keywordstyle=\color{bluekeywords},       
  language=Java,              
  morekeywords={partial, var, value, get, set},           
  numbers=left,                  
  numbersep=5pt,                   
  numberstyle=\tiny\color{black}, 
  rulecolor=\color{Dgray},         
  showspaces=false,               
  showstringspaces=false,         
  showtabs=false,                  
  stepnumber=1,                    
  stringstyle=\color{redstrings},  
  tabsize=2,                      
  morekeywords= {new, std::*,},                
  title={}                         
}

I commented out captionpos=b and title={}, and now I get nothing underneath the listing as was what I wanted in OP. for output comparrison see:

Listing without caption or title

Upvotes: 1

Related Questions