3

I have a quite wide table which goes beyond the right border of the page, which is okay to me, but I'd like it to be centered so that it oversteps also the left border and it becomes fully visible:

enter image description here

Is there a parameter I can set in the table to position it right? I already used the '\tiny' font size, I don't know how to better improve this.

Here's the table code:

    \documentclass[12pt,a4paper,oneside]{report} 
\usepackage[utf8]{inputenc}
\usepackage{booktabs,amssymb,caption}
    \usepackage{makecell}
    \begin{document}
    \begin{table}[!h]
    \tiny
    \centering
      \begin{tabular}{cccccccccccc}
        \toprule
        \thead{n. children\\in each stage} & \thead{SV\\simple} &  \thead{SV\\unacc.} & \thead{VS\\unacc.} &\thead{Root-WH\\argument} & \thead{WH-adjunct\\\textit{why} excluded} &\thead{Preposed\\Adv} & \thead{Root\\y/n}&\thead{Why}&\thead{Relative\\clauses} &  \thead{Topic} &  \thead{Embedding}\\
        \midrule
        5 &\checkmark &\checkmark&\checkmark&&&&&&&&\\
        12 &\checkmark&\checkmark&\checkmark&\checkmark&\checkmark&\checkmark&\checkmark&&&&\\
        34 &\checkmark&\checkmark&\checkmark&\checkmark&\checkmark&\checkmark&\checkmark&\checkmark&\checkmark&\checkmark&\checkmark\\
            \bottomrule
      \end{tabular}
    \caption*{\small{Number of children displaying specific syntactic structures in a repetition task, adapted from (\cite{Friedmann2021-xf}:16)}}
    \end{table}
    \end{document}

Thanks in advance!

5
  • 2
    Please tell us more about your document setup: Which document class do you employ? How wide is the textblock? What's the main font size? Incidentally, are you sure about \usepackage{tabular}? I've never heard of a LaTeX package called tabular before. Did you maybe mean to write \usepackage{booktabs,amssymb,caption}?
    – Mico
    Mar 19 at 16:47
  • You can use \noindent\makebox[\textwidth\[r]{...} to right justify the contents, even if it overlaps the left margin. However, I would think about rotating the column titles instead. Mar 19 at 17:20
  • @Mico thanks for your suggestions! I edited the question including that information
    – Tom
    Mar 19 at 17:28
  • 1
    What about transposing the table?
    – leandriis
    Mar 19 at 17:44
  • As others mentioned, you could transpose the table (change rows and colors), you could use a landscape page, you could decrease the space between your columns, you could rotate the headers... Mar 19 at 17:52

3 Answers 3

2

If, for some reason, you don't want to transpose the table and you don't want to rotate the column headers by 90 degrees, you can still make the fit inside the width of the text block by (a) issuing the instruction \renewcommand\theadfont{\tiny}, to match the font size in use in the rest of the table, and (b) employing a tabular* environment (with a target width of \textwidth) instead of a tabular environment.

enter image description here

\documentclass{article}
\usepackage{makecell,booktabs,amssymb,caption}
\let\cm\checkmark % handy shortcut macro

\begin{document}
\begin{table}[!h]
\setlength\tabcolsep{0pt} % make LaTeX figure out intercolumn space
\tiny
\renewcommand\theadfont{\tiny}
\captionsetup{font=footnotesize,justification=raggedright}
%\centering % redundant
  \begin{tabular*}{\textwidth}{@{\extracolsep{\fill}} *{12}{c}}
  \toprule
  \thead{No.\ of children\\in each stage} & \thead{SV\\simple} &  \thead{SV\\unacc.} & 
  \thead{VS\\unacc.} & \thead{Root-WH\\argument} & \thead{WH-adjunct\\ \textit{why} excluded} &
  \thead{Proposed\\Adv} & \thead{Root\\y/n} & \thead{Why} & 
  \thead{Relative\\clauses} & \thead{Topic} & \thead{Embed-\\ding} \\
  \midrule
   5&\cm&\cm&\cm \\
  12&\cm&\cm&\cm&\cm&\cm&\cm&\cm \\
  34&\cm&\cm&\cm&\cm&\cm&\cm&\cm&\cm&\cm&\cm&\cm \\
  \bottomrule
  \end{tabular*}
  \caption*{Number of children displaying specific 
  syntactic structures in a repetition task, adapted 
  from \cite{Friedmann2021-xf}:16.}
\end{table}
\end{document}
5

I would suggest transposing the table so you don't have to negotiate different font sizes and angles for things to fit.

enter image description here

\documentclass{article} 

\usepackage{booktabs,amssymb}
\usepackage{makecell,array}

\begin{document}

\begin{table}
  \centering
  \begin{tabular}{ l *{3}{w{c}{2em}} }
    \toprule
    & \multicolumn{3}{c}{\makecell{Number of children \\ in each stage}} \\
    \cmidrule(lr){2-4}
    \multicolumn{1}{c}{Syntactic structure} & 5 & 12 & 34 \\
    \midrule
    SV simple                        & \checkmark & \checkmark & \checkmark \\
    SV unacc.                        & \checkmark & \checkmark & \checkmark \\
    VS unacc.                        & \checkmark & \checkmark & \checkmark \\
    Root-WH argument                 &            & \checkmark & \checkmark \\
    WH-adjunct \textit{why} excluded &            & \checkmark & \checkmark \\
    Preposed Adv                     &            & \checkmark & \checkmark \\
    Root y/n                         &            & \checkmark & \checkmark \\
    Why                              & \checkmark &            & \checkmark \\
    Relative clauses                 & \checkmark & \checkmark &            \\
    Topic                            &            &            & \checkmark \\
    Embedding                        & \checkmark &            &            \\
    \bottomrule
  \end{tabular}
  \caption{Number of children displaying specific syntactic structures in a repetition task, adapted from [X]}
\end{table}

\end{document}
1

Edit (2):
Now considering the edited question. ANd also load last version of table code. Now the first row is correctly spaced. i.e. aligned at bottom of the row.

One way is to rotate the columns' header texts. By this there is no need for the table to cross the text borders and use a smaller font size:

enter image description here

This can be done in many ways, I liked with use tabularraya, \makecell and rotating packages:

\documentclass[12pt,a4paper,oneside]{report} 
%---------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%
\usepackage{lipsum}% For dummy text. Don't use in a real document

\usepackage[font=small]{caption}
\usepackage{dingbat}
\newcommand\CM{\checkmark} %
\usepackage{rotating}
\usepackage{makecell}
\usepackage{tabularray}
\UseTblrLibrary{booktabs}

\begin{document}
\lipsum[11]

    \begin{table}[ht]
\renewcommand\theadfont{}
\settowidth\rotheadsize{in each stage}    % from makecell
\begin{tblr}{colspec = {@{} *{12}{X[c]} @{}}, 
             colsep  = 3pt,
             row{1}  = {cmd=\rothead, font=\linespread{0.9}\selectfont}, % <---
            }
    \toprule
n. children in each stage
    &   SV simple
        &   SV unacc.
            &   VS unacc.
                &   {Root-WH\\ argument}
                    &   WH-adjunct \textit{why} excluded
                        &   Preposed Adv
                            &   Root y/n
                                &   Why
                                    &   Relative clauses
                                        &   Topic
                                            &   Embedding   \\
    \midrule
5  & \CM & \CM & \CM &     &     &     &     &     &     &     &        \\
12 & \CM & \CM & \CM & \CM & \CM & \CM & \CM &     &     &     &        \\
34 & \CM & \CM & \CM & \CM & \CM & \CM & \CM & \CM & \CM & \CM & \CM    \\
   \bottomrule
\end{tblr}
\caption*{Number of children displaying specific syntactic structures in a repetition task, adapted from (\cite{Friedmann2021-xf}:16)}
    \end{table}
\lipsum[77]
\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .