1

I have a sample file of a journal and I'm writing my article in this file.

Unfortunately I couldn't bring the caption of tables to top because the position seems to be fixed in the style.

I tried some of your answers for this problem, but there was an error for each solution!

Now... how can I have a table with a justified (not centered) caption that is on the top of the table?

7
  • We would need to know the journal class you're working with (and preferably a minimal example).
    – Werner
    Jan 1, 2017 at 9:09
  • I'm working with "Astrophysical Journal" (or ApJ) style. Is it enough to answer? Jan 1, 2017 at 9:12
  • Ideally we'd like to also see a minimal working example (MWE). And where can we find this apj.cls?
    – Werner
    Jan 1, 2017 at 9:13
  • Actually its a long paper, but if this make a help, it is the sample file structure: Jan 1, 2017 at 9:18
  • 1
    if you intend to publish your article in journal, than don't change prepared (and hard coded) article form. If this is not the case, than don't use their document class but stick with article and caption, where your problem is simple to solve.
    – Zarko
    Jan 1, 2017 at 9:36

1 Answer 1

2

In order to place the caption at the top of the float, place it at the top within your code:

\begin{table}
  \caption{<caption>}
  <table>
\end{table}

To remove the centering and have the \caption justified, you have two options:

  1. Fully justify the entire caption. Add the following to your preamble:

    \usepackage{etoolbox}
    
    \makeatletter
    % \patchcmd{<cmd>}{<search>}{<replace>}{<success>}{<failure>}
    \patchcmd{\@makecaption}{\centering}{}{}{}
    \makeatother
    
  2. Fully justify the caption text only. Add the following to your preamble:

    \usepackage{etoolbox,ragged2e}
    
    \makeatletter
    % \patchcmd{<cmd>}{<search>}{<replace>}{<success>}{<failure>}
    \patchcmd{\@makecaption}{\par}{\par\justifying}{}{}
    \makeatother
    

    This will keep Table X centred, but the caption text justified.

You must log in to answer this question.

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