這讓我瘋狂。Centre Latex lstlisting
我想在LaTeX中集中一個列表。
3小時後嘗試這裏的一些代碼:
\lstset{ %
caption=Descriptive Caption Text,
label=lst:descr_capti_text,
basicstyle=\ttfamily\footnotesize\bfseries,
frame=tb,
linewidth=0.6\textwidth
}
\centering\begin{tabular}{c}
\begin{lstlisting}
printf("this should be centered!");
\end{lstlisting}
\end{tabular}
這是把在中心lstlisting但不是它的標題,即轉到正確的。如果我拿出表格,那麼標題會居中,但代碼會在左邊! :(
謝謝。
只是想我會提[乳膠StackExchange建議(http://area51.stackexchange.com/proposals/2148/tex-latex-and-朋友?referrer = 5z6F4dAmVScN5QfMOt5KEg2),因爲一旦起飛,它將成爲這類問題的最佳場所。 – 2010-06-24 01:25:29