Graphics, Figures & TablesSqueezed Table Elements...Bad alignment

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
Xthought1
Posts: 1
Joined: Wed Jun 01, 2016 3:46 pm

Squeezed Table Elements...Bad alignment

Post by Xthought1 »

Hi All,

Can someone tell me how to solve this problem? I am supposed to have a 3-column table, but the entries are compressed horizontally. Attachments show the mess & a minimum file.

I am getting numerous alignment errors. Here is one of them:
"Misplaced \noalign.\hline ->\noalign
{\ifnum 0=`}\fi \hline@rule \futurelet \reserved@a \@xhline
l.335 ...e$_{2}$O$_{2}$S$_{2}$ at 300 K.}\toprule"


Thanks for any advice.
Attachments
Minimum_Example.txt
(1.28 KiB) Downloaded 327 times
Squeezed_Table_Photo1.pdf
(31.95 KiB) Downloaded 141 times

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

Squeezed Table Elements...Bad alignment

Post by Johannes_B »

Oh, crystallography. I bet you had to do some studies to get the hang of it. Special hint: Do the same with LaTeX. The basics are as simple as bcc iron.

If this is for a thesis, you should have a look at the second example, journals might prefer not to have too many extra packages. You should check with the editors.

Code: Select all

\documentclass{article}
\usepackage{booktabs}
\usepackage{chemformula}% You actually want to use this package, really, you do
\usepackage{siunitx}% You actually want to use this package, really, you do
\usepackage{caption}%
%\usepackage{graphicx}%Absolutely not needed
\begin{document}
%\newcommand{\ra}[1]{\renewcommand{\arraystretch}{#1}}% You will
%confuse yourself in the future


% Use the \preprint command to place your local institutional report
% number in the upper righthand corner of the title page in preprint mode.
% Multiple \preprint commands are allowed.
% Use the 'preprintnumbers' class option to override journal defaults
% to display numbers if necessary
%\preprint{}

\begin{table}
\caption{\label{tab:example}Refined parameters for
\ch{La2OFe2O2Se2La2OFe2OS2} at  \SI{300}{\kelvin}.}
% the caption is not part of a tabular
\begin{tabular}{ccc}\toprule
 	& La$_{2}$OFe$_{2}$O$_{2}$Se$_{2}$ & La$_{2}$OFe$_{2}$O$_{2}$S$_{2}$\\
\midrule
%\hline
%\multicolumn{2}{c}{} \\%Noting here?
%\cmidrule{lcr}%\\% No idea what you want to do here
\emph{a} [\AA]               & 4.08778(5) & 4.04539(5)\\
\emph{c} [\AA]               & 18.6005(3) & 17.9036(3)      \\
 V[$\AA^3$]                  & 310.816(8) & 292.997(8) \\%doesn't work
4\emph{e}La(\emph{c})        & 0.1843(1)  & 0.1811(1)      \\
4\emph{e} \emph{M}(\emph{c}) & 0.0964(1)  & 0.0933(3)      \\
La B(\AA)                    & 0.21(5)    & 0.30(4)      \\
Fe B(\AA)                    & 0.46(3)    & 0.42(4)      \\
O(1) B(\AA)                  & 0.44(5)    & 0.40(4)      \\
O(2) B(\AA)                  & 0.91(8)    & 0.89(7)      \\
\emph{M}                     & 0.38(4)    & 0.26(8)	\\
\bottomrule
\end{tabular}

\begin{tabular}{cS[table-format=3.5(1)]
S[table-format=3.5(1)]}\toprule
& \ch{La2OFe2O2Se2} & \ch{La2OFe2O2S2}\\
\midrule
$a$ [\si{\angstrom}]     & 4.08778(5) & 4.04539(5)\\
$c$ [\si{\angstrom}]     & 18.6005(3) & 17.9036(3)      \\
 V[\si{\cubic\angstrom}] & 310.816(8) & 292.997(8)       \\
4$e$ La(\emph{c})        & 0.1843(1)  & 0.1811(1)      \\% i guess
%those are set as emph to get them to be italic; though this is
%most likely a variable and should be typeset in math mode
4$e$ \emph{M}(\emph{c}) & 0.0964(1) & 0.0933(3)      \\
La B(\AA)               & 0.21(5)   & 0.30(4)      \\
Fe B(\AA)               & 0.46(3)   & 0.42(4)      \\
O(1) B(\AA)             & 0.44(5)   & 0.40(4)      \\
O(2) B(\AA)             & 0.91(8)   & 0.89(7)      \\
\emph{M}                & 0.38(4)   & 0.26(8)	\\
\bottomrule
\end{tabular}
\end{table}
\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.
Post Reply