Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have a problem with minted. I have created a new minted environment like so:

\definecolor{dhscodebg}{rgb}{0.95,0.95,0.95}
\newminted[dhscode]{hs}{tabsize=4, fontsize=\footnotesize, frame=lines, framesep=\fboxsep, bgcolor=dhscodebg, rulecolor=\color{gray!40}}

If I use it like so:

\begin{dhscode}
foo :: Double -> Int
\end{dhscode}

The result is:

enter image description here

You will notice the space between the frame and where the background ends. Is there a way to get rid of this space?

share|improve this question
1  
Welcome to TeX.SX. –  Claudio Fiandrino Nov 29 '12 at 13:50
add comment

1 Answer

up vote 5 down vote accepted

This affects all your minted environments. One work around is to set \fboxsep to 0pt in the definition of minted@colorbg as follows.

\makeatletter
\renewenvironment{minted@colorbg}[1]{
\setlength{\fboxsep}{\z@}
\def\minted@bgcol{#1}
\noindent
\begin{lrbox}{\minted@bgbox}
\begin{minipage}{\linewidth}}
{\end{minipage}
\end{lrbox}%
\colorbox{\minted@bgcol}{\usebox{\minted@bgbox}}}
\makeatother

Here is a full minimal working example (MWE). (You should construct one in succeeding posts for speedier replies. A lot of answerers do not like to work from scratch.)

\documentclass[preview,border=5]{standalone}

\usepackage{minted}

\makeatletter
\renewenvironment{minted@colorbg}[1]{
\setlength{\fboxsep}{\z@}
\def\minted@bgcol{#1}
\noindent
\begin{lrbox}{\minted@bgbox}
\begin{minipage}{\linewidth}}
{\end{minipage}
\end{lrbox}%
\colorbox{\minted@bgcol}{\usebox{\minted@bgbox}}}
\makeatother

\definecolor{dhscodebg}{rgb}{0.95,0.95,0.95}
\newminted[dhscode]{hs}{tabsize=4, fontsize=\footnotesize, frame=lines, framesep=5\fboxrule,framerule=1pt,
bgcolor=dhscodebg, rulecolor=\color{gray!40}}

\begin{document}
\begin{dhscode}
foo :: Double -> Int
\end{dhscode}
\end{document}

enter image description here

share|improve this answer
    
Thanks, I can not use this since I use minted in other ways as well, but it's better than nothing. –  user21919 Jan 4 '13 at 19:12
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.