I would like to have centered cells and have manual linebreaks within tabularx. I searched a lot in stackexchange and other latex related pages, but cannot find a solution
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{tabularx}
\usepackage[]{multirow}
\usepackage[]{MnSymbol}
\usepackage[]{array}
\usepackage{multicol}
\begin{document}
\maketitle
\section{Introduction}
\newcolumntype{P}[1]{>{\centering\arraybackslash}p{#1}}
\begin{table}
\centering
\begin{tabularx}{1\linewidth}{lX|P{0.2\linewidth}|P{0.2\linewidth}|P{0.2\linewidth}}
& & \textbf{firmware} & \textbf{bootloader} & \textbf{os} \
\multicolumn{2}{l}{\textbf{Target1}} & & & \
& {\footnotesize rot\par} & test123 \newline hallo & {\footnotesize $(\uparrow)$ \newline testtext\par} & {\footnotesize $(\nearrow)$ \newline hardware\par} \
\hline
\hline
\end{tabularx}
\end{table}
\end{document}
Why is the first line of each cell not center aligned? If I have no linebreak within the cell the first line is correctly aligned. How to solve this? Thanks in advance
Edit:
I compiled the code with overleaf and some other online latex environments to ensure my environment is not fishy





\newlinewith\parinside thepcells, because centering is only properly aligned after a\par. – Jasper Habicht Aug 04 '22 at 12:31