usare insieme table e longtable

  • Creatore
    Topic
  • #8546
    Up
    0
    Down
    ::


    Salve a tutti,
    spesso creo tabelle riassuntive di determinati argomenti, tipicamente con due colonne:
    campo-descrizione.
    Non sono molto lunghe, ma per integrarle nella trattazione di un argomento senza lasciare spazi bianchi utilizzo l’ambiente ”longtable”, così le righe che entrano in una pagina vengono inserite, le altre saranno su quella successiva:
    `
    \begin{longtable}{m{.4\textwidth} m{.5\textwidth}}
    \toprule
    \toprule

    \bottomrule
    \end{longtable}
    `

    Casualmente però ho notato che se racchiudo un ambiente ”longtable” in uno ”table”
    le tabelle risultano molto più belle e compatte, la spaziatura tra le righe diminuisce, cosa che mi sarebbe utile, però le tabelle non si spezzano più su più di una pagina!

    `
    \begin{table}
    \begin{longtable}{m{.4\textwidth} m{.5\textwidth}}
    \toprule
    \toprule

    \bottomrule
    \end{longtable}
    \end{table}
    `

    C’è un modo per ottenere la compattezza di una ”table” e contemporaneamente dire a Latex di inserire le righe dalla tabella subito dopo l’ultimo rigo di testo scritto spezzando eventualmente la tabella?

Visualizzazione 4 filoni di risposte
  • Autore
    Risposte
    • #8547
      Up
      0
      Down
      ::


      Ciao.
      Che classe usi? Pacchetti extra?
      Ho fatto delle prove ma a me vengono le stesse spaziature sia con che senza table.

      Ciao,
      Roberto.

    • #8548
      Up
      0
      Down
      ::


      Posto l’header del documento con due tabella identiche, una inserita in un ambiente “table” e l’altra no!
      `
      \documentclass[a4paper,12pt,titlepage,oneside]{extreport}
      \usepackage [italian]{babel}
      \usepackage [latin1]{inputenc}
      \usepackage{url}
      \usepackage{appendix, amsthm}
      \usepackage{fancyhdr,fancyvrb}
      \usepackage{xcolor}
      \usepackage{titlesec}
      \usepackage{paralist,colortbl,booktabs,longtable}
      \usepackage{graphicx,PSTricks}
      \usepackage{newcent,setspace}
      \usepackage[font=normalsize, labelfont=bf, textfont=up, width=.8\textwidth, hangindent=1.9cm]{caption}

      \definecolor{mylightlightblue}{RGB}{238,238,246}
      \fvset{commentchar = £, fontseries = b, frame = lines, baselinestretch = 1.1, framesep = 5mm, rulecolor=\color{myblue}, framerule = 1pt,
      commandchars=\\\{\}}
      \linespread{1.5}

      \setlength{\skip\footins}{20pt}

      \fancypagestyle{plain} { \fancyhf{} \fancyfoot[R]{\bfseries \thepage}
      \renewcommand{\headrulewidth}{0pt} %
      \renewcommand{\footrulewidth}{0pt}
      }

      \pagestyle{fancy} %
      \fancyhead{}\fancyfoot{} %
      \newcommand{\notechar} { \fontsize{10pt}{9pt} \fontfamily{pnc} \selectfont}
      \renewcommand{\chaptermark}[1]{\markboth{\MakeUppercase \chaptername\ \thechapter\ \ \ #1}{}} %
      \fancyhead[R]{ \notechar\bfseries \leftmark } %
      \fancyfoot[R]{\thepage} %
      %
      \titlespacing*{\chapter}{0pt}{-0.5cm}{20pt}[ 0pt]
      \titleformat{\section}[block]{\large \bfseries \fontfamily{pnc}\selectfont }{\thesection }{15pt}{}
      \titleformat{\subsection}[block]{\normalsize\bfseries \fontfamily{pnc}\selectfont }{\thesubsection }{15pt}{}%
      \titleformat{\subsubsection}[block]{\normalsize\bfseries \fontfamily{pnc}\selectfont }{\thesubsubsection }{15pt}{}

      \titlespacing*{\section}{0pt}{+0.8cm}{2mm}[0pt] %
      \titlespacing*{\subsection}{0pt}{+0.8cm}{2mm}[ 0pt]
      \titlespacing*{\subsubsection}{0pt}{+0.8cm}{2mm}[ 0pt]
      %%
      \begin {document}

      \pagenumbering{Roman} %

      \tableofcontents \addcontentsline{toc}{chapter}{\numberline{}\contentsname} % Aggiunte all'indice (toc)
      \listoffigures \addcontentsline{toc}{chapter}{\numberline{}\listfigurename} %
      \listoftables \addcontentsline{toc}{chapter}{\numberline{}\listtablename} %

      \clearpage
      \titleformat{\chapter}[display]{\Large \bfseries \fontfamily{pnc}\selectfont}
      {\quad Capitolo \thechapter} %
      {20pt} %
      {\titlerule[1pt] \vspace{1pt} \titlerule \vspace{1pt} \quad} %
      %
      [\titlerule \vspace{1pt} \titlerule \vspace{1pt} \quad] %
      \pagenumbering{arabic} %

      %\begin{table}
      \centering
      \begin{longtable}{m{.4\textwidth} m{.55\textwidth}}
      \toprule
      \toprule
      \rowcolor{mylightlightblue}
      Primitive Concept Retrieval & \texttt{

      }\\
      \midrule
      Satisfiability & \texttt{C
      C1 C2
      C1 C2}\\
      \midrule
      \rowcolor{mylightlightblue}
      Concept Hierarchy & \texttt{C C C C
      C} \\
      \midrule
      Role Hierarchy & \texttt{R
      R R
      R}\\
      \midrule
      \rowcolor{mylightlightblue}
      Individual Queries & \texttt{C
      I I C I R R
      I A}\\
      \bottomrule \\
      \caption{Costrutti DIG delle richieste \emph{ask}.}\label{tab:DIGask}
      \end{longtable}
      %\end{table}
      %
      \begin{table}
      \centering
      \begin{longtable}{m{.4\textwidth} m{.55\textwidth}}
      \toprule
      \toprule
      \rowcolor{mylightlightblue}
      Primitive Concept Retrieval & \texttt{

      }\\
      \midrule
      Satisfiability & \texttt{C
      C1 C2
      C1 C2}\\
      \midrule
      \rowcolor{mylightlightblue}
      Concept Hierarchy & \texttt{C C C C
      C} \\
      \midrule
      Role Hierarchy & \texttt{R
      R R
      R}\\
      \midrule
      \rowcolor{mylightlightblue}
      Individual Queries & \texttt{C
      I I C I R R
      I A}\\
      \bottomrule \\
      \caption{Costrutti DIG delle richieste \emph{ask}.}\label{tab:DIGask}
      \end{longtable}
      \end{table}

      \end {document}
      `

    • #8549
      Up
      0
      Down
      ::


      Ciao.

      Ovviamente il problema sta in \linespread. Problema noto (qui).

      Soluzione: usare il pacchetto setspace con questa sintassi:

      `
      \usepackage{setspace}
      .
      .
      .
      \begin{singlespace}
      \begin{longtable}{…}

      \end{longtable}
      \end{singlespace}
      `

      Semmai puoi ridefinirti l’ambiente longtable per implementare direttamente l’interlinea singola.

      Ciao,
      Roberto.

    • #8550
      Up
      0
      Down
      ::

      Salve a tutti,
      spesso creo tabelle riassuntive di determinati argomenti, tipicamente con due colonne:
      campo-descrizione.

      Casualmente però ho notato che se racchiudo un ambiente ”longtable” in uno ”table”
      le tabelle risultano molto più belle e compatte, la spaziatura tra le righe diminuisce, cosa che mi sarebbe utile, però le tabelle non si spezzano più su più di una pagina!

      Non ha alcun senso inserire longtable in un ambiente table. Basta tabular. E non usare righe doppie!!! 😀

      Ciao
      Enrico

    • #8551
      Up
      0
      Down
      ::


      😀 😀 😀 😀 😀
      Grazie!

Visualizzazione 4 filoni di risposte
  • Devi essere connesso per rispondere a questo topic.

Go to top