Novoteorema adiciona um espaço antes do nome do teorema

Novoteorema adiciona um espaço antes do nome do teorema

Como removo o espaço inserido antes do nome do teorema? Ou seja, o espaço à esquerda do colchete. Quero que o colchete se alinhe à esquerda.

Por algum motivo não consigo entender o \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}

insira a descrição da imagem aqui

Responder1

Normalmente há um espaço codificado entre o nome do teorema e o texto adicional. Para remover este espaço, você pode redefinir o theorem beginmodelo:

\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}

insira a descrição da imagem aqui

Responder2

Uma correção. Mas espere por respostas melhores antes de aceitar:

\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}

insira a descrição da imagem aqui

informação relacionada