3

I am using the following:

\usepackage[labelsep=newline,
justification=centering, labelsep=period,
singlelinecheck=off, font=bf]{caption}

however, then using sidewaystable I am getting a centered:

          Table I. My Caption is here behind the numbering

but when using tablenormal, I get centered:

                 Table I
  My Caption is here below the numbering

How can I make my sidewaystable behave like the normal tablesetup?

Just fyi, the above caption setup is used for my figures:

Figure 1. Some short caption (which shows in the list of figures). HERE HERE some longer 
description which do not pop up in the list of figures.

edit: adding a screenshot: Sidewaystable without new line, normal table line break

edit2: I include everything I have in the preamble and the way I do the tables. I hope I captured everything that might cause the issue (and sorry for the long code)

\documentclass[11pt,a4paper,english,oneside]{article}
\usepackage{etex} %Because of many packages --> Extended TeX.
\usepackage[left=4cm, right=3cm, top=3cm, bottom=3cm]{geometry} %Helps to structure the paper layout.
\usepackage[Lenny]{fncychap} %Design of the thesis.
\usepackage[utf8]{inputenc} %Due to vowels.
\usepackage[british]{babel} %Define the language style.
\usepackage{dsfont} %Nice style for the indicator function.
\usepackage{fancyhdr} %To customize the headers and footers.
\usepackage{booktabs} %In case you need \cmidrule or \addlinespace in tables.
\usepackage[hang,bottom,stable,multiple]{footmisc} %Style of footnotes.
\usepackage{appendix} %For the \appendixpage command.
%Load some mathematical packages.
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{mathtools}
\usepackage[sort,round]{natbib} %For the bibliography.
\usepackage{etoolbox} %To remove the page number on \appendixpage.
\usepackage{amsthm} %For theorems, definitions etc.
\usepackage{thmtools} %For theorems, definitions etc.
\usepackage{setspace} %Use double spacing.
\usepackage{lipsum} %For the \lipsum command to generate a text.
\usepackage{datetime} %For the specification of the date.
%\usepackage{tocloft} %The ToC, LoF and LoT each appear not necessarily on a new page.
\usepackage{rotating}
\usepackage{tikz}
\usetikzlibrary{positioning}
\usepackage[outdir=./]{epstopdf}
\usepackage{graphicx}
\usepackage{float}
\usepackage{pdfpages}
%\usepackage{mcode} %To implement a Matlab code.
\usepackage[margin=0pt, font=small, labelfont=bf, labelsep=endash]{caption} %Customize the captions.
\usepackage{chngcntr} %To use counterwithout.
\usepackage{epstopdf} %For inserting .eps files into the document.
\usepackage{hyperref} %Must be loaded at the end.
\usepackage{xparse} %Load for \NewDocumentCommand command.
\usepackage{cleveref} %For the command \cref, load after hyperref.
\usepackage{arydshln} %Due to the capability to draw horizontal/vertical dash-lines.
\usepackage{array,hhline} %To create tables and matrices.
\usepackage{rotating} %To rotate a table.
\usepackage{tabularx} %An extended version of tabular.
\usepackage{fixltx2e}
\usepackage{threeparttable}
\usepackage{threeparttablex}
\usepackage{pdflscape, longtable}
\usepackage{capt-of}
\usepackage{makecell}
\usepackage{textgreek}

\usepackage[justification=centering, labelsep=period,
singlelinecheck=off, font=bf]{caption}

%\captionsetup[figure]{justification=justified,singlelinecheck=false}

\usepackage{subcaption}
\usepackage{siunitx}
\usepackage{etoolbox}
\robustify\bfseries 
\sisetup{detect-weight=true,detect-inline-weight=math}
\usepackage{fancybox}
\usepackage{array}

\usepackage{dcolumn}
\newcolumntype{d}[1]{D{.}{.}{#1}}
\newcommand\mc[1]{\multicolumn{1}{c}{#1}}

%Setup of the reference links.
\hypersetup{
     colorlinks=false,
     linkcolor=blue,
     citecolor=blue,
     filecolor=magenta,
     urlcolor=blue}

%Define some reasonable margins.
\setlength{\textwidth}{6.6in}
\setlength{\textheight}{8.8in}
\setlength{\topmargin}{-0.1in}
\setlength{\oddsidemargin}{0in}
\setlength{\parskip}{1mm}

\bibliographystyle{abbrvnat} %Reference style.
\allowdisplaybreaks[1] %Page breaks of equations are allowed, but avoided if possible. 2-4 more relaxed.

%New command for the HSG logo.
\newcommand*{\plogo}{\includegraphics[scale=0.5]{HSG_Logo}}

%New command for the differential d to have an ordinary d.
\makeatletter
  \newcommand{\ud}{\mathrm{d}}
\makeatother

%Remove page number on \appendixpage. Use the package 'etoolbox'.
\makeatletter
\patchcmd{\@chap@pppage}{\thispagestyle{plain}}{\thispagestyle{empty}}{}{}
\makeatother

%Declare Definitions, Theorems etc.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\declaretheorem[style=definition,qed=$\blacktriangleleft$, numberwithin=section]{remark} %additional options; numberwithin=,..., see 'Thmtools' Users’ Guide
\declaretheorem[style=definition,qed=$\triangle$,numberwithin=section]{definition}
\newtheorem{ass}{Assumption}[section]
\newtheorem{prop}{Proposition}[section]
\newtheorem{lemma}{Lemma}[section]
\declaretheorem[style=definition,qed=$\perp$,numberwithin=section]{example}
\newtheorem{theorem}{Theorem}[section]
\newtheorem{coroll}{Corollary}[section]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%% Journal of Finance %%%%%%%%%%

%%%%%%%%%% Footnote Issue %%%%%%%%%%

% Footnotes
\makeatletter
\newlength{\myFootnoteWidth}
\newlength{\myFootnoteLabel}
\setlength{\myFootnoteLabel}{1.2em}% <-- can be changed to any valid value
\renewcommand{\@makefntext}[1]{%
    \setlength{\myFootnoteWidth}{\columnwidth}%
    \addtolength{\myFootnoteWidth}{-\myFootnoteLabel}%
    \noindent\makebox[\myFootnoteLabel][r]{\@makefnmark\ }%
    \parbox[t]{\myFootnoteWidth}{#1}%
}
\makeatother

%%%%%%%%%% End: Footnotes Issue %%%%%%%%%%

\renewcommand{\thesection}{\Roman{section}} 
\renewcommand{\thesubsection}{\Alph{subsection}} 
\renewcommand{\thetable}{\Roman{table}} 
\renewcommand{\abstractname}{\textsc{ABSTRACT}}
\makeatletter
% we need a period (.) after sectioning numbers, but not in cites thereto.
\renewcommand{\@seccntformat}[1]{{\csname the#1\endcsname}.\hspace{0.5em}}

\long\def\@makefigcaption#1#2{%
    \vskip\abovecaptionskip
    %#1\\\footnotesize#2
    %\sbox\@tempboxa{\footnotesize\bf#1.\footnotesize#2}%
    %\sbox\@tempboxa{\footnotesize{\textbf{#1.}} footnotesize#2}%
    %\sbox\@tempboxa{\textbf{#1.} footnotesize#2}%
    %\sbox\@tempboxa
    \footnotesize\textbf{#1.} \footnotesize#2
    \ifdim \wd\@tempboxa >\hsize
    \textbf{#1. #2}\par
    \else
    \global \@minipagefalse
    \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
    \fi
    \vskip\belowcaptionskip}

%\renewcommand{\figure}{\let\@makecaption\@makefigcaption\@float{figure}}

\long\def\@maketblcaption#1#2{%
    \vskip\abovecaptionskip %Same size for Numbering and Caption of Tables
    \begin{center}\normalsize\bf#1\\\normalsize#2\end{center}
    % \sbox\@tempboxa{\textbf{#1.} #2}%
    % \global \@minipagefalse
    % \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
    \vskip\belowcaptionskip} 

\renewcommand{\table}{\let\@makecaption\@maketblcaption\@float{table}}
%\renewcommand{\sidewaystable}{\let\@makecaption\@maketblcaption\@float{sidewaystable}}
\makeatother

\setlength{\abovecaptionskip}{0.1cm}
%\setlength{\belowcaptionskip}{-2mm}

%%%%%%%%%% End: Journal of Finance%%%%%%%%%%

\captionsetup[figure]{justification = justified}
\captionsetup[subfigure]{margin={0cm, 1cm}, font=md, justification = justified}

\makeatletter
\setlength{\@fptop}{0pt}
\makeatother

%Readjust the numbering.
\counterwithout{footnote}{section}
\numberwithin{equation}{section}

%\setlength{\parindent}{0cm} %Uncomment this if you don't want to have indents.

\include{titlepage}

%Special header and footer style for the executive summary and Task Assignment section.
\fancypagestyle{firststyle}{%
    \fancyhf{}%
    \renewcommand{\headrulewidth}{0pt}
    \fancyfoot[C]{\thepage}}

%Customize headers and footers.
\pagestyle{fancy}
\fancyhead[R]{\thepage}
\fancyhead[L]{\rightmark}
%\fancyfoot[L]{[ Your Name ]}
%\fancyfoot[C]{}
%\fancyfoot[R]{[ Running Master Thesis Title ]}

%Define the signature line with dots.
\NewDocumentCommand \dotbox {o O{.5\linewidth} m O{3ex} O{\linewidth}}
{
    \begin{minipage}{7cm}
        \makebox[7cm][l]{\,.\dotfill}
        \\
        \makebox[7cm][l]{\,#3}
    \end{minipage}
}

\begin{document}

    \newpage
    \begin{sidewaystable}[htp!]
        \robustify\bfseries
        \robustify\itshape
        \footnotesize
        \sisetup{group-separator={}}
        \caption{Summary Statistics of the Short Leg of the Pairs Trading Strategy}
        \label{tab:SummaryStatsShort}
        \begin{threeparttable}
        \begin{tabular*}{\textwidth}
        \end{tabular*}
        \end{threeparttable}
      \end{sidewaystable}
        \vfill

\newpage
\begin{table}[ht!]
    \setlength\tabcolsep{0.1pt}  % default value: 6.0pt

    \caption{Performance Measures } \label{tab:PerfMeas}

    \footnotesize
    \begin{threeparttable}
        \begin{tabular*}{\textwidth}%
            { @{\extracolsep{\fill}} l *{8}{d{-2.4}} }
\end{tabular*}
    \end{threeparttable}
\end{table}
\vfill

\end{document}
3
  • 1
    I cannot reproduce your problem. Please give us an example document which shows it, enabling us to help you. BTW: labelsep=newline,labelsep=period is identical with labelsep=period so you should not get a newline as separator at all.
    – user2574
    May 20, 2018 at 5:29
  • thank you, @AxelSommerfeldt: I added a screenshot. It's a large file, I wouldn't what to and want not to take out. The preamble is a collection of what I've added in there via the internet, unfortunately not very structured.
    – eternity1
    May 20, 2018 at 5:35
  • We need an example document which shows the problem, otherwise I don't see a way helping you. minimalbeispiel.de/mini-en.html
    – user2574
    May 20, 2018 at 10:46

1 Answer 1

1

You redefine \@makecaption (which typesets captions) for table captions, but not for sidewaystable captions:

\long\def\@maketblcaption#1#2{%
    \vskip\abovecaptionskip %Same size for Numbering and Caption of Tables
    \begin{center}\normalsize\bf#1\\\normalsize#2\end{center}
    % \sbox\@tempboxa{\textbf{#1.} #2}%
    % \global \@minipagefalse
    % \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
    \vskip\belowcaptionskip}

\renewcommand{\table}{\let\@makecaption\@maketblcaption\@float{table}}
%\renewcommand{\sidewaystable}{\let\@makecaption\@maketblcaption\@float{sidewaystable}}

Since you use your own code for table captions, this code will be used for table captions and the one from the caption package will be used for sidewaystable captions. And especially they look different because of this.

I recommended either using the caption package (and simple remove your own definitions of \@makecaption), or using your own caption code (and drop the usage of the caption package), but not a mixture of both. (Same for figures since you use your very own code for figure captions as well.)

3
  • thank you very much for this, @Axel Sommerfeldt. I tried to redefine \@makecpationfor the sidewaytable. It pops up an error. \renewcommand{\sidewaystable}{\let\@makecaption\@maketblcaption\@float{sidewaystable}}. What do I need to change?
    – eternity1
    May 20, 2018 at 19:54
  • 1
    @eternity1 \renewcommand{\sidewaystable}{\let\@makecaption\@maketblcaption\@rotfloat{table}}
    – user2574
    May 21, 2018 at 10:26
  • Thank you very much @Axel Sommerfeldt: That's the solution!
    – eternity1
    May 22, 2018 at 0:53

You must log in to answer this question.

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