I have various tables and figures that need to have their captions left-aligned for my thesis. "Titles should be flush with the left side of the table and not extend beyond the width of the table." And the same is said of the figures.
However, I've read through multiple threads and tried various solutions, but everything either breaks or doesn't do what I want.
Most of tables are wide enough that having a title left align to the page margin will not be a problem, but a few (in particular a series of longtables) of them are too narrow and the caption does not left align with the table. Furthermore, I still have the problem of the title "extending beyond the width of the table." As for the figures, I cannot get the figure caption to left align with the figures at all, and have the same problem of the caption extending past the width of the figure.
Here is an example of a table. It isn't the most elegant but it got the job done before the format check.
\documentclass{uscthesis}
\usepackage[singlelinecheck=false]{caption}
\usepackage{booktabs, longtable, threeparttable}
\begin{document}
\begingroup
\begin{longtable}{ccccccccc}
\caption{Predictive Values for (Al${x}$Cu${y}$Mo$_{1-x-y}$)FeNiTiVZr Phase Stabilization} \label{tab:O_d} \
& \multicolumn{4}{c}{50 W Data} & \multicolumn{4}{c}{150 W Data} \
\cmidrule{2-5} \cmidrule{6-9}
Sample & x & y & \textbf{$\delta$} & \textbf{$\Omega$} & x & y & \textbf{$\delta$} & \textbf{$\Omega$} \
\midrule
\endfirsthead
& \multicolumn{4}{c}{50 W Data} & \multicolumn{4}{c}{150 W Data} \
\cmidrule{2-5} \cmidrule{6-9}
Sample & x & y & \textbf{$\delta$} & \textbf{$\Omega$} & x & y & \textbf{$\delta$} & \textbf{$\Omega$} \
\midrule
\endhead
1 & 0.548 & 0.114 & 9.17 & 1.09 & 0.453 & 0.118 & 9.20 & 1.14 \
2 & 0.550 & 0.169 & 9.21 & 1.09 & 0.509 & 0.151 & 9.22 & 1.09 \
3 & 0.548 & 0.114 & 9.17 & 1.09 & 0.438 & 0.125 & 9.20 & 1.16 \
4 & 0.550 & 0.169 & 9.21 & 1.09 & 0.491 & 0.162 & 9.22 & 1.11 \
5 & 0.537 & 0.090 & 9.16 & 1.10 & 0.381 & 0.116 & 9.19 & 1.21 \
6 & 0.551 & 0.134 & 9.19 & 1.16 & 0.439 & 0.152 & 9.22 & 1.16 \
7 & 0.544 & 0.195 & 9.22 & 1.15 & 0.484 & 0.197 & 9.24 & 1.11 \
8 & 0.511 & 0.089 & 9.16 & 1.13 & 0.351 & 0.117 & 9.19 & 1.25 \
9 & 0.529 & 0.132 & 9.18 & 1.13 & 0.408 & 0.156 & 9.22 & 1.19 \
10 & 0.526 & 0.193 & 9.22 & 1.14 & 0.452 & 0.204 & 9.25 & 1.15 \
11 & 0.502 & 0.271 & 9.26 & 1.13 & 0.483 & 0.261 & 9.28 & 1.11 \
12 & 0.494 & 0.113 & 9.17 & 1.13 & 0.358 & 0.141 & 9.20 & 1.24 \
13 & 0.503 & 0.167 & 9.20 & 1.14 & 0.406 & 0.189 & 9.23 & 1.19 \
14 & 0.491 & 0.238 & 9.24 & 1.14 & 0.441 & 0.246 & 9.27 & 1.15 \
15 & 0.459 & 0.327 & 9.29 & 1.21 & 0.464 & 0.311 & 9.30 & 1.12 \
16 & 0.467 & 0.123 & 9.18 & 1.20 & 0.340 & 0.152 & 9.21 & 1.26 \
17 & 0.476 & 0.180 & 9.21 & 1.19 & 0.385 & 0.204 & 9.24 & 1.21 \
18 & 0.464 & 0.255 & 9.25 & 1.18 & 0.417 & 0.265 & 9.28 & 1.18 \
19 & 0.432 & 0.348 & 9.30 & 1.18 & 0.436 & 0.336 & 9.31 & 1.15 \
20 & 0.433 & 0.112 & 9.17 & 1.18 & 0.303 & 0.143 & 9.20 & 1.30 \
21 & 0.450 & 0.166 & 9.20 & 1.17 & 0.350 & 0.196 & 9.23 & 1.25 \
22 & 0.446 & 0.238 & 9.24 & 1.17 & 0.384 & 0.258 & 9.27 & 1.21 \
23 & 0.421 & 0.327 & 9.29 & 1.18 & 0.405 & 0.329 & 9.31 & 1.18 \
24 & 0.390 & 0.094 & 9.15 & 1.19 & 0.269 & 0.133 & 9.19 & 1.34 \
25 & 0.418 & 0.141 & 9.18 & 1.20 & 0.308 & 0.174 & 9.22 & 1.30 \
26 & 0.426 & 0.205 & 9.22 & 1.29 & 0.346 & 0.235 & 9.25 & 1.26 \
\end{longtable}%
\endgroup
\end{document}
I've tried using justification=raggedright, but it has the same problem and it introduces a new problem of the right margin of text is no longer being justified, which is also required of my thesis.
I've also tried threeparttable on a non-longtable table to left justify and it broke the entire document because even though I installed the package, environment was not recognized.
I'm at my wits end, because there are a bunch of other ridiculously picky things that they want that I will have to ask in other questions, but for now can anyone advise on this?
threeparttable, however as you discover, it doesn't work well withlongtable. For possible solution of your problem see https://tex.stackexchange.com/questions/278269/longtable-with-threeparttable – Zarko Jun 16 '20 at 03:48\textbf{$\delta$}and\textbf{$\Omega$}isn't correct. Instead, load thebm("bold math") package and write$\bm{\delta}$and `$\bm{\Omega}$. – Mico Jun 16 '20 at 03:56threeparttableon a ...tableto left justify [the caption] and it broke the entire document". It is not the job of thethreeparttableenvironment to left-justify the caption material. – Mico Jun 16 '20 at 04:17threeparttable, but some solutions I was looking at mentioned using the environment for similar problems. However upon further reading I saw it wasn't compatible withlongtable. I saw @Zarko 's solution, but I was hoping for something simpler, for something that seems like it would be easy.Also, thanks for the formatting tips. I'll change it.
– Ben Ruiz Jun 16 '20 at 04:51