3

I've come across this odd problem where the words in the final cell of my final column don't want to align themselves to the middle of that particular cell. This is my LaTeX code:

\documentclass{article}

\usepackage{tabu}

\usepackage{hyperref}

\begin{document}
    \setcounter{footnote}{2}  % mimic actual document

    \begin{table}
        \centering
        \begin{tabu} to 0.95\textwidth {|X[2,c,m]|X[1,c,m]|X[1,c,m]|X[1,c,m]|}
            \hline Proposed syllabification & Sonority Ranking Hierarchy & Maximum Onset Principle\footnotemark & Morpheme Boundaries \\[9pt]
            \hline\hline
        \end{tabu}
    \end{table}

\end{document}

And this is how it looks:

Final cell doesn't want to align to the middle

Could anyone suggest a solution?

1

While I have not attempted to resolve this issue using your exact framework, I have fixed this by switching to a booktabs-style table, which I find preferable.

Please find the revised code below, the rendered result below it, and this code on Overleaf.

\documentclass{article}


\usepackage{booktabs}

\usepackage{tabu}


\usepackage{hyperref}

\begin{document}
    \setcounter{footnote}{2}  % mimic actual document

    \begin{table}
        \centering
        \begin{tabu} to 0.95\textwidth {X[2,c,m]X[1,c,m]X[1,c,m]X[1,c,m]}
            \toprule
            Proposed syllabification & Sonority Ranking Hierarchy & Maximum Onset Principle\footnotemark & Morpheme Boundaries \\
            \midrule
            %
            \bottomrule
        \end{tabu}
    \end{table}

\end{document}

pdfLaTeX-rendered version of the above code.

While I have not done so, I also suggest that you instead use the automatically-resizing columns provided by tabu, C would be the closest to your current (X) versions, but customized alterations are also feasible.

Finally, note that spacing after the header or other tabular lines are generally better controlled in other ways than manually adding a spacing modifier (e.g. [9em]) after the line break delimiter (\\).

1

Using [Xpt], in my experience, only has effects with negative values to compensate for undesired spaces when you work with the thick line like in this post: \hhline overlay \vline in coloured tabular; you just erase it or control the vertical spacing using \vspace{-\baselineskip}, tabu uses the main framework tabularx and others to bring a more friendly syntax, but as derivative, is not totally flexible.

Result:

Rendered result of below code.

MWE:

% arara: pdflatex: {synctex: yes, action: nonstopmode}

\documentclass{article}
\usepackage{tabu}
\usepackage{longtable}
\usepackage{tabularx}
\usepackage{xcolor}
\usepackage{array}
\usepackage[longtable]{multirow}

\begin{document}

    \tabulinesep=3pt

    Result using tabu: Erasing {\color{red}{\verb+...[9pt]+}} in  {\color{red}{\verb+...ndaries\\[9pt]+}}
    \begin{center}
    then {\color{red}{\verb+... ndaries\\+}}:\\
    \end{center}

    \begin{tabu} to 0.95\linewidth {|X[2cm]| X[1cm]| X[1cm]| X[1cm]|}
        \hline
        Proposed syllabification 
        &Sonority Ranking Hierarchy
        & Maximum Onset Principle\footnotemark&
        Morpheme Boundaries \\
        \hline
        text which is considerably longer than the width of the column
        &text which is considerably longer than the width of the column
        &text which is considerably longer than the width of the column 
        &text which is considerably longer than the width of the column\\
        \hline\hline
    \end{tabu}

    \vspace{\baselineskip}
    If you need to control the vertical position in a cell, just use:
    \begin{center}
    {\color{red}{\verb+\vspace{-\baselineskip}Morphe...+}}\\
    \end{center}

    \begin{tabu} to 0.95\linewidth {|X[2cm]| X[1cm]| X[1cm]| X[1cm]|}
        \hline
        Proposed syllabification 
        &Sonority Ranking Hierarchy
        & Maximum Onset Principle\footnotemark&
        \vspace{-\baselineskip}Morpheme Boundaries \\
        \hline
        text which is considerably longer than the width of the column
        &text which is considerably longer than the width of the column
        &text which is considerably longer than the width of the column 
        &text which is considerably longer than the width of the column\\
        \hline\hline
    \end{tabu}

\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.