1

I have the following problem(s). I have a sample table:

  1. Unfortunately, the text under the table is also always centered and is not left-aligned. What can be done about this? And is there a way to make the text flush with the width of the table?
  2. Strangely, the caption is also displayed below the table, although I actually wrote it above it. What can be the reason for this?
  3. How to increase space between table and text globally?

MWE

\documentclass[12pt]{article}
\usepackage[onehalfspacing]{setspace} 
\usepackage[left=3cm,right=3.5cm,top=2.5cm,bottom=2.75cm]{geometry} 
\usepackage[utf8]{inputenc}
\usepackage{placeins}
\usepackage{indentfirst}
\usepackage[T1]{fontenc}
\usepackage{adjustbox}
\usepackage[nohyperlinks, printonlyused]{acronym}
\usepackage{tabularx}
\usepackage{amsmath}
\usepackage{adjustbox}
\usepackage{graphicx}
\usepackage{natbib}
\usepackage{tikz}
\usepackage{mathrsfs}
\usepackage{float}
\restylefloat{table}
\usepackage{amsfonts}
\usepackage{booktabs}
\usepackage{amssymb}
\usepackage{lipsum}
\usepackage[colorlinks=true,linkcolor=blue]{hyperref}
\usepackage[version=4]{mhchem}
\bibliographystyle{apalike}

\let\origfootnote\footnote \renewcommand{\footnote}[1]{% \begingroup \renewcommand{\footnotesize}{\small}% \origfootnote{#1}% \endgroup}

\begin{document}
    \FloatBarrier
    \begin{table}[h]
        \centering
        \caption{Parameter values used.}
        \label{tab:para}
        \begin{tabular}{@{}lcccc@{}}
            \toprule
            $\epsilon\in \left[ 0,0.5 \right]$ & $M=2$ & $\omega_1=1$ & $\omega_2=1$ & $\omega_3=1$ \\
            \bottomrule
        \end{tabular}
        \\\footnotesize \emph{Note:} \lipsum[2]
    \end{table}
    \FloatBarrier
\end{document}

Thanks for your help

2 Answers2

1

I suggest you enclose the \centering command and the tabular environment in a TeX group of their own. And if you don't want LaTeX to move the caption to the bottom automatically, don't load the float package.

And is there a way to make the text flush with the width of the table?

You could load the threeparttable package and enclose the \caption directive, the tabular environment, and the subsequent legend in a threeparttable environment. However, in view of the facts that the table isn't wide and the legend is quite long, I wouldn't recommend taking this approach for the table at hand.

enter image description here

\documentclass[12pt]{article}
\usepackage[onehalfspacing]{setspace} 
\usepackage[left=3cm,right=3.5cm,top=2.5cm,bottom=2.75cm]{geometry} 
%% \usepackage[utf8]{inputenc} % that's the default nowadays
\usepackage{placeins}
\usepackage{indentfirst}
\usepackage[T1]{fontenc}
\usepackage{adjustbox}
\usepackage[nohyperlinks, printonlyused]{acronym}
\usepackage{tabularx}
\usepackage{adjustbox}
\usepackage{graphicx}
\usepackage{booktabs}

\usepackage{natbib} \bibliographystyle{apalike}

\usepackage{tikz}

\usepackage{amsmath} \usepackage{mathrsfs} %\usepackage{amsfonts} 'amsfonts' is loaded automatically by 'amssymb' \usepackage{amssymb}

%%\usepackage{float} %%\restylefloat{table}

\usepackage{lipsum} \usepackage[colorlinks=true,linkcolor=blue]{hyperref} \usepackage[version=4]{mhchem}

%\let\origfootnote\footnote %\renewcommand{\footnote}[1]{% % \begingroup % \renewcommand{\footnotesize}{\small}% % \origfootnote{#1}% % \endgroup}

\begin{document}
%\FloatBarrier

    \begin{table}[h]
    \caption{Parameter values used.\strut}
    \label{tab:para}

    \begingroup % limit scope of instr. to the curren TeX group
    \centering
        \begin{tabular}{@{}lcccc@{}}
        \toprule
        $\epsilon\in[0,0.5]$ & $M=2$ & $\omega_1=1$ & $\omega_2=1$ & $\omega_3=1$ \\
        \bottomrule
        \end{tabular}
    \par
    \endgroup

    \medskip
    \footnotesize \emph{Note:} \lipsum[2][1-8]
    \end{table}

%\FloatBarrier
\end{document}

Mico
  • 506,678
0

Adaptations

    1. Use \raggedright before your note OR
    2. Put the note inside the tabular with \multicolumn{<number of columns}{l}{text}, so it uses the width of the table.
  1. Remove \restylefloat{table}
  • I commented out \renewcommand of commands that weren't defined before.

Result

enter image description here

Code

\documentclass[12pt]{article}
\usepackage[onehalfspacing]{setspace} 
\usepackage[left=3cm,right=3.5cm,top=2.5cm,bottom=2.75cm]{geometry} 
\usepackage[utf8]{inputenc}
\usepackage{placeins}
\usepackage{indentfirst}
\usepackage[T1]{fontenc}
\usepackage{adjustbox}
\usepackage[nohyperlinks, printonlyused]{acronym}
\usepackage{tabularx}
\usepackage{amsmath}
\usepackage{adjustbox}
\usepackage{graphicx}
\usepackage{natbib}
\usepackage{tikz}
\usepackage{mathrsfs}
\usepackage{float}
%\restylefloat{table}
\usepackage{amsfonts}
\usepackage{booktabs}
\usepackage{amssymb}
\usepackage[colorlinks=true,linkcolor=blue]{hyperref}
\usepackage[version=4]{mhchem}
\bibliographystyle{apalike}
%\renewcommand{\footnotelayout}{\setstretch{1}}
%\renewcommand{\footnotemargin}{1em}

\let\origfootnote\footnote \renewcommand{\footnote}[1]{% \begingroup \renewcommand{\footnotesize}{\small}% \origfootnote{#1}% \endgroup}

\begin{document}

\begin{table}[h] \centering \caption{Parameter values used.} \label{tab:para} \begin{tabular}{@{}lcccc@{}} \toprule $\epsilon\in \left[ 0,0.5 \right]$ & $M=2$ & $\omega_1=1$ & $\omega_2=1$ & $\omega_3=1$ \ \bottomrule \multicolumn{5}{l}{\footnotesize \emph{Note: \dots}} \end{tabular} \end{table}

\end{document}

dexteritas
  • 9,161