I'm using Doxygen to generate LaTeX code from source, and want to use the minted package for code highlighting from comments. I'm using the doxygen f{minted{{java} ... \} command section, which properly generates \begin{minted}{java} \end{minted}, but all my newlines from the doxygen document are removed and I can't force doxygen to keep them as far as I know.

Is there any way to force minted to consider a command a newline and use code formatting properly?


 * \f{minted}{{java}
 * code; // comment
 * other code; // here it all goes terribly wrong without linebreaks
 * more code; 
 * \}
  • it would be easier to answer without requiring doxygen if you posted a complete small latex document with the dropped line endings for testing Jan 19, 2017 at 17:16

1 Answer 1


fancyvrb requires a newline on the lines with \begin{minted} and \end{minted} but you can replace all the newlines in the code by an otherwise unused character I use ` here.

The first display has normal line breaks, the second is all on one line.

enter image description here




 for(zz=0;zz<-1;zz++) {

if(!foo){` for(ww=0;ww<-1;ww++) {`    x=y;` }`}


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .