0

I am trying to set a table in which I want to include some pictures. I tried different models of table, but I have two problems : 1. The table is really long and can not fit in one page. I can't find where to modify it (and how =)). 2. There is no space between words in my table (for example, it is written "AmphoredeKos" instead of "Amphore de Kos"). I don't know how I can modify this.

If someone could help me, that would be really nice !! Thank you a lot =) !!

Table 1 : Liste des échantillons prélevés au DRASSM 25.02.2019 textbf{-Partie 1-}

\newcolumntype{C}{>{$\displaystyle}Sc<$}
\cellspacetoplimit=2pt
\cellspacebottomlimit=2pt

\begin{center}
    \begin{tabular}{|l|*{7}{C|}} \hline \hline
    Ref.  &  Photo  &  Typologie  &  Informations sur l'\acute{e}chantillon  &  Poix  &  Tesson  & Objet \\ \hline \hline

    6545    &  
        \begin{minipage}{.13\textwidth}
        \includegraphics[width=20mm, height=20mm]{IMG_0716_min}
        \end{minipage} 
        &   Dressel 5    & Amphore de Kos  &   &   &  X \\ \hline

6828A   & 
\begin{minipage}{.13\textwidth}
      \includegraphics[width=20mm, height=20mm]{IMG_0718_min}
    \end{minipage}
    &                &   & X & X &  \\ 
    \hline
  • 2
    Why are you setting math mode? – egreg Mar 15 at 11:41
  • Thanks for the answer ! I am not sure I understood correctly your question ? What do you mean by "Math mode" ? – LouCh Mar 15 at 12:57
  • @LouCh: You could try with ` \begin{tabular}{|l|*{7}{c|}}` and l'échantillon. If you want to have italic text, use something like \textit{your text}. For includeing graphics in y table you might also be interested in the valign=t option offerd by the adjustbox package. – leandriis Mar 15 at 13:38
  • You put \displaystylebetween $ and $, which triggers mathmode. – Keks Dose Mar 15 at 13:46
  • You can split some of the titles over multiple lines, or perhaps use an acronym and a footnote with the full title., – John Kormylo Mar 15 at 14:41
1

The following MWE contains three different versions of your table.

In the first version, I have used the valign=t option in order to align the images with the text in adjacent cells. Additionally, I have used the cellspace package for some vertical white space and adjusted the horizontal white space around the images to match ter vertical white space. I have also used the makecell package in order to split up the column header of the 4th column into two lines so that the table is narrower and can fit into the textwidth. In oder to get a caption, I have used the table enivronment in combination with the \caption command.

In the second table, I have used the tabularx package in order to make the table as wide as the textwidth. This might be useful if the 4th column contains longer text.

In the third example, I have removed the vertical lines and replaced the horizontal lines by rules from the booktabs package:

enter image description here

\documentclass{article}
\usepackage{geometry}

\usepackage[demo]{graphicx} % Remove the demo option in your real document.
\usepackage{cellspace}
\usepackage[export]{adjustbox}

\usepackage{makecell} % Only for the first table

\usepackage{tabularx} % Only fr the second and third table

\usepackage{booktabs} % Only for the third table
\begin{document}

\begin{table}
\caption{Liste des échantillons prélevés au DRASSM 25.02.2019 \textbf{-Partie 1-}}
\cellspacetoplimit=2pt
\cellspacebottomlimit=2pt
\centering
    \begin{tabular}{|l|@{\hspace{2pt}}Sc@{\hspace{2pt}}|*{6}{c|}} \hline \hline
    Ref.  &  Photo  &  Typologie  & \makecell[cc]{ Informations \\ sur l'échantillon}  &  Poix  &  Tesson  & Objet \\ \hline \hline

    6545    &  
        \includegraphics[width=20mm, height=20mm,valign=t]{IMG_0716_min}
        &   Dressel 5    & Amphore de Kos  &   &   &  X \\ \hline

6828A   & 
      \includegraphics[width=20mm, height=20mm,valign=t]{IMG_0718_min}
    &                &   & X & X &  \\ 
    \hline
    \end{tabular}
\end{table}


\begin{table}
\caption{Liste des échantillons prélevés au DRASSM 25.02.2019 \textbf{-Partie 1-}}
\cellspacetoplimit=2pt
\cellspacebottomlimit=2pt
\centering
    \begin{tabularx}{\textwidth}{|l|@{\hspace{2pt}}Sc@{\hspace{2pt}}|c|X|*{3}{c|}} \hline \hline
    Ref.  &  Photo  &  Typologie  & Informations sur l'échantillon  &  Poix  &  Tesson  & Objet \\ \hline \hline

    6545    &  
        \includegraphics[width=20mm, height=20mm,valign=t]{IMG_0716_min}
        &   Dressel 5    & Amphore de Kos  &   &   &  X \\ \hline

6828A   & 
      \includegraphics[width=20mm, height=20mm,valign=t]{IMG_0718_min}
    &                &   & X & X &  \\ 
    \hline
    \end{tabularx}
\end{table}

\begin{table}
\caption{Liste des échantillons prélevés au DRASSM 25.02.2019 \textbf{-Partie 1-}}
\cellspacetoplimit=2pt
\cellspacebottomlimit=2pt
\centering
    \begin{tabularx}{\textwidth}{l@{\hspace{2pt}}Sc@{\hspace{2pt}}cX*{3}{c}} 
    \toprule
    Ref.  &  Photo  &  Typologie  & Informations sur l'échantillon  &  Poix  &  Tesson  & Objet \\ \midrule

    6545    &  
        \includegraphics[width=20mm, height=20mm,valign=t]{IMG_0716_min}
        &   Dressel 5    & Amphore de Kos  &   &   &  X \\ 

6828A   & 
      \includegraphics[width=20mm, height=20mm,valign=t]{IMG_0718_min}
    &                &   & X & X &  \\ 
    \bottomrule
    \end{tabularx}
\end{table}
\end{document}
  • Hey ! Thank you for this very well explained anwer ! I did understand a little bit more now. However, I have a list of 25 samples to include in the table and it does not fit in the same page. So I would like the table to be continued over few pages depending on the size of the table. For now, I am compiling three different documents that list all the samples and I would like to have only one document that could contain all the samples over 2/3 pages. Do you have any suggestion ? – LouCh Mar 19 at 14:31
  • @LouCh: In order to get a table that automatically spans multiple pages, you will need a longtable. If you want to use this in combination with the variable width X type columns from the tabularx package, you will need one of the following packages: ltxtable, ltablex or xtabular. – leandriis Mar 19 at 16:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.