# Makebox spacing inside mdframed

I want to be able to have some text aligned in the left margin such as a theorem label, and then have the example in the mdframed box. Here is an example of my failed attempt.

As you can see the text "this is a test" is slighly pushed right. Here is the code for this example

\documentclass[18pt]{article}

\usepackage{mdframed}
\newcommand{\sdef}{ %
\hspace*{-2in}\makebox[2in]{\hfill \textbf{Definition 1.1.1.1} \hspace*{.35in}}}

\newenvironment{definition}
{\begin{mdframed}[linewidth=2pt,roundcorner=8pt,align=center]
\vspace*{5px}%
\sdef}
{\vspace*{5px}
\end{mdframed}}

\begin{document}
\begin{definition}
This is a test \\
Here is more text.
\end{definition}
\end{document}


How do I properly align that first sentence? Thank you in advance.

EDIT: Another solution that I came across was to use the \ignorespaces macro so replacing the defintion of sdef with this works

\newcommand{\sdef}{ %
\hspace*{-2in}\makebox[2in]{\hfill \textbf{Definition 1.1.1.1} \hspace*{.35in}}\ignorespaces}

• While code snippets are useful in explanations, it is always best to compose a fully compilable MWE that illustrates the problem including the \documentclass and the appropriate packages so that those trying to help don't have to recreate it. Dec 24 '18 at 17:54
• @marmot I'm not terribly good at sketches but all I want is for that first sentence "This is a test" to be left aligned to the same point where the "Here is more text" sentence is.
– Nick
Dec 24 '18 at 18:15

Here is a work-around, inserting a negative interword space at the beginning of the environment:

\documentclass[18pt]{article}
\usepackage{showframe}
\renewcommand{\ShowFrameLinethickness}{0.3pt}
\usepackage{mdframed}
\newcommand{\sdef}{ %
\hspace*{-2in}\makebox[2in]{\hfill \textbf{Definition 1.1.1.1}\hspace*{.35in}}}

\newenvironment{definition}
{\begin{mdframed}[linewidth=2pt,roundcorner=8pt,align=center]%
\vspace*{5px}%
\sdef\hspace*{-\fontdimen2\font}}
{\vspace*{5px}
\end{mdframed}}

\begin{document}

\begin{definition}
This is a test \\
Here is more text.
\end{definition}
\end{document}