I have looked at previous queries of similar issues but the solutions don't seem to work for me (I am very new to LaTex so this is probably just me!)
I am making a table which I want to fit within the page width of my document. I have tried tabularx and tabulary (using \textwidth or \linewidth)but this seems to only make the lines of the table the correct width with the text still running off. Any solutions will be great!
This is the current code with no formatting trying to fix the width issue:
\documentclass{article}
\begin{document}
This is a line of text to show the line width to ensure the table is the correct width on the page
\begin{center}
\begin{tabular}{c|c|c|c|c}
\hline
\multicolumn{4}{c}{Error in Gilson Autopipettes} \\
\hline
Autopipette & Max. Volume ($\mu$ L) & Sytematic Error ($\mu$ L) & Random Error ($\mu$ L) & Max. Error ($\mu$ L) \\
\hline
P10 & 10 & $\pm$ 0.100 & $\leq$ 0.040 & \\
P200 & 200 & $\pm$ 1.60 & $\leq$ 0.30 & \\
P1000 & 1000 & $\pm$ 8 & $\leq$ 1.5 & \\
\hline
\end{tabular}
\end{center}
\end{document}
Best Answer
like this?
tabularx
you can prescribe table width, however, than you need to use at least one column typeX
(or derivative from it) in table. otherwise, table will have width of cell contentsS
columns fromsiunitx
package. using it the numbers are aligned at decimal point or right side, if numbers are intefgerssiunitx
package (see mwe below)booktabs
packagelipsum
is for dummy text, in real document you should remove it, the same is valid forshowframe
, which purpose is show page layout (red lines on above image.edit:
for shorter code you can define new commands, similarly as it is defined for
\multicolumn
in above mwe, for units\micro\liter
(as suggested Bernard in his comment below:in preamble, after
\usepackage{siunitx}
:\newcomand{\ul}{\micro\liter}
and use in table: