6

Obviously, the caption is not beautifully placed; it needs more space between the caption text and the frame/listing itself.

How can I do that?

I am using the IEEEtran document class and the package listings, if this is important. The related code is

\documentclass[10pt, conference]{IEEEtran}
\IEEEoverridecommandlockouts
\usepackage{listings}
\begin{document}
\lstset{basicstyle=\normalsize\ttfamily, breaklines=true, xleftmargin=2em, frame=single, framexleftmargin=15pt} 
\begin{lstlisting}[caption={Search-based change access}, label={lst:query}]
<url>/changes/?q=change:<change_id>&o=LABELS&o=DETAILED_LABELS&o=DETAILED_ACCOUNTS&o=REVIEWER_UPDATES&o=MESSAGES
\end{lstlisting}    
\end{document}

enter image description here

6
  • Sure, documentclass is important. How is the listing appearing there? Magic? Which package are you using? Do you use it properly? A minimal working example would be needed to tell.
    – Johannes_B
    Commented Jan 12, 2019 at 17:59
  • Sorry, my bad. I added a minimal example. Commented Jan 12, 2019 at 18:02
  • Usually takes people about half an hour to post a minimal working example. I guess usually they take the time to read what it is and then try to create it. Sorry.
    – Johannes_B
    Commented Jan 12, 2019 at 18:03
  • Is this not sufficient? Commented Jan 12, 2019 at 18:04
  • Sorry, i have seen just three lines there. Should be ok.
    – Johannes_B
    Commented Jan 12, 2019 at 18:06

1 Answer 1

5

The caption package cooperates with listings:

\documentclass[10pt, conference]{IEEEtran}
\IEEEoverridecommandlockouts
\usepackage{listings}
\usepackage{caption}

\begin{document}

\lstset{basicstyle=\normalsize\ttfamily, breaklines=true, xleftmargin=2em, frame=single, framexleftmargin=15pt, belowcaptionskip=8pt}
\begin{lstlisting}[caption={Search-based change access}, label={lst:query}]
<url>/changes/?q=change:<change_id>&o=LABELS&o=DETAILED_LABELS&o=DETAILED_ACCOUNTS&o=REVIEWER_UPDATES&o=MESSAGES
\end{lstlisting}

\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .