
Wie entferne ich das Leerzeichen vor dem Theoremnamen? Also das Leerzeichen links von der Klammer. Ich möchte, dass die Klammer linksbündig ausgerichtet wird.
Aus irgendeinem Grund kann ich den \newtheoremstyle
Befehl nicht verstehen.
\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}
Antwort1
Normalerweise ist zwischen dem Theoremnamen und dem zusätzlichen Text ein Leerzeichen fest codiert. Um dieses Leerzeichen zu entfernen, können Sie die theorem begin
Vorlage neu definieren:
\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}
Antwort2
Eine Lösung... Aber warten Sie auf bessere Antworten, bevor Sie akzeptieren:
\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}