1

I want to center vertically elements in my two columns table just in my left column, which I want it to be 30% of the line width and the second one to be left aligned and 70% of the line width. I have succeeded doing these two things separately but not together in the same table.

My code is the following:

\setlength{\arrayrulewidth}{1mm}
\setlength{\tabcolsep}{18pt}
\usepackage{array}
\usepackage{tabularx}

{\rowcolors{1}{blue!50!white!60}{blue!30!white!70}
\begin{tabularx}{\linewidth}{ |>{\arraybackslash}m{0.3\linewidth}|>{\arraybackslash}m{0.7\linewidth}|}
\hline
ID & GUIDEME-FR-FUNC-001 \\
TITLE & Functions Start Over \\
AUTHOR & IBM CIO\\
CREATION DATE & 25-09-2018 \\
SOURCE & GUIDEME-FR-FUNC-001 \\
SUBSYSTEM & Functions \\
TYPE & Functional \\
PRIORITY & High \\
STATUS & Approved \\
DESCRIPTION & The system shall permit users to start over and look for another room \\
TEST PLAN & Check if it is possible to go back to the main page once instructions have been displayed \\
\hline
\end{tabularx}
}

And the outcome is the following:

enter image description here

1 Answers1

0

like this?

enter image description here

\documentclass{article}
\usepackage{tabularx}
\usepackage[table]{xcolor}

\begin{document}

{
\rowcolors{1}{blue!50!white!60}{blue!30!white!70}
\setlength{\arrayrulewidth}{1mm}
\setlength{\tabcolsep}{18pt}
\renewcommand\tabularxcolumn[1]{m{#1}}              % <---
\begin{tabularx}{\linewidth}{|m{0.3\linewidth}|X|}  % <---
\hline
ID              & GUIDEME-FR-FUNC-001 \\
TITLE           & Functions Start Over \\
AUTHOR          & IBM CIO\\
CREATION DATE   & 25-09-2018 \\
SOURCE          & GUIDEME-FR-FUNC-001 \\
SUBSYSTEM       & Functions \\
TYPE            & Functional \\
PRIORITY        & High \\
STATUS          & Approved \\
DESCRIPTION     & The system shall permit users to start over and look for another room \\
TEST PLAN       & Check if it is possible to go back to the main page once instructions have been displayed \\
\hline
\end{tabularx}
}
\end{document}

or with more space above and below cells' contents:

enter image description here

\documentclass{article}
\usepackage{cellspace,               % <--- for additional space above/below cells' content
            tabularx}                % <---
\setlength\cellspacetoplimit{4pt}    % <---
\setlength\cellspacebottomlimit{4pt} % <--- 
\addparagraphcolumntypes{X}          % <---
\usepackage[table]{xcolor}

\begin{document}

{
\rowcolors{1}{blue!50!white!60}{blue!30!white!70}
\setlength{\arrayrulewidth}{1mm}
\setlength{\tabcolsep}{18pt}
\renewcommand\tabularxcolumn[1]{m{#1}}
\begin{tabularx}{\linewidth}{|m{0.3\linewidth}|S{X}|} % <---
\hline
ID              & GUIDEME-FR-FUNC-001 \\
TITLE           & Functions Start Over \\
AUTHOR          & IBM CIO\\
CREATION DATE   & 25-09-2018 \\
SOURCE          & GUIDEME-FR-FUNC-001 \\
SUBSYSTEM       & Functions \\
TYPE            & Functional \\
PRIORITY        & High \\
STATUS          & Approved \\
DESCRIPTION     & The system shall permit users to start over and look for another room \\
TEST PLAN       & Check if it is possible to go back to the main page once instructions have been displayed \\
\hline
\end{tabularx}
}
\end{document}

note: in tabularx table environment had to be at least one column of X type (or its derivative). to have vertical centered text the contents of cells in the last column had to be vertical centered. this is in above examples obtained by \renewcommand\tabularxcolumn[1]{m{#1}}.

Zarko
  • 296,517