I want to create a table where in each column I need to write something in two (or more than) lines. I also want that in each cell all the entries will be aligned at the centre.
I tried one code as follows. It serves the "two or more line" condition. But I am unable to make the alignment at centre. Any help?
Code:
\begin{table}[h]
\centering \def\arraystretch{1.5} \small
\begin{tabular}{|p{3cm}|p{1cm}|p{1cm}|}
\hline
quantum electrodynamics & hello \par left & aligned \par efgh \\ \hline
electromagnetism & hello \par left & aligned \par efgh \\ \hline
classical physics & hello \par world & abcd \par efgh \\ \hline
\end{tabular}
\end{table}
The output is:



makecellpackage for multiline text – js bibra Apr 19 '21 at 04:45nicematrixpackage -- verticals are normally not used in tables avoids the jailed look -- if you require go ahead --booktabspackage gives nice spaced horizontal rules -- theYtype column gives thecenteredtext -- the0.4and0.6give the percentage oftextwidthto be occupied - in case of difficulty please revert – js bibra Apr 19 '21 at 04:58