I have the following code:
\documentclass[11pt]{book} \usepackage[default]{opensans} \usepackage{alltt} \usepackage{amsfonts} \usepackage{amsmath} \usepackage{amssymb} \usepackage{array} \usepackage{colortbl} \usepackage{enumitem} \usepackage{fancyhdr} \usepackage{float} \usepackage[total={15.24cm,22.86cm}]{geometry} \usepackage{graphicx} \usepackage{hyperref} \usepackage{inconsolata} \usepackage{listings} % % % Package used for breakable tables \usepackage{longtable} % % \usepackage{mathabx} \usepackage{microtype} % % For creating new commands with an arbitrary number of arguments \usepackage{newfile} % % \usepackage{pgfplots} \usepackage{pifont} \usepackage{smartdiagram} \usepackage{tabularx} \usepackage[listings,skins,most]{tcolorbox} \usepackage{tikz} \usepackage[table,xcdraw]{xcolor} % % % Define custom colors for the header row \definecolor{headercolor}{RGB}{27, 29, 31} % % % % % Define a header style command \newcommand{\headerstyle}[1]{\textcolor{white}{\textbf{#1}}} % % % % Define the printDbBreakableTable environment \newenvironment{printDbBreakableTable}[3]{% % Begin table structure by indicating the number of columns \begin{longtable}{#1} % % Set header row color \rowcolor{headercolor!85}% % % The content of the header row #2% \endhead % % Insert the table's main content #3% \end{longtable}% } \begin{document} \begin{printDbBreakableTable} { |c|c|c|c| } {% \headerstyle{Employee\_id} & \headerstyle{First\_name} & \headerstyle{Last\_name} & \headerstyle{Salary} \\\hline} {% id-0001 & fname-01 & lname-01 & 100000 \\\hline id-0002 & fname-02 & lname-02 & 100001 \\\hline id-0003 & fname-03 & lname-03 & 100002 \\\hline id-0004 & fname-04 & lname-04 & 100003 \\\hline id-0005 & fname-05 & lname-05 & 100004 \\\hline id-0006 & fname-06 & lname-06 & 100005 \\\hline id-0007 & fname-07 & lname-07 & 100006 \\\hline id-0008 & fname-08 & lname-08 & 100007 \\\hline id-0009 & fname-09 & lname-09 & 100008 \\\hline id-0010 & fname-10 & lname-10 & 100009 \\\hline id-0011 & fname-11 & lname-11 & 100010 \\\hline } \end{printDbBreakableTable} \end{document} Is there any way to make the content inside the cells of the table really 100% exactly vertically aligned in the middle? So far I have tested
|m|m|m|m|- And also:
{\centering\arraybackslash}m{.15\linewidth}|% {\centering\arraybackslash}m{.15\linewidth}|% {\centering\arraybackslash}m{.15\linewidth}|% {\centering\arraybackslash}m{.15\linewidth}|% But none of these really put the text vertically in the middle.
I'm really surprised how challenging this task is in LaTeX compared to tools such as Microsoft Excel and Libre Office Calc.
Any idea about how to solve this issue?
My requirement : The content in the cells should be 100% in the middle, both horizontally and vertically.
Thanks in advance.


\addtolength\extrarowheight{3.5pt}immediately before\begin{printDbBreakableTable}.