0

I use the following template and want to place some tables exactly in a specific place using the command [H] and \usepackage{float}. However, the solution proposed HERE does not work for two-column documents, neither for the tables, nor for the algorithms.

For the algorithms, I get the following error message:

"[H] in two columns mode is not allowed for algorithms."

And for the figures, I get this error message:

"Unknown float option `H'."

For the tables, although I do not get error message, but [H] has no effect.

The tables and algorithms are actually shown in the end of document.

https://www.overleaf.com/latex/templates/elseviers-cas-latex-double-column-template/hhzpymgjmxfk

Update: As requested in comments, I add an example of the table that is currently shown in the end of document as follows. I am sure that I added the \usepackage{float}. I also tested the latex template link of Overleaf and it is available.

\documentclass[a4paper,fleqn]{cas-dc}

\usepackage{float}

\begin{document}

\begin{table}[H] \caption{Caption.} \label{Table_1} \begin{tabular}{cccc} \toprule \shortstack{P \ R} & \shortstack{N \ C} & \shortstack{P \ Re} & \shortstack{N \ T}\ \midrule 1 & 3 & $10^{3}$ & 100\ 2 & 3 & $10^{3}$ & 100\ 3 & 3 & $10^{3}$ & 100\ 4 & 3 & $10^{3}$ & 100\ 5 & 3 & $10^{3}$ & 100\ 6 & 3 & $10^{3}$ & 100\ 7 & 3 & $10^{3}$ & 100\ \bottomrule \end{tabular} \end{table}

\end{document}

Update: See tables 1 and 2 (page 10) in this Elsevier journal; two wide tables inserted at the top of the page, and not at the end of the document. That's exactly what I want to do : https://reader.elsevier.com/reader/sd/pii/S0164121223000225?token=A1940EF6353745EE00367916369CD219EE8C93261423E249D8A8CA73E8CFF38976F08D1A2005BBC72F6A7BDF6E47A110&originRegion=eu-west-1&originCreation=20230302121751

  • 1
    You can not use \begin{table*}[H] what would you expect it to do? a spanning float can only go at top or bottom of the page, you can not use h or H – David Carlisle Feb 28 '23 at 17:17
  • @David Carlisle , I changed it and used exactly the command in this answer: https://tex.stackexchange.com/a/9486/148579 , that is, \begin{figure}[H] but the same error as before... In any case, my main need is to apply float for the tables and algorithms? – Questioner Feb 28 '23 at 17:22
  • that answer assumes standard latex environments. The elsevier classes have definitions such as \RenewDocumentEnvironment { table* } { O{width=\FullWidth} } so redefining these environments with a custom optional argument, as such they will be incompatible with float package. Always the same comment about publisher classes, only use them if submitting to the publisher, and then use them as specfied, redefining the macros will just make it more likely your submision is rejected. – David Carlisle Feb 28 '23 at 17:31
  • @David Carlisle , I updated the question by additional elements of the document class and \usepackage{float} I really do not know what complementary elements you need to be added, but the latex template that is for Elsevier publisher is added to the question so you can see all the features of this temple. If you can not access the template please let me know, I tested it and the template is accessible. – Questioner Feb 28 '23 at 17:33
  • 1
    if I run your example I get an error that \bibsep is undefined (a bug in the class) so added \newdimen\bibsep and an error about the spurious } on the last row which I deleted, but then it makes the expected output with no error – David Carlisle Feb 28 '23 at 17:38
  • @David Carlisle , I downloaded cas-dc.cls . Clould you please say that when exactly I should add \newdimen\bibsep to fix the error? Thanks – Questioner Feb 28 '23 at 18:05
  • anywhere before begin document (I did not download the class I used the one in the standard texlive distribution) – David Carlisle Feb 28 '23 at 18:46
  • @David Carlisle , How can do it via the standard texlive distribution? Is it done through Overleaf? – Questioner Mar 01 '23 at 11:52
  • I am not sure what you mean. cas-dc.cls is in texlive. So in a local installation, or on overleaf, you can simply use \documentclass[a4paper,fleqn]{cas-dc} just as you can use \documentclass[a4paper,fleqn]{article} you do not need to install any extra files downloaded from Elsevier or ctan. – David Carlisle Mar 01 '23 at 11:56
  • @David Carlisle , Ok, I am using Overleaf with the \documentclass[a4paper,fleqn]{cas-dc} as before and by using \begin{table*}[H] the table is still shown at the end of the document. (I put * because the table is wide.) – Questioner Mar 01 '23 at 12:12
  • @David Carlisle , As I mentioned in the question, For the tables, although I do not get error message, but [H] has no effect. – Questioner Mar 01 '23 at 12:23
  • @Questioner yes of course H and h can not be used with a spanning float as I wrote in a comment yesterday. You want to span across both columns so it has to go at the top of the page. – David Carlisle Mar 01 '23 at 14:37
  • @David Carlisle , Even when I remove [H] , the table is not placed Here, but yet at the end of the document. And also, with begin{table*}[H] it is not shown at the top of the page, but at the end of the document. – Questioner Mar 01 '23 at 14:59
  • a table* wll go at the earliest on the following page, and may go later if it does not fit there, you are using a publisher style, let the publisher worry about placement. In most cases, Elsevier only accept latex submissions as an author convenience they don't actually use tex in production so the important thing is to use the markup they specify, so they can process it. – David Carlisle Mar 01 '23 at 15:13
  • @David Carlisle, See the tables 1 and 2 (page 10) in this Elsevier journal; two wide tables inserted at the top of the page, and not at the end of the document. That's exactly what I want to do : https://reader.elsevier.com/reader/sd/pii/S0164121223000225?token=A1940EF6353745EE00367916369CD219EE8C93261423E249D8A8CA73E8CFF38976F08D1A2005BBC72F6A7BDF6E47A110&originRegion=eu-west-1&originCreation=20230302121751 – Questioner Mar 02 '23 at 12:22
  • Exactly. They are top floats, by using \begin{table*}[h] you are preventing top floats (no t) and as you can not have h you are forcing the figure to the end of the document. Just use \begin{table*} and move it early enough in the source file that it lands on the page you want. – David Carlisle Mar 02 '23 at 12:38
  • @David Carlisle , And the same for the algorithms? Most of the algorithms are currently inserted at the end of the document as well... – Questioner Mar 02 '23 at 12:52
  • float positioning depends on the whole document impossible to say anything without an example, but the whole thing is almost certainly a non issue, the Journal will (if it is like most journals) re-set your document anyway so page breaks and float placements in your submission are irrelevant – David Carlisle Mar 02 '23 at 13:48

0 Answers0