TeX - LaTeX Asked by Yousef Amr on June 2, 2021
I am trying to vertically center the text inside the Position and Person(s) headings but I can’t really do it. I want them to be as denoted in the picture (vertically centered).
My code:
documentclass{article}
usepackage{multirow}
usepackage{graphicx}
begin{document}
% Please add the following required packages to your document preamble:
% usepackage{multirow}
begin{table}[h]
centering
begin{tabular}{|c|c|p{3in}|}
hline
Position & multicolumn{1}{c|}{Person(s)} & multicolumn{1}{c|}{Role} hline
Co-head &
begin{tabular}[c]{@{}c@{}}Islam Mahdy Youssef Amrend{tabular} &
begin{itemize}
item Reviewing the content of each session previously.
item Reviewing the progression of the academic sessions whether they for the Curriculum sessions or the standardized tests' sessions.
item Having continuous check on the magazine to ensure the conformity of the topics discussed to the club's goal
end{itemize} hline
Vice head &
Ahmed Magdy &
loremipsum hline
Head of Academics & Mohamed Badr & begin{itemize}
item Preparing the content of each session.
item Managing the time table of the weekly-held sessions.
item Conducting mini quizzes each week to make sure the students have comprehended the previous session.
end{itemize} hline
multirow{2}{*}{Magazine} &
multirow{2}{*}{begin{tabular}[c]{@{}l@{}}Ali Ashraf Ahmed Hamedend{tabular}} &
multirow{2}{*}{sdsdsdsds}
& & hline
end{tabular}
end{table}
end{document}
In addition to vertically centering the contents of the table, I have also implemented the following changes in the below MWE:
tabularx
in order to make sure, the table fits into the textwidth. In the original example, it was a lot wider than the textwidth. You got an voerfull box warning informing you about that.renewcommand{tabularxcolumn}[1]{m{#1}}
. Originally, the X
type column is derived from the p
type column and therefore aligns ist contents just as in your original example. The above line now redefindes the X
type column to act like a vertically centered m
type column. (There is no need to explicitly add the array
package here, since tabularx
already loads it.)makecell
package in order to replace the nested tabulars and the multicolumns in the column headers.multirow
commands in the last table row, as well as the empty row there.enumitem
package and defined a new customized tabenum
environment for the use in tables. This environment saves you quite a lot of space above, below and on the left.documentclass{article}
%usepackage{multirow} % no longer needed
usepackage{graphicx}
usepackage{makecell}
renewcommand{theadfont}{normalsize}
usepackage{tabularx}
renewcommand{tabularxcolumn}[1]{m{#1}}
usepackage{enumitem}
newlist{tabitem}{enumerate}{1}
setlist[tabitem,1]{label*=textbullet,
leftmargin=*,
nosep,
leftmargin=*,
before=begin{minipage}[t]{hsize},
after=end{minipage}}
begin{document}
begin{table}[h]
centering
begin{tabularx}{textwidth}{|c|c|X|}
hline
thead{Position}
& thead{Person(s)}
& thead{Role}
hline
Co-head
& makecell{Islam Mahdy Youssef Amr}
& begin{tabitem}
item Reviewing the content of each session previously.
item Reviewing the progression of the academic sessions whether they for the Curriculum sessions or the standardized tests' sessions.
item Having continuous check on the magazine to ensure the conformity of the topics discussed to the club's goal
end{tabitem}
hline
Vice head
& Ahmed Magdy
& loremipsum
hline
Head of Academics
& Mohamed Badr
& begin{tabitem}
item Preparing the content of each session.
item Managing the time table of the weekly-held sessions.
item Conducting mini quizzes each week to make sure the students have comprehended the previous session.
end{tabitem}
hline
Magazine
&makecell{Ali Ashraf Ahmed Hamed}
& sdsdsdsds
hline
end{tabularx}
end{table}
end{document}
Answered by leandriis on June 2, 2021
Here are some simplifications and improvements for the vertical spacing, in particular for the lists, loading the enumitem
and makecell
packages.
documentclass{article}
usepackage{array, multirow, makecell}
usepackage{enumitem}
begin{document}
begin{table}[h]
centeringsetlength{extrarowheight}{2pt}
setlist[itemize]{wide = 0pt, leftmargin = *, topsep =3pt, after =vspace*{dimexprtopsep-baselineskip}}
begin{tabular}{|c|c| m{3in}|}
hline
Position & multicolumn{1}{c|}{Person(s)} & multicolumn{1}{c|}{Role} hline
Co-head &
begin{tabular}[c]{@{}c@{}}Islam Mahdy Youssef Amrend{tabular} &
begin{itemize}
item Reviewing the content of each session previously.
item Reviewing the progression of the academic sessions whether they for the Curriculum sessions or the standardized tests' sessions.
item Having continuous check on the magazine to ensure the conformity of the topics discussed to the club's goal
end{itemize} hline
Vice head &
Ahmed Magdy &
loremipsum hline
Head of Academics & Mohamed Badr & begin{itemize}
item Preparing the content of each session.
item Managing the time table of the weekly-held sessions.
item Conducting mini quizzes each week to make sure the students have comprehended the previous session.
end{itemize} hline
multirow{2}{*}{Magazine} &
multirowcell{2}{Ali Ashraf Ahmed Hamed} &
multirow{2}{*}{sdsdsdsds}
& & hline
end{tabular}
end{table}
end{document}
Answered by Bernard on June 2, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP