1
\documentclass[12pt,a4paper]{article}
    \usepackage[utf8]{inputenc}
    \usepackage{amsmath}
    \usepackage{amssymb}
    \usepackage{setspace}
    \usepackage{rotating}
    \usepackage{array}
    \usepackage{float}
    \usepackage{booktabs,tabularx,dcolumn,adjustbox}
    \usepackage[font=normal,skip=.333\baselineskip]{caption}
    \usepackage[margin=2.5cm]{geometry}
    \usepackage[strict]{changepage}
    \usepackage{longtable}

    \begin{sidewaystable}
    \begin{minipage}[H]{\linewidth}
        \centering
    \begin{tabular}{ |l|m{3.5cm}|m{3.5cm}|m{3.5cm}|m{3.5cm}|m{3.5cm}|}
        \hline
        \textbf{State/Territory}& \textbf{Type of legislation} &\textbf{Brothels}&\textbf{Escort agencies}&\textbf{Private work}&\textbf{Street work}\\[0.3cm]
        \hline\hline
        Australian Capital Territory   & Legalization    &license&   license&registration&illegal\\[0.3cm] \hline
        New South Wales&   Decriminalization  & legal   & legal& legal& legal$^1$\\[0.3cm]\hline
        Northern Territories &Legalization & illegal&  license&  registration&illegal\\[0.3cm]\hline
        Queensland    &Legalization & license&  illegal&legal&illegal\\[0.3cm]\hline
        South Australia&   Criminalization  & illegal&illegal&legal&illegal\\[0.3cm]\hline
        Tasmania&   Criminalization  & illegal&illegal&legal&illegal\\[0.3cm]\hline
        Victoria & Legalization    &license&   license&registration&illegal\\[0.3cm]\hline
        Western Australia& Criminalization  &illegal&   legal&not specified$^2$&illegal\\[0.3cm]\hline
    \end{tabular}
    \end{minipage}
    \end{sidewaystable}

I am trying to produce a table of text for a paper but I am having issues with the alignment of text inside the cells.

What I am trying to obtain is to have the text exactly in the center of each cell. I tried with tokens c and m but I am not obtaining my ideal result because the text is either centered but up in the cell or on the upper left.

What I am not getting is that it works for column titles but not for the content of the cells as you can see from this partial screenshot

enter image description here

I went around the other questions but all the answers I found do not match my exact need. Does anybody have any hint?

1
1

I suggest you make several adjustments:

  • Replace tabular with tabularx, and employ a centered version of the X column type for the five data columns. Doing so eliminates the tedious work of determining how wide the five data columns should be.

  • Use fewer, but well-spaced, horizontal lines, don't use any vertical lines. That way, you don't have to spend any time at all figuring out how to center the cell contents.

  • Load the threeparttable package and use its machinery to typeset the table-related footnote markers and footnotes.

enter image description here

\documentclass[12pt,a4paper]{article}
    \usepackage[utf8]{inputenc}
    \usepackage{amsmath,amssymb,setspace}
    \usepackage{rotating,array,float}
    \newcolumntype{C}{>{\centering\arraybackslash}X}
    \usepackage{booktabs,tabularx,dcolumn,adjustbox}
    \usepackage[font=normal,skip=.333\baselineskip]{caption}
    \usepackage[margin=2.5cm]{geometry}
    \usepackage[strict]{changepage}
    \usepackage[flushleft]{threeparttable} % new
\begin{document}

    \begin{sidewaystable}
    \begin{threeparttable}
    \caption{\dots}

    \begin{tabularx}{\textwidth}{@{} l *{5}{C} @{}} 
        \toprule
        \textbf{State/Territory}
        & \textbf{Type of legislation} 
        & \textbf{Brothels}
        & \textbf{Escort agencies}
        & \textbf{Private work}
        & \textbf{Street work}\\
        \midrule
        Australian Capital Territory   & Legalization    &license&   license&registration&illegal\\ \addlinespace
        New South Wales&   Decriminalization  & legal   & legal& legal& legal\tnote{1}\\ \addlinespace
        Northern Territories &Legalization & illegal&  license&  registration&illegal\\ \addlinespace
        Queensland    &Legalization & license&  illegal&legal&illegal\\ \addlinespace
        South Australia&   Criminalization  & illegal&illegal&legal&illegal\\ \addlinespace
        Tasmania&   Criminalization  & illegal&illegal&legal&illegal\\ \addlinespace
        Victoria & Legalization    &license&   license&registration&illegal\\ \addlinespace
        Western Australia& Criminalization  &illegal&   legal&not specified\tnote{2}&illegal\\
        \bottomrule
    \end{tabularx}

    \medskip
    \begin{tablenotes}
    \footnotesize
    \item[1] \dots
    \item[2] \dots
    \end{tablenotes}
    \end{threeparttable}
    \end{sidewaystable}
\end{document}

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