# Table alignment issues with the style file for the journal of the royal statistical society [duplicate]

This question already has an answer here:

So I'm trying to format my paper for submission, and the style file for JRSS-b (statsoc.sty) seems to be badly mungling tables. Here is a simple example;

\documentclass{statsoc}
\usepackage[a4paper]{geometry}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}

\usepackage{amsmath,amssymb}

\title[Short title]{Statistics Journal Style Guide}
\author[Author 1 {\it et al.}]{Author}

\begin{document}

\begin{abstract}
\end{abstract}
\subsection{Sample title}
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

\begin{table}
\caption{\label{tab01}A table as an example}
\centering
\fbox{%
\begin{tabular}{*{10}{c}}
\em a&\em b&\em c&\em da&\em b&\em c&\em da&\em b&\em c&\em d\\
\hline
a&b&c&da&b&c&da&b&c&d\\
a&b&c&da&b&c&da&b&c&d\\
a&b&c&da&b&c&da&b&c&d\\
a&b&c&da&b&c&da&b&c&d\\
\end{tabular}}
\end{table}

\end{document}


Which compiles to

The caption is way to the left and the table outside the bounds to the right, whereas they should both be centered

## marked as duplicate by egreg captions StackExchange.ready(function() { if (StackExchange.options.isMobile) return; $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() { var$hover = $(this).addClass('hover-bound'),$msg = $hover.siblings('.dupe-hammer-message');$hover.hover( function() { $hover.showInfoMessage('', { messageElement:$msg.clone().show(), transient: false, position: { my: 'bottom left', at: 'top center', offsetTop: -7 }, dismissable: false, relativeToBody: true }); }, function() { StackExchange.helpers.removeMessages(); } ); }); }); Mar 2 '18 at 18:26

• I do not have this problem, but I had to compile several times. – Bernard Mar 1 '18 at 23:20
• huh,... So it looks like the issue is reproducible on sharelatex.com with or without the patch from that question. When I run it with my local distribution however, it works fine with or without the patch. – Ian Fellows Mar 1 '18 at 23:45

As egreg's linked issue suggested, applying the following patch and clearing the aux files solved the issue.

\usepackage{etoolbox}

\makeatletter
\patchcmd{\@makecaption}
{\parbox}
{\advance\@tempdima-\fontdimen2\font\parbox} % decrease the width!
{}{}
\makeatother


On sharelatex the aux files can be removed by clearing the cache.