I would like to center the text in the middle of the respective cells for the "X" columns I have defined (last six columns). I would also like to center the table itself. This is my first time using LaTeX and I am using Overleaf. Any help is much appreciated.
\documentclass{article}
% Language setting
% Replace `english' with e.g. `spanish' to change the document language
\usepackage[english]
\usepackage{biblatex}
\usepackage[nomarkers,figuresonly]{endfloat}
\usepackage{gensymb} %package for adding degree symbol
% Set page size and margins
% Replace `letterpaper' with `a4paper' for UK/EU standard size
\usepackage[letterpaper,top=2cm,bottom=2cm,left=3cm,right=3cm,marginparwidth=1.75cm]{geometry}
% Useful packages
\usepackage{textgreek}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage[colorlinks=true, allcolors=blue]{hyperref}
\usepackage{ragged2e}
\usepackage{tabularx}
\begin{document}
\begin{center}
\caption{Table 1 - Tensile Mechanical Properties}
\begin{tabularx}{1.25\textwidth}{|c|c|c|X|X|X|X|X|X|}
\hline
\multicolumn{3}{|c|}{\textbf{Measurement or Property}} &\multicolumn{6}{c|}{\textbf{Material}} \\ \hline
\textbf{Quantity} & \textbf{Symbol} & \textbf{Units} & \textbf{CI} & \textbf{1045CR} & \textbf{1045NM} & \textbf{2024 AL} & \textbf{304 SS} & \textbf{PMMA} \\ \hline
\multicolumn{9}{|c|}{\textbf{Initial Data}}\\ \hline
\textbf{Diameter}&\textbf{d0}&\textbf{mm} & \textbf{7.14} & \textbf{7.19}& \textbf{7.06}& \textbf{7.1}& \textbf{7.13}& \textbf{8.00}\\ \hline
\textbf{Cross-sect Area}&\textbf{A0}&\textbf{\[mm^2\]} & \textbf{40.04} & \textbf{40.6}& \textbf{39.1}& \textbf{39.6}& \textbf{39.9}& \textbf{50.3}\\ \hline
\multicolumn{9}{|c|}{\textbf{Strength}} \\ \hline
\textbf{Yield Load}&\textbf{\(P_{y}\)}&\textbf{kN} & \textbf{} & \textbf{19.53}& \textbf{19.84}& \textbf{13.96}& \textbf{9.11}& \textbf{}\\ \hline
\textbf{Max Load}&\textbf{\(P_{max}\)}&\textbf{kN} & \textbf{13.16} & \textbf{32.47}& \textbf{28.41}& \textbf{19.00}& \textbf{24.42}& \textbf{3.67}\\ \hline
\textbf{Shape Changes during deformation}&\textbf{-}&\textbf{-} & \textbf{None} & \textbf{Slight Necking}& \textbf{Necking}& \textbf{Very slight necking}& \textbf{Extreme Necking}& \textbf{None}\\ \hline
\textbf{Description of Fracture Surface}&\textbf{-}&\textbf{-} & \textbf{Flat, Graphite flakes} & \textbf{Cup and Cone}& \textbf{Cup and Cone}& \textbf{Shear lips and orange peel}& \textbf{Extreme Cup and Cone}& \textbf{Flat crack init. on edge}\\ \hline
\multicolumn{9}{|c|}{\textbf{Hardness}} \\ \hline
\textbf{Rockwell Hardness}&\textbf{HRB}&\textbf{-} & \textbf{100.9} & \textbf{95.5}& \textbf{89.4}& \textbf{75.4}& \textbf{71.7}& \textbf{-}\\ \hline
\multicolumn{9}{|c|}{\textbf{Ductility}} \\ \hline
\textbf{Gage Length}&\textbf{\(l_{0}\)}&\textbf{mm} & \multicolumn{6}{|c|}{\textbf{25.4}}\\ \hline
\textbf{Percent Elongation}&\textbf{\%EL}&\textbf{-} & \textbf{1.05} & \textbf{14.6}& \textbf{27.4}& \textbf{19.9}& \textbf{78.2}& \textbf{3.00}\\ \hline
\textbf{Final Diameter}&\textbf{\(d_{f}\)}&\textbf{mm} & \textbf{7.09} & \textbf{5.74}& \textbf{4.58}& \textbf{6.19}& \textbf{3.06}& \textbf{7.96}\\ \hline
\textbf{Final Area}&\textbf{\(A_{f}\)}&\textbf{\[mm^2\]} & \textbf{39.5} & \textbf{25.9}& \textbf{16.5}& \textbf{30.1}& \textbf{7.35}& \textbf{49.8}\\ \hline
\textbf{Percent Reduction of area}&\textbf{\%RA}&\textbf{-} & \textbf{1.40} & \textbf{36.3}& \textbf{57.9}& \textbf{24.0}& \textbf{81.6}& \textbf{1.00}\\ \hline
\multicolumn{9}{|c|}{\textbf{Mechanical Properties Derived from stress-strain diagram}}\\ \hline
\textbf{Young's Modulus}&\textbf{E}&\textbf{GPa} & \textbf{103} & \textbf{194}& \textbf{198}& \textbf{72}& \textbf{204}& \textbf{4.15}\\ \hline
\textbf{Yield Strength}&\textbf{\(\sigma_y\)}&\textbf{MPa} & \textbf{108} & \textbf{474}& \textbf{498}& \textbf{352}& \textbf{229}& \textbf{-}\\ \hline
\textbf{Ultimate Strength}&\textbf{\(\sigma_u\)}&\textbf{MPa} & \textbf{323} & \textbf{798}& \textbf{719}& \textbf{478}& \textbf{612}& \textbf{75}\\ \hline
%\label{}
\end{tabularx}
\end{center}
\end{document}
\end{document}
XXXXXX
with*{6}{>{\centering\arraybackslash}X}
.\begin{table}\centering\caption{Tensile Mechanical Properties} \begin{tabularx}{…} … \end{tabularx}
.X
columns are to narrow for cell contents (consequently, it overlap, prescribed table width is wider than\textwidth
, consequently it spill out of right border, etc. Do you realy like to have such a table?