3

I am trying to make a table with the multicolumn package. I know that you can either align a cell with:

 \multicolumn{[# of columns]}{l, c or r}{[text]} 

Or you can set the width of said multicolumn with:

\multicolumn{[# of columns]}{p{whatever size you wish}{[text]} 

My question is: Is it possible to both set the size of a column AND align it horizontally?

Here's the table I'm working on:

As you can see the cell "Detection humaine à l'intérieur du perimetre radial" (It's french) had his size fixed to 4cm (randomly chosen) and is no longer centered. enter image description here

And here's the code that generates it:

Thank you for your help.

    \section{Synth\`ese} \label{s:synthese}
    \begin{table}[!ht]
    \begin{center}
    \begin{tabular}{ccccc}

    \hline
    \multicolumn{1}{|c|}{} & \multicolumn{4}{c|}{\textbf{Concept}} \\ \hline
    %------------------------------------------------
    \multicolumn{1}{|c|}{\textbf{Critères d'évaluations}} & \multicolumn{1}{c|}{Perfomance} & \multicolumn{1}{c|}{Économie} & \multicolumn{1}{c|}{Légèreté} & \multicolumn{1}{c|}{Simplicité} \\ \hline
    %------------------------------------------------
    \multicolumn{1}{|c|}{Précision des images thermiques [mK]} & \multicolumn{1}{c|}{50} & \multicolumn{1}{c|}{100} & \multicolumn{1}{c|}{65} & \multicolumn{1}{c|}{65} \\\hline
    %------------------------------------------------
    \multicolumn{1}{|c|}{Résolution spatiale [mm]} & \multicolumn{1}{c|}{19} & \multicolumn{1}{c|}{3.3} & \multicolumn{1}{c|}{19} & \multicolumn{1}{c|}{19} \\\hline
    %------------------------------------------------
    \multicolumn{1}{|c|}{Stockage des données [To]} & \multicolumn{1}{c|}{4} & \multicolumn{1}{c|}{8} & \multicolumn{1}{c|}{4} & \multicolumn{1}{c|}{12} \\\hline
    %------------------------------------------------
    \multicolumn{1}{|c|}{Résolution temporelle des images thermiques [fps]} & \multicolumn{1}{c|}{60} & \multicolumn{1}{c|}{64} & \multicolumn{1}{c|}{50} & \multicolumn{1}{c|}{50} \\\hline
    %------------------------------------------------
    \multicolumn{1}{|c|}{Signal de sortie de la caméra thermique [bits]} & \multicolumn{1}{c|}{16} & \multicolumn{1}{c|}{bites me} & \multicolumn{1}{c|}{14} & \multicolumn{1}{c|}{14} \\\hline
    %------------------------------------------------
    \multicolumn{1}{|c|}{Interface de communication} & \multicolumn{1}{c|}{1} & \multicolumn{1}{c|}{1} & \multicolumn{1}{c|}{1} & \multicolumn{1}{c|}{1} \\\hline
    %------------------------------------------------
    \multicolumn{1}{|c|}{Facilité du pilotage} & \multicolumn{1}{c|}{1} & \multicolumn{1}{c|}{1} & \multicolumn{1}{c|}{1} & \multicolumn{1}{c|}{1} \\\hline
    %------------------------------------------------
    \multicolumn{1}{|c|}{Inspection autonome} & \multicolumn{1}{c|}{1} & \multicolumn{1}{c|}{0.75} & \multicolumn{1}{c|}{1} & \multicolumn{1}{c|}{1} \\\hline
    %------------------------------------------------
    \multicolumn{1}{|c|}{Vitesse de vol [m/s]} & \multicolumn{1}{c|}{10} & \multicolumn{1}{c|}{20} & \multicolumn{1}{c|}{6} & \multicolumn{1}{c|}{10} \\\hline
    %------------------------------------------------
    \multicolumn{1}{|c|}{Résistence au vent [km/h]} & \multicolumn{1}{c|}{36} & \multicolumn{1}{c|}{64} & \multicolumn{1}{c|}{97} & \multicolumn{1}{c|}{39.6} \\\hline
    %------------------------------------------------
    \multicolumn{1}{|c|}{Autonomie de vol [min]} & \multicolumn{1}{c|}{75} & \multicolumn{1}{c|}{34} & \multicolumn{1}{c|}{50} & \multicolumn{1}{c|}{70} \\\hline
    %------------------------------------------------
    \multicolumn{1}{|c|}{Poids du drone [kg]} & \multicolumn{1}{c|}{3.25} & \multicolumn{1}{c|}{2.27} & \multicolumn{1}{c|}{3.31} & \multicolumn{1}{c|}{2.915} \\\hline
    %------------------------------------------------
    \multicolumn{1}{|p{4cm}|}{Détection humaine à l'intérieur du périmètre radial [m]} & \multicolumn{1}{c|}{33.1} & \multicolumn{1}{c|}{33.1} & \multicolumn{1}{c|}{33.1} & \multicolumn{1}{c|}{33.1} \\\hline
    %------------------------------------------------
    \multicolumn{1}{|c|}{Efficacité des mesures d'urgence} & \multicolumn{1}{c|}{1} & \multicolumn{1}{c|}{1} & \multicolumn{1}{c|}{1} & \multicolumn{1}{c|}{1} \\\hline
    %------------------------------------------------
    \multicolumn{1}{|c|}{Sécurité constante des données} & \multicolumn{1}{c|}{1} & \multicolumn{1}{c|}{1} & \multicolumn{1}{c|}{1} & \multicolumn{1}{c|}{1} \\\hline
    %------------------------------------------------
    \multicolumn{1}{|c|}{Respect constant des conditions de vol} & \multicolumn{1}{c|}{1} & \multicolumn{1}{c|}{1} & \multicolumn{1}{c|}{1} & \multicolumn{1}{c|}{0.5} \\\hline
    %------------------------------------------------
    \multicolumn{1}{|c|}{Coût total de production [\$]} & \multicolumn{1}{c|}{70 744} & \multicolumn{1}{c|}{13 920} & \multicolumn{1}{c|}{24 128} & \multicolumn{1}{c|}{67 130} \\\hline

    \end{tabular}
    \end{center}
    \end{table}
2

For a nicer output I would reduce the number of lines (see the documentation of package booktabs).

The table is quite broad (too broad for a standard page layout). Likely other cells in the first columns need multiple lines, too. Package tabularx provides an X column specification, which grabs the remaining space.

The following example sets the first lines left aligned, but it indents the consecutive lines as optical hint, which lines belong together:

\documentclass{article}
\usepackage{array}
\usepackage{booktabs}
\usepackage{siunitx}
\usepackage{tabularx}
\usepackage[utf8]{inputenc}
\begin{document}
  \section{Synth\`ese} \label{s:synthese}
  \begin{table}[!ht]
  \centering
  \small % since the table is still quite broad
  \begin{tabularx}{\linewidth}{
    >{\raggedright\hangindent1em\hangafter1\relax}X
    cccc
  }
    \toprule
    & \multicolumn{4}{c}{\textbf{Concept}} \\
    \cmidrule{2-5}
    %------------------------------------------------
    \textbf{Critères d'évaluations} &
    Perfomance & Économie & Légèreté & Simplicité \\
    \midrule
    %------------------------------------------------
    Précision des images thermiques [mK] &
    50 & 100 & 65 & 65 \\
    %------------------------------------------------
    Résolution spatiale [mm] &
    19 & 3.3 & 19 & 19 \\
    %------------------------------------------------
    Stockage des données [To] &
    4 & 8 & 4 & 12 \\
    %------------------------------------------------
    Résolution temporelle des images thermiques [fps] &
    60 & 64 & 50 & 50 \\
    %------------------------------------------------
    Signal de sortie de la caméra thermique [bits] &
    16 & bites me & 14 & 14 \\
    %------------------------------------------------
    Interface de communication &
    1 & 1 & 1 & 1 \\
    %------------------------------------------------
    Facilité du pilotage &
    1 & 1 & 1 & 1 \\
    %------------------------------------------------
    Inspection autonome &
    1 & 0.75 & 1 & 1 \\
    %------------------------------------------------
    Vitesse de vol [m/s] &
    10 & 20 & 6 & 10 \\
    %------------------------------------------------
    Résistence au vent [km/h] &
    36 & 64 & 97 & 39.6 \\
    %------------------------------------------------
    Autonomie de vol [min] &
    75 & 34 & 50 & 70 \\
    %------------------------------------------------
    Poids du drone [kg] &
    3.25 & 2.27 & 3.31 & 2.915 \\
    %------------------------------------------------
    Détection humaine à l'intérieur du périmètre radial [m] &
    33.1 & 33.1 & 33.1 & 33.1 \\
    %------------------------------------------------
    Efficacité des mesures d'urgence &
    1 & 1 & 1 & 1 \\
    %------------------------------------------------
    Sécurité constante des données &
    1 & 1 & 1 & 1 \\
    %------------------------------------------------
    Respect constant des conditions de vol &
    1 & 1 & 1 & 0.5 \\
    %------------------------------------------------
    Coût total de production [\$] &
    \num{70 744} & \num{13 920} & \num{24 128} & \num{67 130} \\
    \bottomrule
  \end{tabularx}
\end{table}
\end{document}

Result

0

Probably you looking for something like this:

enter image description here

For design of table you first need to read some basic literature about LaTeX. YOur use of multicolumns is awful ... For above picture I clean-up your code -- now is significantly more shorter -- as you can see below:

\documentclass[twocolumn]{article}
\usepackage{array}
\newcolumntype{P}[1]{>{\centering\arraybackslash}p{#1}}
\begin{document}
\begin{table}[htb]\centering
    \begin{tabular}{|P{5cm}|c|c|c|c|}
    \hline
    \multicolumn{1}{|c|}{}& \multicolumn{4}{c|}{\textbf{Concept}}\\ \hline
    %------------------------------------------------
\textbf{Critères d'évaluations}& Perfomance& Économie& Légèreté& Simplicité\\ \hline
    %------------------------------------------------
Précision des images thermiques [mK]& 50& 100& 65& 65 \\\hline
    %------------------------------------------------
Résolution spatiale [mm]& 19& 3.3& 19& 19\\\hline
    %------------------------------------------------
Stockage des données [To]& 4& 8& 4& 12\\\hline
    %------------------------------------------------
Résolution temporelle des images thermiques [fps]& 60& 64& 50& 50\\\hline
    %------------------------------------------------
Signal de sortie de la caméra thermique [bits]& 16& bites me & 14& 14\\\hline
    %------------------------------------------------
Interface de communication& 1& 1& 1& 1\\\hline
    %------------------------------------------------
Facilité du pilotage& 1& 1& 1& 1\\\hline
    %------------------------------------------------
Inspection autonome& 1& 0.75& 1& 1\\\hline
    %------------------------------------------------
Vitesse de vol [m/s]& 10& 20& 6& 10\\\hline
    %------------------------------------------------
Résistence au vent [km/h]& 36& 64& 97& 39.6\\\hline
    %------------------------------------------------
Autonomie de vol [min]& 75& 34& 50& 70\\\hline
    %------------------------------------------------
Poids du drone [kg]& 3.25& 2.27& 3.31& 2.915\\\hline
    %------------------------------------------------
Détection humaine à l'intérieur du périmètre radial [m] & 33.1& 33.1& 33.1& 33.1\\\hline
    %------------------------------------------------
Efficacité des mesures d'urgence& 1& 1& 1& 1\\\hline
    %------------------------------------------------
Sécurité constante des données& 1& 1& 1& 1\\\hline
    %------------------------------------------------
Respect constant des conditions de vol& 1& 1& 1& 0.5 \\\hline
    %------------------------------------------------
Coût total de production [\$]& 70 744& 13 920& 24 128& 67 130\\\hline
    \end{tabular}
\end{table}
\end{document}

As you can see, for centering of text in cels with p{...} column type I defined new column type P. For this you eed to load package array.

For better looking of table, is very informative look this on-line presentation or look many examples of table design, which can fine on SE. Maybe for the first step you not use vertical lines, employ siunitx package for better number formatting etc.

Edit: Meanwhile I play with your table to see how to improve looking of your table, Heiko bit me with nice example. Anyway, since my suggestion is slightly different, see, if you can use/learn for future table designs

\documentclass[twocolumn]{article}
\usepackage[utf8]{inputenc}
\usepackage{siunitx}
\usepackage{ragged2e}
\usepackage{array,booktabs,makecell}
\renewcommand\theadfont{\bfseries\sffamily}
\newcolumntype{P}[1]{>{\RaggedRight\arraybackslash}p{#1}}

\begin{document}
\begin{table}[htb]\centering
    \renewcommand{\arraystretch}{1.2}
\begin{tabular}{P{5cm}*{4}{S[table-format=3.3]}}%c|c|c|c|
                                        \toprule
    &   \multicolumn{4}{c}{\thead{Concept}}
                                    \\  \cmidrule{2-5}
\thead{Critères d'évaluations}
    &   {\thead{Perfomance}} 
        &   {\thead{Économie}} 
            &   {\thead{Légèreté}} 
                &   {\thead{Simplicité}}
                                    \\ \midrule
Précision des images thermiques [mK]
    & 50 & 100 & 65 & 65            \\
Résolution spatiale [mm]
    & 19 & 3.3 & 19 & 19            \\
Stockage des données [To]
    & 4 & 8 & 4 & 12                \\
Résolution temporelle des images thermiques [fps]
    & 60 & 64 & 50 & 50             \\
Signal de sortie de la caméra thermique [bits]
    & 16 & {bites me} & 14 & 14     \\
Interface de communication
    & 1 & 1 & 1 & 1                 \\
Facilité du pilotage
    & 1 & 1 & 1 & 1                 \\
Inspection autonome
    & 1 & 0.75 & 1 & 1              \\
Vitesse de vol [m/s]
    & 10 & 20 & 6 & 10              \\
Résistence au vent [km/h]
    & 36 & 64 & 97 & 39.6           \\
Autonomie de vol [min]
    & 75 & 34   & 50 & 70           \\
Poids du drone [kg]
    & 3.25 & 2.27 & 3.31 & 2.915    \\
Détection humaine à l'intérieur du périmètre radial [m] 
    & 33.1 & 33.1   & 33.1  & 33.1  \\
Efficacité des mesures d'urgence
    & 1 & 1 & 1 & 1                 \\
Sécurité constante des données
    & 1 & 1 & 1 & 1                 \\
Respect constant des conditions de vol
    & 1 & 1 & 1 & 0.5               \\
Coût total de production [\$]
    & \num{70 744} & \num{13 920} & \num{24 128} & \num{67 130}
                                    \\  \bottomrule
    \end{tabular}
\end{table}
\end{document}

enter image description here

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.