Re: Didascalie ambienti listings e pacchetto float

#33924
Venator85
Partecipante
    Up
    0
    Down
    ::


    Grande! Aggiungendo un frame attorno al listing il risultato è perfetto!
    `\documentclass[a4paper]{article}
    \usepackage{listings}
    \usepackage{float}

    \makeatletter
    \def\lst@makecaption#1#2{%
    \def\@fs@cfont{\bfseries}%
    \hrule\@height .8\p@\kern2\p@
    \floatc@ruled{#1}{#2}\par\kern\dp\strutbox\kern-1\p@}
    \makeatother

    \lstset{frame=tb}

    \floatstyle{ruled}
    \restylefloat{figure}
    \restylefloat{table}
    \restylefloat{listings}

    \begin{document}

    \begin{table}
    \begin{center}
    \begin{tabular}{c|c}
    aaa & bbb \\ \hline
    ccc & ddd \\
    \end{tabular}
    \end{center}
    \caption{Didascalia tabella qui.}
    \end{table}

    \begin{lstlisting}[float=tbp, caption={Didascalia listing qui.}]
    int main()
    {
    // un po' di codice qui…
    }
    \end{lstlisting}

    \end{document}
    `
    Grazie mille! 😉

    Go to top