I have the following table:
\newcolumntype{P}[1]{>{\centering\arraybackslash}p{#1}}
\renewcommand{\arraystretch}{2.2}
\begin{table}[H]
\centering
\caption{Tipos de funções de ativação}
\label{activacao}
\begin{tabular}{p{35mm}P{35mm}P{35mm}}
\toprule
\textbf{Nome} & \textbf{Função $f$} & \textbf{Contradomínio} \\ \midrule
Limiar & \(\begin{cases} 1, & u_i \geq 0 \\ 0, & u_i < 0 \end{cases}\) & ${0,1}$ \\ \midrule
Linear & $u_i$ & $]-\infty,-\infty[$ \\ \midrule
Por troços & \(\begin{cases} 1, & u_i \geq 0.5 \\ ku_i, & -0.5 < u_i < 0.5 \\ 0, & u_i \leq -0.5 \end{cases}\) & $[0,1]$ \\ \midrule
Logística & $\frac{1}{1+e^{-ku_i}}$ & $[0,1]$ \\ \midrule
Tangente hiperbólica & $tanh(ku_i)$ & $[-1,1]$ \\ \midrule
Sin & $sin(u_i \: mod \: 2\pi)$ & $[-1,1]$ \\ \midrule
Cos & $cos(u_i \: mod \: 2\pi)$ & $[-1,1]$ \\ \midrule
Gaussiana & $e^{\frac{-u^2}{2k^2}}$ & $[-1,1]$ \\ \midrule
Quadrada & $-sign(u_i)u_{}^{2}$ & $]-\infty,-\infty[$ \\ \bottomrule
\end{tabular}
\end{table}
\renewcommand{\arraystretch}{1}~
And using:
\usepackage{multicol}
\usepackage{tabularx}
\usepackage{array}
\usepackage{booktabs}
And I'm getting this:
I wish to get the same row height for all rows (even though I used the \arraystretch cmd), the same column width and all 3 columns must be vertically center aligned. As for horizontal alignment, the first column should be on the left, and the other two on the middle. As you can sse by image above, the cells with \cases
are vertically centered, but I don't know why. I tried with both p
and m
headers but with no success.
\cos
and\sin
(Note the backslash) instead ofcos
andsin
when in math mode.\end{document}
on the end.