[Tex/LaTex] Alignment of a table footnote

horizontal alignmenttables

I am trying to align the table footnotes so that they start together with the table.

\documentclass[a4paper,onecolumn,twoside,12pt]{mwbk}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}

\usepackage{enumitem}
\usepackage{amsmath}
\usepackage{multirow}
\usepackage{graphicx}
\usepackage{float}
\usepackage{array}\usepackage[showframe=false]{geometry}
\usepackage{changepage}
\usepackage{rotating}
\usepackage{siunitx}
\usepackage{cite}
\usepackage{hyperref}
\usepackage{tablefootnote}
\usepackage{multicol}

\usepackage{booktabs}
\newcommand{\ra}[1]{\renewcommand{\arraystretch}{#1}}
\makeatletter
\newcommand{\rmnum}[1]{\romannumeral #1}
\newcommand{\Rmnum}[1]{\expandafter\@slowromancap\romannumeral #1@}
\makeatother

%font
\usepackage{microtype}
\usepackage{pxfonts}

\pagestyle{uheadings} %pagina

\usepackage{geometry}
\geometry{
left=25mm,
right=25mm,
top=25mm,
bottom=25mm,}

\begin{document}

\begin{table}
\ra{1.1}

\centering

\begin{tabular}{@{}lccccccccc@{}}
\toprule

& & & \multicolumn{6}{c}{\textbf{Errors}} \\
\cmidrule(lr){4-9}

\textbf{Test}
& \textbf{Flux} $\left(\frac{p}{cm^2s}\right)$
& \textbf{Time} $\left(s\right)$
& \textbf{\Rmnum{1}$^{a}$}
& \textbf{\Rmnum{2}$^{b}$}
& \textbf{\Rmnum{3}$^{c}$}
& \textbf{\Rmnum{4}$^{d}$}
& \textbf{\Rmnum{5}$^{e}$}
& \textbf{\Rmnum{6}$^{f}$}\\

\midrule
TEST\_0, run\_0 & $1\cdot10^7$ & 120 & 90 & 0 & 0 & 4 & 1 & 6\\


\bottomrule
\end{tabular}
\\

\begin{flushleft}
\footnotesize $^{a}$ ERR A\\
\footnotesize $^{b}$ ERR B\\
\footnotesize $^{c}$ ERR C\\
\footnotesize $^{d}$ ERR D\\
\footnotesize $^{e}$ ERR E\\
\footnotesize $^{f}$ ERR F
\end{flushleft}

\end{table}

\end{document}

Unfortunately, now footnotes don't begin together with the table – they are much more to the left.

Best Answer

You can use threeparttable:

\documentclass[a4paper,onecolumn,twoside,12pt]{mwbk}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage[showframe=false]{geometry}

\usepackage{enumitem}
\usepackage{amsmath}
\usepackage{multirow}
\usepackage{graphicx}
\usepackage{float}
\usepackage{array}
\usepackage{changepage}
\usepackage{rotating}
\usepackage{siunitx}
\usepackage{cite}
\usepackage{tablefootnote}
\usepackage{multicol}
\usepackage{booktabs}
\usepackage{threeparttable}
\usepackage{hyperref}

\newcommand{\ra}[1]{\renewcommand{\arraystretch}{#1}}
\makeatletter
\newcommand{\rmnum}[1]{\@roman{#1}}
\newcommand{\Rmnum}[1]{\@Roman{#1}}
\makeatother

%font
\usepackage{microtype}
\usepackage{newpxtext,newpxmath}

\pagestyle{uheadings} %pagina

\geometry{
  left=25mm,
  right=25mm,
  top=25mm,
  bottom=25mm,
}

\begin{document}

\begin{table}
\ra{1.1}
\sisetup{per-mode=fraction}

\centering

\begin{threeparttable}
\begin{tabular}{@{}l *{8}{c} @{}}
\toprule

& & & \multicolumn{6}{c}{\textbf{Errors}} \\
\cmidrule(l){4-9}

\textbf{Test}
& \textbf{Flux} $\left(\si{\pascal\per\square\centi\meter\per\second}\right)$
& \textbf{Time} (\si{\second})
& \textbf{\Rmnum{1}}\tnote{a}
& \textbf{\Rmnum{2}}\tnote{b}
& \textbf{\Rmnum{3}}\tnote{c}
& \textbf{\Rmnum{4}}\tnote{d}
& \textbf{\Rmnum{5}}\tnote{e}
& \textbf{\Rmnum{6}}\tnote{f}\\

\midrule
TEST\_0, run\_0 & \num{1E7} & 120 & 90 & 0 & 0 & 4 & 1 & 6\\
\bottomrule
\end{tabular}
\begin{tablenotes}[flushleft]\footnotesize
\renewcommand{\TPTtagStyle}[1]{\makebox[.6em][l]{#1}}
\item[a] ERR A
\item[b] ERR B
\item[c] ERR C
\item[d] ERR D
\item[e] ERR E
\item[f] ERR F
\end{tablenotes}
\end{threeparttable}

\end{table}

\end{document}

enter image description here

A few points to note.

  • I used newpxtext and newpxmath instead of the buggy pxfonts

  • The units should be set with \si

  • The command \TPTtagStyle is redefined in the tablenotes environment in order to get alignment

Related Question