1

my table is defined like:


\documentclass{article}
\usepackage{vcell,caption}

\begin{document} \begin{table}[ht] \centering \captionsetup{justification=centering} \caption{Parameters} \label{tab:ParametersErrorRatePrediction} \begin{tabular}{llll} \hline \begin{tabular}[c]{@{}l@{}}Parametersused \for prediction of:\end{tabular} & \begin{tabular}[c]{@{}l@{}}Parameter\type\end{tabular} & Parameter & Value \ \hline \vcell{\begin{tabular}[b]{@{}l@{}}High-EnergyProton\SEU Rate\end{tabular}} & \vcell{Weibull Fit} & \vcell{\begin{tabular}[b]{@{}l@{}}Saturated upset cross-section $[cm^2/bit]$\Onset$[MeV]$\Width $[MeV]$\Exponent\end{tabular}} & \vcell{\begin{tabular}[b]{@{}l@{}}3.0e-15\18\12\1.5\\end{tabular}} \[-\rowheight] \printcellmiddle & \printcellmiddle & \printcelltop & \printcellmiddle \ \begin{tabular}[c]{@{}l@{}}Heavy Ion\SEU Rate\end{tabular} & Weibull Fit & \begin{tabular}[c]{@{}l@{}}Saturated upset cross-section $[cm^2/bit]$\Onset $[MeV-cm^2/mg]$\Width $[MeV-cm^2/mg]$\Exponent\end{tabular} & \begin{tabular}[c]{@{}l@{}}2.0e-09\0.8\27\0.88\end{tabular} \ \hline \end{tabular} \end{table} \end{document}

and as a result I get: latex table

But I would like to create it like: desired table

Could you please help?

F. Pantigny
  • 40,250
bLAZ
  • 163
  • My document is based on a specific, rather large class. But there is nothing there regarding tables. I thought this problem was something general. I generated the table on https://www.latex-tables.com/ and there was the information: "This table will import one package : vcell." so I added it at the beginning of my document: `usepackage{vcell}. – bLAZ Apr 15 '21 at 19:42
  • I have compiled your code and I have the expected output... – F. Pantigny Apr 15 '21 at 19:48
  • Ah, thank you, I will try to find what is destroying it. – bLAZ Apr 15 '21 at 19:57
  • @F.Pantigny I found what makes difference \usepackage[colorinlistoftodos,prependcaption,textsize=tiny,obeyFinal]{todonotes} It is used for TODO notes according to: https://tex.stackexchange.com/questions/9796/how-to-add-todo-notes – bLAZ Apr 15 '21 at 20:29
  • 1
    In fact, the problem comes from an incompatibility between vcell and calc (which is loaded by todonotes). I have reported that incompatibility to the author of vcell and the problem will be solved in the next version of vcell released on CTAN. – F. Pantigny Apr 16 '21 at 09:35
  • Thank you again! For now I switched to nicematrix :) – bLAZ Apr 16 '21 at 11:15

2 Answers2

1

Here is a way to do that table with nicematrix.

\documentclass{article}
\usepackage{nicematrix,booktabs}
\usepackage{caption}
\usepackage{siunitx}
\usepackage{lipsum}
\usepackage{geometry}

\begin{document} \lipsum[1]

\begin{table}[ht] \centering \captionsetup{justification=centering} \caption{Parameters} \label{tab:ParametersErrorRatePrediction} \begin{NiceTabular}{\textwidth}{@{\extracolsep{\fill}}lclc@{}} \toprule \Block{}{Parameters used \for prediction of} & \Block{}{Parameter\type} & Parameter & Value \ \midrule \Block{4-1}{High-EnergyProton\SEU Rate} & \Block{4-1}{Weibull Fit} & Saturated upset cross-section (\si{cm^2/bit}) & $3.0\cdot 10^{-15}$ \ && Onset (\si{MeV}) & 18 \ && Width (\si{MeV}) & 12 \ && Exponent & 1.5 \[1ex] \Block{4-1}{Heavy Ion\SEU Rate} & \Block{4-1}{Weibull Fit} & Saturated upset cross-section (\si{cm^2/bit}) & $2.0\cdot 10^{-9}$ \ && Onset (\si{MeV}, \si{cm^2/mg}) & 0.8 \ && Width (\si{MeV}, \si{cm^2/mg}) & 27 \ && Exponent & 0.88 \ \bottomrule \end{NiceTabular}

\end{table} \end{document}

You need several compilations (because nicematrix uses PGF/tikz nodes under the hood).

Output of the above code

F. Pantigny
  • 40,250
0

Using recent MikTeX installation I cant reproduce your problem, however you may consider the following solution for your table:

\documentclass{article}
\usepackage[skip=1ex]{caption}
\usepackage{booktabs, tabularx}
\newcolumntype{L}{>{\raggedright\arraybackslash}X}
\newcolumntype{M}[1]{>{\raggedright\arraybackslash}m{#1}}
\usepackage{siunitx}

\begin{document} \begin{table}[ht] \centering \small \caption{Parameters} \label{tab:ParametersErrorRatePrediction} \setlength\tabcolsep{4pt} \renewcommand\tabularxcolumn[1]{m{#1}} \begin{tabularx}{\linewidth}{@{} M{7em} M{5em} L M{3.3em} @{}} \toprule Parametersused for prediction of & Parameter type & Parameter & Value \ \midrule High-Energy Proton SEU Rate & Weibull Fit & Saturated upset cross-section [\si{\centi\metre^2\per bit}]\newline Onset [\si{\mega\electronvolt}]\newline Width [\si{\mega\electronvolt}]\newline Exponent
& 3.0e-15\newline 18\newline 12\newline 1.5 \ \addlinespace Heavy Ion\newline SEU Rate
& Weibull Fit & Saturated upset cross-section [\si{\centi\metre^2\per bit}]\newline Onset [\si{\mega\electronvolt}-\si{\centi\metre^2\per\milli\gram}]\newline Width [\si{\mega\electronvolt}-\si{\centi\metre^2\per\milli\gram}]\newline Exponent & 2.0e-09\newline 0.8\newline 27\newline 0.88 \ \bottomrule \end{tabularx} \end{table} \end{document}

enter image description here

Zarko
  • 296,517