TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I used listing for listing the codes like:


% Package to generate and customize Algorithm as per ACM style

% Document starts

% Title portion
\title{Some title}
\author{Some Author
\affil{Some University}}

\begin{lstlisting}[caption = video tag in HTML5]
<video id=``movie" width=``640" height=``480">

But I am not getting listings caption in a single line. It displays caption like

Listing 1.

I think the caption width is somehow minimized. Any idea about how I could fix this problem?

share|improve this question
up vote 6 down vote accepted

I don't know if this has adverse effects on other parts of the document, but saying


seems to solve the issue.

The acmsmall class uses \tempdimen to set the captions, but the captions built by listings don't set it to a sensible value and so use the default (which is zero).

share|improve this answer
Thanks for the help! – Sadiksha Gautam Jun 14 '12 at 20:45

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.