Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I used listing for listing the codes like:

\documentclass[prodmode,acmtecs]{acmsmall}

% Package to generate and customize Algorithm as per ACM style
\usepackage[ruled]{algorithm2e}
\usepackage{listings}
\usepackage{array}
\renewcommand{\algorithmcfname}{ALGORITHM}
\SetAlFnt{\small}
\SetAlCapFnt{\small}
\SetAlCapNameFnt{\small}
\SetAlCapHSkip{0pt}
\IncMargin{-\parindent}

% Document starts
\begin{document}

% Title portion
\title{Some title}
\author{Some Author
\affil{Some University}}
\maketitle
\lstset{
    frame=tblr
    }

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

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

Listing 1.
video
tag
in
HTML5

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

share|improve this question
add comment

1 Answer

up vote 4 down vote accepted

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

\AtBeginDocument{\setlength{\tempdimen}{\textwidth}}

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
add comment

Your Answer

 
discard

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.