I have created a custom theorem-like environment using the package thmtools commands \declaretheoremstyle and \declaretheorem. The header of the environment is supposed to be given as an option at the point of use of the environment. The MWE given below defines the custom theorem-like environment custdef as an example of a custom theorem-like environment. The MWE defines the custom theorem with the header Pellentesque Habitant as an instance of the environment custdef. The MWE compiles. However, an unwanted space appears before the header in the typeset text.
Could someone advise me on how I could get rid of the unwanted space. The desired solution should work for any reasonable value of the option postheadspace. I would appreciate any help towards solving the problem.
MWE:
\documentclass[english]{article} \usepackage[T1]{fontenc} \usepackage[latin9]{inputenc} \usepackage{babel} \usepackage{amsthm} \usepackage{thmtools} \usepackage{nameref} \makeatletter \declaretheoremstyle[% spaceabove = \topsep,% spacebelow = \topsep,% notefont = \bfseries,% bodyfont = \normalfont\itshape,% headpunct = .,% notebraces = {}{},% postheadspace = 0.5em,% headindent = \z@,% headformat = \NOTE ]{CDStyle} \declaretheorem[ heading = {}, numbered = no, refname = \NOTE, preheadhook = \vskip\z@,% postfoothook = \vskip\z@,% style = CDStyle ]{custdef} \makeatother \begin{document} Praesent eget sem vel leo ultrices bibendum. Aenean faucibus. Morbi dolor nulla, malesuada eu, pulvinar at, mollis ac, nulla. Curabitur auctor semper nulla. \begin{custdef}[Pellentesque Habitant] Pellentesque Habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas viverra metus rhoncus sem dictum gravida. \end{custdef} Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur dictum gravida mauris. Nam arcu libero, nonummy eget, consectetuer id, vulputate a, magna. Donec vehicula augue eu neque. \end{document} 

