titolo long table

  • Creatore
    Topic
  • #119619
    claudio
    Partecipante
      Up
      0
      Down
      ::


      Salve
      la tabella che segue è la versione corta di una molto lunga.
      Il problema è l’intestazione che non si adegua ai numeri che possono avere anche quattro cifre.
      E’ possibile rendere automatica la distanza tra n e l?

      `
      \documentclass[10pt,a4paper]{article}
      \usepackage[utf8]{inputenc}
      \usepackage[T1]{fontenc}
      \usepackage{longtable}
      \usepackage{booktabs}
      \begin{document}
      \begin{longtable}{llllll}\toprule
      \caption{Numero e lunghezza ciclo}\\
      \midrule
      \textbf{n l} & \textbf{n l} & \textbf{n l} & \textbf{n l}& \textbf{n l} & \textbf{n l}\\
      \midrule
      \endfirsthead
      \multicolumn{6}{c} {\tablename\ \thetable\ — \textit{Continua dalla pagina precedente}} \\
      \textbf{n l} & \textbf{n l} & \textbf{n l} & \textbf{n l}& \textbf{n l} & \textbf{n l}\\
      \toprule
      \endhead
      \bottomrule
      \multicolumn{6}{r} {\textit{Continua nella pagina successiva}} \\
      \endfoot
      \endlastfoot
      1 3&2 1&3 7&4 2&5 5&6 8\\
      7 16&8 3&9 19&10 6&11 14&12 9\\
      13 9&14 17&15 17&16 4&17 12&18 20\\
      19 20&20 7&21 7&22 15&23 15&24 10\\
      25 23&26 10&27 111&28 18&29 18&30 18\\
      31 106&32 5&33 26&34 13&35 13&36 21\\
      37 21&38 21&39 34&40 8&41 109&42 8\\
      43 29&44 16&45 16&46 16&47 104&48 11\\
      49 24&50 24&51 24&52 11&53 11&54 112\\
      55 112&56 19&57 32&58 19&59 32&60 19\\
      \bottomrule\end{longtable}
      \end{document}
      `
      saluti
      claudio

    Visualizzazione 1 filone di risposte
    • Autore
      Risposte
      • #119620
        samiel
        Partecipante
          Up
          0
          Down
          ::


          se proprio vuoi mantenere quell’allineamento delle cifre, basta mettere
          `\multicolumn{6}{c} {\tablename\ \thetable\ — \textit{Continua dalla pagina precedente}} \\`,
          cioè modificare il primo allineamento, se ho ben capito ciò che vuoi ottenere

          m

        • #119621
          samiel
          Partecipante
            Up
            0
            Down
            ::


            se allinei a sinistra le cifre, com’è ovvio 1234 finirà sempre dopo 12
            e di conseguenza i numeri successivi erediteranno un diverso punto di inizio.
            ma soprattutto, impostati come fai tu, n e l saranno disallineati,
            perché “tabularizzati” a due a due con uno spazio in mezzo.
            Se proprio vuoi mantenere quell’allineamento delle cifre (a sinistra),
            al di là della discutibile leggibilità, dovresti modificare anche le intestazioni:
            `\documentclass[10pt,a4paper]{article}
            \usepackage[utf8]{inputenc}
            \usepackage[T1]{fontenc}
            \usepackage{longtable}
            \usepackage{booktabs}
            \begin{document}
            \begin{longtable}{llllllll}
            \toprule
            \caption{Numero e lunghezza ciclo} \\
            \midrule
            \textbf{n} & \textbf{l} & \textbf{n} & \textbf{l} & \textbf{n} & \textbf{l} & \textbf{n} & \textbf{l} \\
            \midrule
            \endfirsthead
            \multicolumn{8}{c} {\tablename\ \thetable\ — \textit{Continua dalla pagina precedente}} \\
            \textbf{n} & \textbf{l} & \textbf{n} & \textbf{l} & \textbf{n} & \textbf{l} & \textbf{n} & \textbf{l} \\
            \toprule
            \endhead
            \bottomrule
            \textbf{n} & \textbf{l} & \textbf{n} & \textbf{l} & \textbf{n} & \textbf{l} & \textbf{n} & \textbf{l} \\
            \endfoot
            \endlastfoot
            1 & 3 & 2 & 3 & 7 & 4 & 2 & 5 \\
            31 & 60 & 32 & 33 & 34 & 13 & 35 & 13 \\
            379 & 214 & 380 & 221 & 393 & 474 & 641 & 109 \\
            4990 & 2456 & 2250 & 2476 & 5124 & 5213 & 5378 & 1154 \\
            \bottomrule
            \end{longtable}
            \end{document}`

            m

        Visualizzazione 1 filone di risposte
        • Devi essere connesso per rispondere a questo topic.

        Go to top