Ich habe das funktionierende Beispiel unten:
\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}
Wie kann ich die Überschrift länger machen? Mit anderen Worten, ich möchte, dass die Überschrift komplett in einer Zeile steht und keinen Zeilenumbruch hat
Antwort1
Drehen Sie einfach Ihre Umgebungen um. Verwenden Sie \centering
inside figure
, um den Inhalt zu zentrieren, und platzieren Sienurdas lstlisting
Innere eines minipage
(ich habe einige der unnötigen Pakete für Ihr MWE entfernt):
\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}