TeX - LaTeX Asked by Abdessamad139 on March 6, 2021
I am working on a journal paper using the Overleaf website to compile it.
documentclass[runningheads]{llncs}
usepackage{tabularx}
usepackage{multirow}
begin{document}
begin{table}[t]
caption{tabmle1}
label{tab2}
begin{center}
begin{tabularx}{textwidth}{|X|X|X|X|}
hline
textbf{Dataset} & textbf{Metrics} & textbf{algo1} & textbf{algo2} cline{1-4}
multirow{4}{4} {data1} & M1 & 5.36778 & 6.20198 cline{2-4}
& M2 & 5.16952 & 3.78941 cline{2-4}
& M3 & 8.92139 & 9.63108 cline{2-4}
&M4 & 0.07484 & - 1.16580 cline{1-4}
%hline
multirow{4}{4}{data2} & M1& 2.02522 & 6.48972 cline{2-4}
& M2 & 6.15882 & 9.69980 cline{2-4}
& M3 & 8.12485 & 8.68411 cline{2-4}
& M4& -1.16187 & - 11.55713 cline{1-4}
%hline
end{tabularx}
end{center}
end{table}
end{document}
I am getting this error:
Illegal unit of measure (pt inserted).
<to be read again>
relax
l.33 end{tabularx}
Dimensions can be in units of em, ex, in, pt, pc,
cm, mm, dd, cc, nd, nc, bp, or sp; but yours is a new one!
I'll assume that you meant to say pt, for printer's points.
To recover gracefully from this error, it's best to
delete the erroneous units; e.g., type `2' to delete
two letters. (See Chapter 27 of The TeXbook.
I am new to latex, I made some research and it indicates that this error may occur when having a line break followed by square brackets, which is not the case for this code. Other suggests using Tabularx, it is already the used environment.
Furthermore, I can not really understand the source of this error.
Thank you in advance for any suggestions!
Mostly off-topic, since your problem is already solved by comments.
I would use siunitx
packages for writing columns with numbers:
documentclass[runningheads]{llncs}
usepackage{multirow, tabularx}
NewExpandableDocumentCommandmcxbf{O{>{centeringarraybackslash}X|}m}
{multicolumn{1}{#1}{textbf{#2}}}
usepackage{siunitx}
begin{document}
begin{table}[ht]
caption{Table 1}
label{tab2}
centering
renewcommandarraystretch{1.1}
begin{tabularx}{textwidth}{|X|X|S[table-format=-1.5]|S[table-format=-2.5]|}
hline
mcxbf[|>{centeringarraybackslash}X|]{Dataset}
& mcxbf{Metrics}
& mcxbf{algo1}
& mcxbf{algo2}
hline
multirow{4}{=}{data1}
& M1 & 5.36778 & 6.20198 cline{2-4}
& M2 & 5.16952 & 3.78941 cline{2-4}
& M3 & 8.92139 & 9.63108 cline{2-4}
& M4 & 0.07484 & -1.16580
hline
multirow{4}{=}{data2}
& M1 & 2.02522 & 6.48972 cline{2-4}
& M2 & 6.15882 & 9.69980 cline{2-4}
& M3 & 8.12485 & 8.68411 cline{2-4}
& M4 & -1.16187 & -11.55713
hline
end{tabularx}
end{table}
end{document}
Addendum: You may liked design as suggested @{Mico in his comment below:
documentclass[runningheads]{llncs}
usepackage{booktabs, multirow, tabularx}
NewExpandableDocumentCommandmcxbf{O{>{centeringarraybackslash}X}m}
{multicolumn{1}{#1}{textbf{#2}}}
NewExpandableDocumentCommandmlxbf{O{>{raggedrightarraybackslash}X}m}
{multicolumn{1}{#1}{textbf{#2}}}
usepackage{siunitx}
begin{document}
begin{table}[ht]
caption{Table 1}
label{tab2}
centering
renewcommandarraystretch{1.1}
begin{tabularx}{textwidth}{XX S[table-format=-1.5]S[table-format=-2.5]}
toprule
mlxbf{Dataset}
& mlxbf{Metrics}
& mcxbf{algo1}
& mcxbf{algo2}
midrule
multirow{4}{=}{data1}
& M1 & 5.36778 & 6.20198
& M2 & 5.16952 & 3.78941
& M3 & 8.92139 & 9.63108
& M4 & 0.07484 & -1.16580
midrule
multirow{4}{=}{data2}
& M1 & 2.02522 & 6.48972
& M2 & 6.15882 & 9.69980
& M3 & 8.12485 & 8.68411
& M4 & -1.16187 & -11.55713
bottomrule
end{tabularx}
end{table}
end{document}
Correct answer by Zarko on March 6, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP