
정리 이름 앞에 삽입된 공백을 어떻게 제거합니까? 즉, 괄호 왼쪽의 공간입니다. 브래킷을 왼쪽으로 정렬하고 싶습니다.
어떤 이유에서인지 명령을 이해할 수 없습니다 \newtheoremstyle
.
\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}
답변1
일반적으로 정리 이름과 추가 텍스트 사이에는 하드 코딩된 공백이 있습니다. 이 공간을 제거하려면 theorem begin
템플릿을 다시 정의하면 됩니다.
\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}
답변2
수정 사항입니다. 그러나 수락하기 전에 더 나은 답변을 기다리십시오.
\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}