TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using the minted, floatrow, caption, and listing packages to create code blocks like these:

my code block

To do this, I'm using a hack based on this answer. Here is what I have:


% the number style (from fancyvrb package):

% caption style
% this is from floatrow package:

  \setkeys{minted@opt}{linenos,fontfamily=courier,fontsize=\scriptsize, xleftmargin=21pt}

And I call mycode like this:

\begin{mycode}{ruby}{Código do método Project\#tasks\_by\_position (versão 3)}{code:tdd_code3}
# app/models/project.rb
def tasks_by_position position
  tasks.select { |item| item.position.to_s == position.to_s }

The problem is that when using the floatrow package, the [H] "put it here" placement option doesn't work, and my code is placed at the end of the text. If I remove the floatrow package, the code works fine, but I can't put the caption at the top and the line at the bottom.

edited (30/01/2012)

As egreg asked, I made an minimal example and realize that the problem is that I'm using the \documentclass{abnt} from abntex package. If I use the \documentclass{book}, for example, it works. Unfortunately, this package have only Brazilian Portuguese documentation and it's not updated since 2006.

share|improve this question

closed as too localized by lockstep, percusse, egreg, Torbjørn T., Joseph Wright Mar 3 '12 at 22:32

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

It doesn't happen to me. Please, make a minimal example showing the problem. – egreg Jan 28 '12 at 10:11
Thanks for the code above, useful for me. For the preamble I needed to add \definecolor{MidnightBlue}{HTML}{191970} besides the basics (documentclass{...}, begin{document}, end{document}). – Jodi Schneider Aug 31 '13 at 9:49