0

I'm working on a project that repUerj template needs to be used and tables, figures and graphs environments are necessarily followed by their width in parentheses as a characteristic of this template.

Ex:

\begin{table}{15cm} 
... 
end{table}

The issue with this pattern is that I can't force figures, tables and graphs placement in text. I tried that using \float and \placeins but the commands from these packages simply don't work.

When I delete the width in parentheses, LaTeX returns an error messagem:

Missing number treated, as zero \end{table}

The packages used in repUerj are listed below:

\usepackage[utf8]{inputenc}
\usepackage{makeidx} 
\usepackage{hyperref
\usepackage{indentfirst}
\usepackage{graphicx}
\usepackage{subfig}
\usepackage{multirow}
\usepackage{amsmath,amssymb}
\usepackage[font=default,frame=no]{repUERJformat}
\usepackage[dots=yes]{repUERJpseudocode}
\usepackage[maxfloats=25]{morefloats}
\usepackage{array}
\setlength\extrarowheight{2pt}

concrete example:

enter image description here

RepUerj is available here: https://www.overleaf.com/read/bpqdkmgxznvh#/11388571/

Does anyone know any other alternative to use in this case?

  • 1
    the example document shows that the usual placement option goes before the width \begin{table}[hbtp]{12cm} but please post a minimal example (which should however be a complete document) if you need specific help almost all the code you show is loading packages unrelated to tables, but you haven't shown an example of a table that has a problem so it is impossible to suggest any changes – David Carlisle May 12 '18 at 23:02
  • this appears to be a duplicate of your previous question tex.stackexchange.com/questions/430826/… – David Carlisle May 12 '18 at 23:11
  • David, could you give me an example of how to create a minipage in this case? – phill May 12 '18 at 23:16
  • posting an image of code does not allow anyone to help debug. You shoud post a small minimal document. But your code is clearly not using the class as designed you have specified the table is 14cm in width but then ignored that and scaled the table to \textwidth 9as you have provided no example I don't even know if that is smaller of less than \textwidth) You should really avoid applying \resizebox to any text especially tables. – David Carlisle May 12 '18 at 23:42
  • the class file is putting the content of the table environment in a minipage already – David Carlisle May 12 '18 at 23:45
3

The class defines

\newenvironment{table}[2][]
  {\@float{table}\begin{center}\begin{minipage}{#2}\begin{center}}
  {\end{center}\end{minipage}\end{center}\end@float}

so the optional argument [htbp] comes before the width argument but it (#1) is never used so [ht] is the same as [htp] or [hello world]

This may be an error or it may be by design in this class to remove the possibility of authors controlling float placement. All floats use the default placement which is tbp However other mechanisms for controlling floats would work, such as \FloatBarrier from the placeins package or using \clearpage.

If you have a requirement to use a class for a specific publication it is best not to redefine the macros of that class. Oddly the class does not disable the position argument if you use table* instead of table so that is a possibility.

  • 1
    I didn’t download the class file (too many javascript-blocker exceptions to add for my taste), but I feel somewhat reluctant to put my complete trust in someone who uses a center environment inside a minipage inside a center inside a float… – GuM May 13 '18 at 0:45
  • Oops, sorry: of course, the above comment was actually meant for the OP (@phill). – GuM May 13 '18 at 0:57
  • @GuM I did not download it either (unless you count viewing in sharelatex) but yes not using the class would be the preferable option if that option is available. – David Carlisle May 13 '18 at 7:17
  • Thank you so much, @DavidCarlisle. Using table* works fine for me! – phill May 13 '18 at 21:39
  • @Joseph in a one column class there is no difference between table and table* the only difference in this class is that it has broken table and (probably accidentally) left table* as normal. – David Carlisle May 14 '18 at 7:10

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.