Information and discussion about graphics, figures & tables in LaTeX documents.
armo97
Posts: 2 Joined: Fri Sep 20, 2024 12:45 pm
Post
by armo97 » Fri Sep 20, 2024 12:50 pm
Hello everybody.
I have generated the table below in tablesgenerator.com so I'm sure the code is right. When I run it in Latex, I get an error "undefined control sequence" and cline-s are marked red. I added \usepackage{booktabs}\let\cline\cmidrule which somehow solved the problem but now there are gaps between the lines. Anyone knows how I can solve the issue?
Code: Select all
\begin{table}[]
\begin{tabular}{|c|c|ccccc|cc|}
\hline
\multirow{3}{*}{Polymorph} & \multirow{3}{*}{\begin{tabular}[c]{@{}c@{}}Initial\\ Crystal\end{tabular}} & \multicolumn{5}{c|}{Method 1} & \multicolumn{2}{c|}{Method 2} \\ \cline{3-9}
& & \multicolumn{1}{c|}{\multirow{2}{*}{Amorphization}} & \multicolumn{4}{c|}{\begin{tabular}[c]{@{}c@{}}Cold Compression\\ at Peak Pressures {[}GPa{]}\end{tabular}} & \multicolumn{1}{c|}{\multirow{2}{*}{\begin{tabular}[c]{@{}c@{}}Isochoric\\ Amorphization\end{tabular}}} & \multirow{2}{*}{\begin{tabular}[c]{@{}c@{}}Volume\\ Relaxation\end{tabular}} \\ \cline{4-7}
& & \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{50} & \multicolumn{1}{c|}{100} & \multicolumn{1}{c|}{150} & 200 & \multicolumn{1}{c|}{} & \\ \hline
$\alpha$-quartz & 2.79 & \multicolumn{1}{c|}{2.58} & \multicolumn{1}{c|}{2.59} & \multicolumn{1}{c|}{2.67} & \multicolumn{1}{c|}{2.76} & 2.79 & \multicolumn{1}{c|}{2.79} & 2.75 \\ \hline
Stishovite & 4.29 & \multicolumn{5}{c|}{-} & \multicolumn{1}{c|}{4.29} & 2.86 \\ \hline
\end{tabular}
\label{tab:density}
\end{table}
NEW: TikZ book now 40% off at Amazon.com for a short time.
Stefan Kottwitz
Site Admin
Posts: 10323 Joined: Mon Mar 10, 2008 9:44 pm
Post
by Stefan Kottwitz » Fri Sep 20, 2024 1:07 pm
Hi,
welcome to the forum!
The code works for me. If I complete the missing part, it's compilable:
Code: Select all
\documentclass{article}
\usepackage{multirow}
\begin{document}
\begin{table}[]
\begin{tabular}{|c|c|ccccc|cc|}
\hline
\multirow{3}{*}{Polymorph} & \multirow{3}{*}{\begin{tabular}[c]{@{}c@{}}Initial\\ Crystal\end{tabular}} & \multicolumn{5}{c|}{Method 1} & \multicolumn{2}{c|}{Method 2} \\ \cline{3-9}
& & \multicolumn{1}{c|}{\multirow{2}{*}{Amorphization}} & \multicolumn{4}{c|}{\begin{tabular}[c]{@{}c@{}}Cold Compression\\ at Peak Pressures {[}GPa{]}\end{tabular}} & \multicolumn{1}{c|}{\multirow{2}{*}{\begin{tabular}[c]{@{}c@{}}Isochoric\\ Amorphization\end{tabular}}} & \multirow{2}{*}{\begin{tabular}[c]{@{}c@{}}Volume\\ Relaxation\end{tabular}} \\ \cline{4-7}
& & \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{50} & \multicolumn{1}{c|}{100} & \multicolumn{1}{c|}{150} & 200 & \multicolumn{1}{c|}{} & \\ \hline
$\alpha$-quartz & 2.79 & \multicolumn{1}{c|}{2.58} & \multicolumn{1}{c|}{2.59} & \multicolumn{1}{c|}{2.67} & \multicolumn{1}{c|}{2.76} & 2.79 & \multicolumn{1}{c|}{2.79} & 2.75 \\ \hline
Stishovite & 4.29 & \multicolumn{5}{c|}{-} & \multicolumn{1}{c|}{4.29} & 2.86 \\ \hline
\end{tabular}
\label{tab:density}
\end{table}
\end{document}
You can test it by clicking "Run LaTeX here".
Perhaps post your .log file with the error here, as attachment.
Stefan
LaTeX.org admin
armo97
Posts: 2 Joined: Fri Sep 20, 2024 12:45 pm
Post
by armo97 » Fri Sep 20, 2024 1:50 pm
You're right, it runs here normally. But in my code it does not, the clines are not drawn. This is the full code.
Code: Select all
\documentclass[pdflatex,sn-mathphys-num]{sn-jnl}% Math and Physical Sciences Numbered Reference Style
\usepackage{graphicx}%
\usepackage{multirow}%
\usepackage{amsmath,amssymb,amsfonts}%
\usepackage{amsthm}%
\usepackage{mathrsfs}%
% \usepackage{booktabs}\let\cline\cmidrule
\usepackage[title]{appendix}%
\usepackage{xcolor}%
\usepackage{textcomp}%
\usepackage{manyfoot}%
\usepackage{booktabs}%
\usepackage{algorithm}%
\usepackage{algorithmicx}%
\usepackage{algpseudocode}%
\usepackage{listings}%
\usepackage{subcaption}
\captionsetup{compatibility=false}
\theoremstyle{thmstyleone}%
\newtheorem{theorem}{Theorem}% meant for continuous numbers
\newtheorem{proposition}[theorem]{Proposition}%
\theoremstyle{thmstyletwo}%
\newtheorem{example}{Example}%
\newtheorem{remark}{Remark}%
\theoremstyle{thmstylethree}%
\newtheorem{definition}{Definition}%
\raggedbottom
\begin{document}
\title{Thermodynamic Pathways}
\author{\fnm{A} \sur{M}}\email{am}
\abstract{Innnn.}
\keywords{silica}
\maketitle
\section{Introduction}\label{sec1}
\begin{table}[]
\begin{tabular}{|c|c|ccccc|cc|}
\hline
\multirow{3}{*}{Polymorph} & \multirow{3}{*}{\begin{tabular}[c]{@{}c@{}}Initial\\ Crystal\end{tabular}} & \multicolumn{5}{c|}{Method 1} & \multicolumn{2}{c|}{Method 2} \\ \cline{3-9}
& & \multicolumn{1}{c|}{\multirow{2}{*}{Amorphization}} & \multicolumn{4}{c|}{\begin{tabular}[c]{@{}c@{}}Cold compression\\ at peak pressures {[}GPa{]}\end{tabular}} & \multicolumn{1}{c|}{\multirow{2}{*}{\begin{tabular}[c]{@{}c@{}}Isochoric\\ Amorphization\end{tabular}}} & \multirow{2}{*}{\begin{tabular}[c]{@{}c@{}}Volume\\ Relaxation\end{tabular}} \\ \cline{4-7}
& & \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{50} & \multicolumn{1}{c|}{100} & \multicolumn{1}{c|}{150} & 200 & \multicolumn{1}{c|}{} & \\ \hline
$\alpha$-quartz & 2.79 & \multicolumn{1}{c|}{2.58} & \multicolumn{1}{c|}{2.59} & \multicolumn{1}{c|}{2.67} & \multicolumn{1}{c|}{2.76} & 2.79 & \multicolumn{1}{c|}{2.79} & 2.75 \\ \hline
Stishovite & 4.29 & \multicolumn{5}{c|}{-} & \multicolumn{1}{c|}{4.29} & 2.86 \\ \hline
\end{tabular}
\label{tab:density}
\end{table}
\clearpage
\end{document}
Stefan Kottwitz
Site Admin
Posts: 10323 Joined: Mon Mar 10, 2008 9:44 pm
Post
by Stefan Kottwitz » Fri Sep 20, 2024 3:15 pm
Now I see that you are using the
sn-jnl
document class. This class redefines
\cline
itself and expects you to load the
booktabs
package. It discourages using vertical lines in tables. If you use that class because it's required for publishing, I recommend following the style and using only horizontal lines with
booktabs
.
You can get
\cline
back with a small hack at the beginning:
Code: Select all
\let\clineorig\cline
\documentclass[pdflatex,sn-mathphys-num]{sn-jnl}% Math and Physical Sciences Numbered Reference Style
\let\cline\clineorig
Stefan
LaTeX.org admin