[Tex/LaTex] mdframed margins

marginsmdframed

I'm new using mdframed package and I stumbled upon with \mdtheorem so I created a definition and I want to use it at the beginning of the page, but the problem is that there is a space in blank between the page and the definition, I've tried with all the optional margins maybe I skip some option.

\documentclass[12pt,a4paper,twoside]{book}

\usepackage{fancyhdr}

\pagestyle{fancy}

\usepackage[framemethod=TikZ]{mdframed}

\mdfdefinestyle{Ejercicio}{
    linecolor=FireBrick,
    linewidth=2pt,
    innerlinewidth =2pt, 
    frametitlebackgroundcolor=DarkSalmon!20,
    leftline=false,
    rightline=false,
    bottomline=false,
    splitbottomskip=13pt,
    everyline=true,
    }
\mdtheorem[style=Ejercicio]{ejercicio}{Ejercicio}[section]

The result is the next and I don't want that big white space between

Best Answer

The text is already at the very top of the page as can be seen with the addition of the showframe package:

enter image description here

If you really want to reduce that further the space between the header and the top of the page is controlled via \headsep. So with \setlength{\headsep}{5pt} you get:

enter image description here

Code:

\documentclass[12pt,a4paper,twoside]{book}

\usepackage[svgnames]{xcolor}
\usepackage[framemethod=TikZ]{mdframed}

\usepackage{fancyhdr}
\pagestyle{fancy}

\usepackage{lipsum}
\usepackage{showframe}

\mdfdefinestyle{Ejercicio}{
    linecolor=FireBrick,
    linewidth=2pt,
    innerlinewidth =2pt, 
    frametitlebackgroundcolor=DarkSalmon!20,
    leftline=false,
    rightline=false,
    bottomline=false,
    splitbottomskip=13pt,
    everyline=true,
    }
\mdtheorem[style=Ejercicio]{ejercicio}{Ejercicio}[section]

\setlength{\headsep}{5pt}

\begin{document}
\chapter{Chapter Title}
\newpage
\begin{ejercicio}
\lipsum[1]
\end{ejercicio}
\end{document}
Related Question