如何改变此文本的对齐方式?

如何改变此文本的对齐方式?

我的代码:

Theorem: If $(X,T)$ is $T_{2}$-space and $\langle{x_n}\rangle$ is convergent sequence, then $\langle{x_n}\rangle$ has a unique a limit.

如何进行下面的更改以便“定理:”自行分离?

enter image description here

答案1

\documentclass{article}
\usepackage{lipsum}

\newcommand*\theorem[1]{\begin{list}{Theorem:}{\itemindent-2.125em\leftmargin4.67em}\item#1\end{list}}

\begin{document}
\lipsum
\theorem{If $(X,T)$ is $T_{2}$-space and $\langle{x_n}\rangle$ is convergent sequence, then $\langle{x_n}\rangle$ has a unique a limit.}
\lipsum
\end{document}

output

答案2

假设您正在使用amsthmtheorem 包,您可以按照以下代码所示进行操作。它通过以下方式创建自动悬挂缩进:(a) 定义一个合适的宏(称为\hangit),该宏设置参数的值\hangindent; (b) 安排在每个环境\hangafter开始时执行此宏。theorem

如果只有一个实例需要悬挂缩进,您仍然可以“动态”设置参数,如下所示\hangindent\hangafter

enter image description here

\documentclass{article}

\usepackage{amsthm}
\newtheorem{theorem}{Theorem}
\usepackage{etoolbox}
\newcommand{\hangit}{%
   \settowidth{\hangindent}{\textbf{Theorem \thetheorem.}\hspace{0.5em}}%
   \hangafter=1}
\AtBeginEnvironment{theorem}{\hangit}

\begin{document}

\begin{theorem}
If $(X,T)$ is $T_{2}$-space and $\langle{x_n}\rangle$ is a 
convergent sequence, then~$\langle{x_n}\rangle$ has a unique a limit.
\end{theorem}

\noindent
\settowidth{\hangindent}{Theorem: }\hangafter=1
Theorem: If $(X,T)$ is $T_{2}$-space and $\langle{x_n}\rangle$ is a convergent sequence, then $\langle{x_n}\rangle$ has a unique a limit.
\end{document}

相关内容