0

I am trying to set up a document in Overleaf with \documentclass[12pt]{comjnl} where i need to have a table in the middle of some text.

The table does not react when i use the position parameter for here: [H!] or [h!]

The code looks like this:

\begin{table}[H!] 
    \centering
    \begin{tabular}{lll}
Model                   & Parameters   & MAE \\
Linear Regression       & None/Default & 25.994              \\
Logistic Regression     &              &                     \\
Linear SVC              &              &                     \\
Random Forest Regressor & n\_estimators=10  & 15.739 \\
Decision Tree Rergessor &              &                     \\
XGBoost                 &              &                    
    \end{tabular}
    \caption{Caption}
    \label{tab:my_label}
\end{table}

The [!H] ends up being shown in my table. Can anyone help me get the table to be placed correctly, without the [H!]?

  • 1
    The H option is added by the float package. However, it might be better to let the table float and use references in the text (as already mentioned by JouleV). If you don't want the table to float, you could also remove the figure environment and ose \captionof from the caption package. – leandriis May 18 at 15:01
  • 1
    For completeness' sake: this looks to be comjnl.cls which can be obtained from academic.oup.com/comjnl/pages/Manuscript_Preparation_Submission. Direct link: academic.oup.com/DocumentLibrary/comjnl/comjnl.cls.txt It looks like the class has re-defined floats, so optional parameters are no longer recognised. – LianTze Lim May 18 at 15:07
  • @LianTzeLim oops I guess in that case you should post that as an answer and I'll delete mine, thanks for checking! – David Carlisle May 18 at 15:10
  • Thanks @DavidCarlisle, will do that! – LianTze Lim May 18 at 15:16
5

This looks to be comjnl.cls, which can be obtained from https://academic.oup.com/comjnl/pages/Manuscript_Preparation_Submission. Direct link: https://academic.oup.com/DocumentLibrary/comjnl/comjnl.cls.txt

It looks like the class has re-defined tables and figures, so optional parameters are no longer recognised: this means the [H], [h] etc will just be considered as part of the table content. So you'll just have to let the floats float, per the journal's intentions.

  • Thank you for clarifying. Is there no way to override the predefined options? Or alternatively remove it form the .cls? – asguldbrandsen May 18 at 15:35
  • 1
    No, there isn't a way to override the options here, and it would be highly discouraged to do so or to modify the .cls file in any way. The .cls is provided by the journal so that manuscripts can be formatted to their submission requirements, so any modifications to their styles are usually frowned upon (especially if you're writing a manuscript for their journal!) – LianTze Lim May 18 at 15:45
  • @asguldbrandsen the whole point of journal classes is to remove choice from the author and enforce the journal style, technically it is most likely easy to undo any changes the class makes but it may prevent use of the article for the journal that the class is designed for. – David Carlisle May 18 at 15:45
  • Thank you for your answers. I am aware and agree that editing in the template makes no sense if writing for the journal :) The document is currently only for an exam hand in - I was just curious if it was possible. Amazed with the responses here, thanks a lot. – asguldbrandsen May 19 at 0:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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