Tornando as legendas das figuras mais largas

Tornando as legendas das figuras mais largas

Eu tenho o exemplo de trabalho abaixo:

\documentclass[a4paper,11pt,twoside]{report}
\usepackage[left=2.5cm,right=2cm,top=2cm,bottom=2cm]{geometry}
\usepackage[T1]{fontenc}
\usepackage{amsmath, graphicx, tikz, enumerate, amssymb, pgf}

\usepackage{setspace}
\usepackage{pgfplots}
\usepackage{slashbox}
\usepackage{bchart}
\usepackage{float}
\restylefloat{table}
\usepackage{caption}

\usepackage{listings}
\usepackage{color}
\usepackage{textcomp}
\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=C++,
  aboveskip=3mm,
  belowskip=3mm,
  showstringspaces=false,
  columns=flexible,
  %basicstyle={\small\ttfamily},
  basicstyle=\ttfamily\footnotesize\bfseries,
  numbers=none,
  numberstyle=\tiny\color{gray},
  %keywordstyle=\color{blue},
  commentstyle=\color{dkgreen},
  %stringstyle=\color{mauve},
  breaklines=true,
  breakatwhitespace=true,
  tabsize=3
}



\begin{document}

\begin{center}
\begin{minipage}{.45\linewidth}
\begin{figure}[H]
\begin{lstlisting}
# Query 0 -- Type: Truth, Instructions: 0
array stat_1[144] : w32 -> w8 = symbolic
(query [(Eq false
            (Eq 0
                N0:(ReadLSB w64 56 stat_1)))
        (Eq false
            (Eq 0 N1:(URem w64 8 N0)))
        (Eq false
            (Eq 0 (URem w64 N0 N1)))]
       (Eq false
           (Eq 0 N2:(Read w8 56 stat_1))))
#   OK -- Elapsed: 39.8942
#   Is Valid: true


\end{lstlisting}
\caption{A query instance logged by the PC-Logging Solver}
\end{figure}
\end{minipage}

\end{center}

\end{document}

Como posso fazer a legenda ser mais longa? Em outras palavras, quero que toda a legenda esteja em uma única linha e não faça uma quebra de linha

Responder1

Basta inverter seus ambientes. Use \centeringdentro figurepara centralizar o conteúdo e coloqueapenaso lstlistinginterior de a minipage(removi alguns dos pacotes desnecessários para o seu MWE):

insira a descrição da imagem aqui

\documentclass[a4paper,11pt,twoside]{report}
\usepackage[left=2.5cm,right=2cm,top=2cm,bottom=2cm]{geometry}% http://ctan.org/pkg/geometry

\usepackage{listings}% http://ctan.org/pkg/listings
\usepackage{color}% http://ctan.org/pkg/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=C++,
  aboveskip=3mm,
  belowskip=3mm,
  showstringspaces=false,
  columns=flexible,
  %basicstyle={\small\ttfamily},
  basicstyle=\ttfamily\footnotesize\bfseries,
  numbers=none,
  numberstyle=\tiny\color{gray},
  %keywordstyle=\color{blue},
  commentstyle=\color{dkgreen},
  %stringstyle=\color{mauve},
  breaklines=true,
  breakatwhitespace=true,
  tabsize=3
}

\begin{document}

\begin{figure}
\centering
\begin{minipage}{.45\linewidth}
\begin{lstlisting}
# Query 0 -- Type: Truth, Instructions: 0
array stat_1[144] : w32 -> w8 = symbolic
(query [(Eq false
            (Eq 0
                N0:(ReadLSB w64 56 stat_1)))
        (Eq false
            (Eq 0 N1:(URem w64 8 N0)))
        (Eq false
            (Eq 0 (URem w64 N0 N1)))]
       (Eq false
           (Eq 0 N2:(Read w8 56 stat_1))))
#   OK -- Elapsed: 39.8942
#   Is Valid: true
\end{lstlisting}
\end{minipage}
\caption{A query instance logged by the PC-Logging Solver}
\end{figure}

\end{document}​

informação relacionada