Newtheorem agrega un espacio antes del nombre del teorema

Newtheorem agrega un espacio antes del nombre del teorema

¿Cómo elimino el espacio insertado antes del nombre del teorema? Es decir, el espacio a la izquierda del corchete. Quiero que el soporte se alinee hacia la izquierda.

Por alguna razón no puedo entender el \newtheoremstylecomando.

\documentclass{beamer}
\usepackage[english]{babel}

\theoremstyle{definition}
\newtheorem{mydef}{}[theorem]

\begin{document}
\begin{frame}
\noindent Here is a sentence with correct alignment
\begin{mydef}[This name is prefixed by a single space]
This is a definition 
\end{mydef}
\noindent Here
\end{frame}
\end{document}

ingrese la descripción de la imagen aquí

Respuesta1

Normalmente hay un espacio codificado entre el nombre del teorema y el texto adicional. Para eliminar este espacio, podrías redefinir la theorem beginplantilla:

\documentclass{beamer}
\usepackage[english]{babel}

\theoremstyle{definition}
\newtheorem{mydef}{}[theorem]

\makeatletter
\setbeamertemplate{theorem begin}
{
  \normalfont
  \begin{\inserttheoremblockenv}
  {%
    \inserttheoremname%
    \ifx\inserttheoremaddition\@empty\else%\ <- Removed this space
    (\inserttheoremaddition)\fi%
  }%
}

\makeatother

\begin{document}
\begin{frame}
\noindent Here is a sentence with correct alignment
\begin{mydef}[This name is prefixed by a single space]
This is a definition 
\end{mydef}
\noindent Here
\end{frame}
\end{document}

ingrese la descripción de la imagen aquí

Respuesta2

Una solución... Pero espere mejores respuestas antes de aceptar:

\documentclass{beamer}
\usepackage[english]{babel}
\usepackage{tikz}
\def\tikzmark#1{\begin{tikzpicture}[remember picture]\coordinate (#1);\end{tikzpicture}}
\theoremstyle{definition}
\newtheorem{mydef}{\hskip-0.375em}[theorem]% Here is the only change needed

\begin{document}
\begin{frame}
 \tikzmark{A}Here is a sentence with correct alignment

  test
\begin{mydef}[This name is prefixed by a single space]
This is a definition 
\end{mydef}
\tikzmark{B}Here
\begin{tikzpicture}[overlay,remember picture]
  \draw[red,-] ([yshift=1em]A)--(B);
\end{tikzpicture}
\end{frame}
\end{document}

ingrese la descripción de la imagen aquí

información relacionada