1

How can I center this cell text?

enter image description here

 \documentclass[12pt]{article}
    \usepackage[utf8]{inputenc}
    \usepackage{graphicx}
    \usepackage[left=1.27cm,right=1.27cm,top=0.7cm,bottom=1.3cm]{geometry}
    \usepackage{fancyhdr}
    \usepackage{array,multirow,makecell}
    \usepackage{colortbl} 
    \usepackage{xcolor}
    \usepackage{here}
    \newcolumntype{R}[1]{>{\raggedleft\arraybackslash }b{#1}}
    \newcolumntype{L}[1]{>{\raggedright\arraybackslash }b{#1}}
    \newcolumntype{C}[1]{>{\centering\arraybackslash }b{#1}}
    \pagestyle{fancy}
    
    
    % pour les pieds de page
    \cfoot{ \textsubscript{ Trame du document : FOR\_TEMPLATE }}
    \rfoot{\textsubscript{ \color{red} Ne pas reproduire / Copie contrôlée}}
    \begin{document}
    \begin{table}[!h]
        \centering
        \begin{tabular}{|C{3cm}|L{13.9cm}|}
            \hline
            \rowcolor[RGB]{33,88,104}\multicolumn{2}{|c|}{\textbf{\color{white} Abbreviation }} \\ \hline
            \textbf{Abbreviation} &  \textbf{Meaning} \\ \hline
            COO & Chief Operating Officer   \\ \hline
            RQ \& AR    & Regulatory Affairs and Quality Manager  \\ \hline
            ANSM & Agence Nationale de Sécurité du Médicament et des produits de santé (National drug and medical devices agency) \\ \hline
            CPP & Comité de Protection des Personnes (Ethics Committee) \\ \hline
            CNIL & Commission Nationale Informatique et Liberté (French data protection agency) \\ \hline
            CER & Clinical Evaluation Report \\ \hline 
            IFU &   Instructions For Use \\ \hline
            NC &    Non-conformity \\ \hline
            PMSR &  Post-Market Surveillance Report \\ \hline
            PSUR &  Periodic Safety Update Report  \\ \hline
            CAPA &  Corrective and Preventive Actions \\ \hline
            
        \end{tabular}
    \end{table}
    
    \end{document}
2

3 Answers 3

4

With tabularray package is simple:

\documentclass[12pt]{article}
\usepackage{graphicx}
\usepackage[hmargin=1.27cm,top=0.7cm,bottom=1.3cm]{geometry}
\usepackage{xcolor}
\usepackage{tabularray}

\begin{document}
    \begin{table}
\begin{tblr}{hlines, vlines,
             colspec = {Q[l,m] X[l, m]},
              row{1} = {font=\bfseries, bg=teal, fg=white}
              row{2} = {font=\bfseries}
              }
\SetCell[c=2]{c}  Abbreviation
            &                                           \\
Abbreviation    &   Meaning                             \\ 
COO         & Chief Operating Officer                   \\
RQ \& AR    & Regulatory Affairs and Quality Manager    \\
ANSM        & Agence Nationale de Sécurité du Médicament 
et des produits de santé (National drug and medical devices agency) \\
CPP         & Comité de Protection des Personnes (Ethics Committee) \\
CNIL        & Commission Nationale Informatique et Liberté (French data protection agency)  \\
CER         & Clinical Evaluation Report \\
IFU         & Instructions For Use \\
NC          & Non-conformity \\
PMSR        & Post-Market Surveillance Report \\
PSUR        & Periodic Safety Update Report  \\
CAPA        & Corrective and Preventive Actions \\ 
\end{tblr}
    \end{table}
\end{document}

enter image description here

but you may liked the following table design:

\documentclass[12pt]{article}
\usepackage{graphicx}
\usepackage[hmargin=1.27cm,top=0.7cm,bottom=1.3cm]{geometry}
\usepackage{xcolor}
\usepackage{tabularray}
\UseTblrLibrary{booktabs}
  \ExplSyntaxOn
\NewChildSelector{eachthree}
  {
    \int_step_inline:nnnn {6}{3}{\l_tblr_childs_total_tl}
      { \clist_put_right:Nn \l_tblr_childs_clist {##1} }
  }
\ExplSyntaxOff

\begin{document}
    \begin{table}
\begin{tblr}{colspec = {Q[l] X[l]},
              row{1} = {font=\bfseries, bg=teal, fg=white},
              row{2} = {font=\bfseries},
             row{3-Z} = {rowsep=0.5pt},
             row{eachthree} = {abovesep=1.5ex}
             }
\SetCell[c=2]{c}  Abbreviation
            &                                           \\
Abbreviation    &   Meaning                             \\ 
    \midrule
COO         & Chief Operating Officer                   \\
RQ \& AR    & Regulatory Affairs and Quality Manager    \\
ANSM        & Agence Nationale de Sécurité du Médicament 
et des produits de santé (National drug and medical devices agency) \\
CPP         & Comité de Protection des Personnes (Ethics Committee) \\
CNIL        & Commission Nationale Informatique et Liberté (French data protection agency)  \\
CER         & Clinical Evaluation Report            \\
IFU         & Instructions For Use                  \\
NC          & Non-conformity                        \\
PMSR        & Post-Market Surveillance Report       \\
PSUR        & Periodic Safety Update Report         \\
CAPA        & Corrective and Preventive Actions     \\ 
    \bottomrule
\end{tblr}
    \end{table}
\end{document}

enter image description here

2

The width of the table is almost equal to \textwidth. Why not go all the way and set it to \textwidth directly? Then, use a tabularx environment, allow automatic line breaking in the second column, and issue the instruction

\renewcommand\tabularxcolumn[1]{m{#1}}

to induce vertical centering in the non-X columns

enter image description here

\documentclass[12pt]{article}
    %\usepackage[utf8]{inputenc} % that's the default nowadays
    \usepackage[T1]{fontenc}
    %%\usepackage[french]{babel}
    %\usepackage{graphicx}
    \usepackage[hmargin=1.27cm,top=0.7cm,bottom=1.3cm]{geometry}
    %\usepackage{array,multirow,makecell}
    %%%\usepackage{colortbl} 
    \usepackage[table]{xcolor}
    %%%\usepackage{here}
    %\newcolumntype{R}[1]{>{\raggedleft\arraybackslash}m{#1}}
    %\newcolumntype{L}[1]{>{\raggedright\arraybackslash}m{#1}}
    %\newcolumntype{C}[1]{>{\centering\arraybackslash}m{#1}}
    
    \usepackage{tabularx}
    \renewcommand\tabularxcolumn[1]{m{#1}} % vertical centering
    
    \usepackage{fancyhdr}
    \pagestyle{fancy}
    % pour les pieds de page:
    \cfoot{\scriptsize Trame du document : FOR\_TEMPLATE}
    \rfoot{\scriptsize\color{red} Ne pas reproduire \slash\ Copie contrôlée}
    
    \begin{document}
    
    \begin{table}[!h]
    \setlength\extrarowheight{2pt}
    \begin{tabularx}{\textwidth}{|l|X|}
            \hline
            \rowcolor[RGB]{33,88,104}\multicolumn{2}{|c|}{%
                \textbf{\color{white}Abbreviation}} \\ \hline
            \textbf{Abbreviation} &  \textbf{Meaning} \\ \hline
            COO  & Chief Operating Officer \\ \hline
            RQ \& AR & Regulatory Affairs and Quality Manager \\ \hline
            ANSM & Agence Nationale de Sécurité du Médicament et des produits de santé 
                   (National drug and medical devices agency) \\ \hline
            CPP  & Comité de Protection des Personnes (Ethics Committee) \\ \hline
            CNIL & Commission Nationale Informatique et Liberté 
                   (French data protection agency) \\ \hline
            CER  & Clinical Evaluation Report \\ \hline 
            IFU  & Instructions For Use \\ \hline
            NC   & Non-conformity \\ \hline
            PMSR & Post-Market Surveillance Report \\ \hline
            PSUR & Periodic Safety Update Report \\ \hline
            CAPA & Corrective and Preventive Actions \\ \hline
    \end{tabularx}
    \end{table}
    
    \end{document}

Addendum: While the preceding solution may satisfy the OP's direct requirements, I don't think it can be said that the table can be said to look attractive or interesting. If communicating effectively with your readers is something you value, you may want to give the table some stronger visual appeal by (a) removing all vertical and most horizontal lines and (b) simplifying the header material, along the lines pursued in the following solution. I hope you will agree with me that this table looks more inviting than the one shown above.

enter image description here

\documentclass[12pt]{article}
\usepackage[T1]{fontenc}
\usepackage[hmargin=1.27cm,top=0.7cm,bottom=1.3cm]{geometry}
\usepackage[table]{xcolor}

\usepackage{tabularx}
\newcolumntype{N}{>{\raggedright\arraybackslash}X}
\usepackage{booktabs} % for \addlinespace and \bottomrule macros
\newcommand\Tstrut{\rule{0pt}{2.6ex}} % 'top' (typographic) strut

\begin{document}

\begin{table}[!h] 
\begin{tabularx}{\textwidth}{@{} l N @{}} 
\rowcolor[RGB]{33,88,104}\multicolumn{2}{c}{%
\textbf{\color{white}Acronyms and their meanings\Tstrut}} \\ 
COO  & Chief Operating Officer\Tstrut \\ 
RQ \& AR & Regulatory Affairs and Quality Manager \\ 
ANSM & Agence Nationale de Sécurité du Médicament et des produits  
       de santé (National drug and medical devices agency) \\ 
\addlinespace
CPP  & Comité de Protection des Personnes (Ethics Committee) \\ 
CNIL & Commission Nationale Informatique et Liberté 
       (French data protection agency) \\ 
CER  & Clinical Evaluation Report \\  
IFU  & Instructions For Use \\ 
\addlinespace
NC   & Non-conformity \\ 
PMSR & Post-Market Surveillance Report \\ 
PSUR & Periodic Safety Update Report \\ 
CAPA & Corrective and Preventive Actions \\ 
\bottomrule
\end{tabularx}
\end{table}

\end{document}
1

If tou want just to modify that Cell, you can use:

\multicolumn{1}{|>{\centering\arraybackslash }m{3cm}}{ANSM}

instead of the cell content.

If you want that all cells became vertically centered, than you can use:

\newcolumntype{R}[1]{>{\raggedleft\arraybackslash }m{#1}}
\newcolumntype{L}[1]{>{\raggedright\arraybackslash }m{#1}}
\newcolumntype{C}[1]{>{\centering\arraybackslash }m{#1}}

instead of:

\newcolumntype{R}[1]{>{\raggedleft\arraybackslash }b{#1}}
\newcolumntype{L}[1]{>{\raggedright\arraybackslash }b{#1}}
\newcolumntype{C}[1]{>{\centering\arraybackslash }b{#1}}

in your preamble.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .