gutenberg / latex-awesomebox

A package to draw attention boxes in your documents, illustrated with FontAwesome icons (Mirror)
https://git.umaneti.net/latex-awesomebox/about/
Do What The F*ck You Want To Public License
52 stars 6 forks source link

How to add a minted environment in inside an awesomebox? #4

Closed bblanchon closed 5 years ago

bblanchon commented 6 years ago

Hi,

First, thank you for this excellent project, no other package provides such a simple and modern look to a document.

I'm having a hard time inserting code snippets in a box. For example:

\notebox{
This could be written as:
\begin{minted}{c++}
std::cout << "hello world!" << std::endl;
\end{minted}
}

produces the error:

! Argument of \FV@BeginScanning has an extra }.

I managed to work around this problem by saving the minted environment in a box, as suggested in this answer, but it seems much more complicated than it should be.

Do you have any advice to include code snippets in boxes?

Regards, Benoit

milouse commented 6 years ago

Hi,

Thank you very much for your kind review. I must admit I never take time to actively work on embedding environment in the boxes. This should be a problem with other environment too.

One solution may be to replace the boxes with dedicated environment

\begin{notebox}
…
\end{notebox}

… but when I tried to do it once, it failed. I'll try tro look at it in a nearer future, but for now your solution is the best one I think.

bblanchon commented 6 years ago

Hi,

I myself wrapped the awesomebox commands in environments using \NewEnviron because I find it more convenient, but the problem remains.

As far as I understand, one cannot simply put a minted environment in a tabularx. Maybe the solution would be to avoid the tablularx, do you see an alternative?

Regards, Benoit

milouse commented 5 years ago

My last changes involving tabu/tabularx removing must have fixed your problem. Can you confirm by testing the latest commit?