Graphics, Figures & TablesTable help

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
brocq_18
Posts: 2
Joined: Fri May 29, 2015 5:30 pm

Table help

Post by brocq_18 »

I have the lines below which I am trying to fit into a table but cannot get it to fit. Could anyone help with this please?

Code: Select all

\documentclass[a4paper,10pt]{article}
\usepackage{subcaption,graphicx}
\usepackage{caption} % for captions under images/figures
\usepackage[parfill]{parskip}
\usepackage[a4paper, left=25mm, right=25mm, top=20mm, bottom=20mm]{geometry}


\begin{table}\tiny
\begin{tabular}{ | c | c | c | c | c | c | c | c | c | c | } \hline
 ITER. & ENERGY(OLD) & ENERGY(NEW) & DE & GRADMAX & GRADNORM & GRADRMS & STEPMAX & STEPLEN & STEPRMS \\ \hline
15 & -887.92064320 & -887.92065570 & -0.00001250 & 0.00122979 & 0.00272241 & 0.00007778 & 0.03620021 & 0.04051140 & 0.01118788\\
 16 & -887.92065570 & -887.92066220 & -0.00000650 & 0.00109565 & 0.00230734 & 0.00006592 & 0.01613436 & 0.02231024 & 0.00618124\\
17 & -887.92066220 & -887.92066380 & -0.00000160 & 0.00075061 & 0.00137919 & 0.00003941 & 0.07367523 & 0.07776748 & 0.00161132\\
18 & -887.92066380 & -887.92066447 & -0.00000067 & 0.00026352 & 0.00058409 & 0.00001669 & 0.05152288 & 0.06094136 & 0.00145626\\ \hline
\end{tabular}
\end{table}

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Table help

Post by Johannes_B »

Hi and welcome,
the table is just too big. If typeset correctly, it is even wider, as the minus signs should really be typeset as minus signs, not as hyphen. I suggest to rotate the table and its caption.

Code: Select all

\documentclass[a4paper,10pt]{article}
\usepackage{subcaption,graphicx}
\usepackage{caption} % for captions under images/figures
\usepackage{booktabs}
\usepackage{siunitx}
\usepackage{rotating}
\usepackage[parfill]{parskip}
\usepackage[a4paper, left=25mm, right=25mm, top=20mm, bottom=20mm,showframe]{geometry}


\begin{document}
\begin{sidewaystable}
	\centering
	\caption{A pretty wide table}
	\begin{tabular}{ c
			S[table-format=-3.8]
			S[table-format=-3.8]
			S[table-format=-1.8]
			S[table-format=1.8]
			S[table-format=1.8]
			S[table-format=1.8]
			S[table-format=1.8]
			S[table-format=1.8]
			S[table-format=1.8]
		} \toprule
		{ITER.} & {ENERGY(OLD)} & {ENERGY(NEW)} & {DE} & {GRADMAX} & {GRADNORM} & {GRADRMS} & {STEPMAX} & {STEPLEN} & {STEPRMS} \\ \midrule
		15 & -887.92064320 & -887.92065570 & -0.00001250 & 0.00122979 & 0.00272241 & 0.00007778 & 0.03620021 & 0.04051140 & 0.01118788\\
		16 & -887.92065570 & -887.92066220 & -0.00000650 & 0.00109565 & 0.00230734 & 0.00006592 & 0.01613436 & 0.02231024 & 0.00618124\\
		17 & -887.92066220 & -887.92066380 & -0.00000160 & 0.00075061 & 0.00137919 & 0.00003941 & 0.07367523 & 0.07776748 & 0.00161132\\
		18 & -887.92066380 & -887.92066447 & -0.00000067 & 0.00026352 & 0.00058409 & 0.00001669 & 0.05152288 & 0.06094136 & 0.00145626\\ \bottomrule
	\end{tabular}
\par\vspace{1cm}
	\begin{tabular}{ | c | c | c | c | c | c | c | c | c | c | } \hline
		ITER. & ENERGY(OLD) & ENERGY(NEW) & DE & GRADMAX & GRADNORM & GRADRMS & STEPMAX & STEPLEN & STEPRMS \\ \hline
		15 & -887.92064320 & -887.92065570 & -0.00001250 & 0.00122979 & 0.00272241 & 0.00007778 & 0.03620021 & 0.04051140 & 0.01118788\\
		16 & -887.92065570 & -887.92066220 & -0.00000650 & 0.00109565 & 0.00230734 & 0.00006592 & 0.01613436 & 0.02231024 & 0.00618124\\
		17 & -887.92066220 & -887.92066380 & -0.00000160 & 0.00075061 & 0.00137919 & 0.00003941 & 0.07367523 & 0.07776748 & 0.00161132\\
		18 & -887.92066380 & -887.92066447 & -0.00000067 & 0.00026352 & 0.00058409 & 0.00001669 & 0.05152288 & 0.06094136 & 0.00145626\\ \hline
	\end{tabular}
\end{sidewaystable}
\end{document}
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
brocq_18
Posts: 2
Joined: Fri May 29, 2015 5:30 pm

Re: Table help

Post by brocq_18 »

Hi thank you for the quick response. I think I will have to remove some of the columns in this case. :?
Post Reply