the first thing to say is that I hate tables in latex when they are a little bit complicate. 🤦♂️ Then, I am trying to make a table with multirow and multicolumn. I found my questions answered several times, in
Text wrapping in multirow columns
Missing right vertical line in a multirow in a table
Missing vertical lines in the latex table
Border with multirow and multicolumn
Text wrapping in multirow columns
Scale column of a table in percentage of \textwidth
Latex Multirow Table with specified column width
but, I don't know why, neither of the answers apparently work in my case. I have this table:
\begin{table}[ht]
\centering
\rowcolors{1}{white}{gray!30}
\begin{tabularx}{\linewidth}{|>{\hsize=.25\hsize}X>{\hsize=.25\hsize}X>{\hsize=.5\hsize}X|}
\hline
\multicolumn{2}{|l}{\textbf{Funzione}} & \textbf{Definizione} \\ \hline
\multicolumn{2}{|l}{\texttt{=SOMMA.SE(int; criterio; int\_somma)}} & Somma le celle di intervallo\_somma secondo un criterio assegnato ad un intervallo. \\ \hline
\multicolumn{2}{|l}{\texttt{=CONTA.SE(int; criterio)}} & Conta il numero di celle nell'intervallo che corrispondono al criterio dato. \\ \hline
\multicolumn{2}{|l}{\texttt{=MEDIA.SE(int; criterio; int\_media)}} & Determina la media delle celle di intervallo\_media secondo un criterio assegnato ad un intervallo. \\ \hline
\texttt{=SOMMA.PIÙ.SE} & \multirow{4}{0.25\linewidth}{\texttt{(int;} \\ \texttt{int\_criterio1; criterio1;} \\ \texttt{int\_criterio2; criterio2; ...)}} & \multirow{4}{0.5\linewidth}{Esegue la funzione per le celle di un sottoinsieme dell'intervallo specificate da un determinato insieme di criteri.} \\
\texttt{=MEDIA.PIÙ.SE} \\
\texttt{=MAX.PIÙ.SE} \\
\texttt{=MIN.PIÙ.SE} \\ \hline
\multicolumn{2}{|l}{\texttt{=SOMMA.SE(int; criterio; int\_somma)}} & Conta il numero di celle specificate da un determinato insieme di condizioni o criteri. \\ \hline
\end{tabularx}
\caption{}
\label{tab:formule:predefinite:logico-matematiche}
\end{table}
Resulting as
As you can see there's a lot to fix.
- The first thing is the width of the columns: I set 25%, 25% and 50% but the third column is clearly less than 50%.
- The first multirow "(int; int_criterio1[...]" is trimmed. Is there a way to enlarge the height to fit all the content?
- On the second multirow "Esegue la funzione per le celle di..." it draws only the first row right border. I tried putting & & on the rows below, it makes the border, but the multirow is invalidated returning to one row
- Side question, I noticed that the second multirow doesn't have the alignment justified. Is there a way to make it?
I compile with xelatex if it matters. Thanks to everyone who will help.