由于“Thm 1.2”、“Def 1.33”等的宽度都差不多,我想尝试使用固定缩进的布局。如果在同一行,标签和数字后面的实际内容应该从相同的缩进开始。
在屏幕截图中,标签后面的所有文本都应从红线开始。理想情况下,列表也应与此选项卡左对齐。
我尝试使用该tabu
包,但看来制表符并不完全适合像这样的全局布局场景的用例。
如何影响布局以获得这种行为?
编辑:这是一个独立的例子:
\documentclass{article}
\usepackage[margin=1.25cm]{geometry}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{enumerate}
\usepackage{enumitem}
% amsthm theorem specifications
\theoremstyle{definition}
\newtheorem{defn}{\sffamily Def}[section]
\newtheorem{thm}[defn]{\sffamily Thm}
\newtheorem{lem}[defn]{\sffamily Lem}
% customize section headings
\usepackage{titlesec}
\titleformat*{\section}{\small\sffamily}
% abbreviations
\newcommand{\R} { \mathbb{R} }
\newcommand{\norm}[1] { \lVert #1 \rVert }
%%%%%%%%%%%%%%%
\begin{document}
\section{one}
\begin{defn}
$\hat{f}(\xi)=\int_\R f(x)e^{-ix\xi}dx$
\end{defn}
\begin{thm}
$|\hat{f}(\xi)| \leq \lVert{f}\rVert _1$ \\ $\hat{f} \in C(\R)$ and $\lim_{\xi \rightarrow \pm\infty}\hat{f}(\xi) = 0$
\end{thm}
{\defn $(f \star g)(y) = \int_\R f(y-x)g(x)dx$
}
{\thm $\norm{f \star g }_1 \leq \norm{f}_1 \norm{g}_1$
}
{\thm
\begin{enumerate}[label=(\roman*), font=\sffamily,labelindent=\parindent, leftmargin=*, align=left]
\item $T_tf(x) = f(x-t)$
\item $M_\xi f(x) = e^{ix\xi}f(x)$
\item $D_a f(x) = a^{-1/2} f(x/a)$
\end{enumerate}
}
\end{document}
答案1
更新
在评论中,现在要求不仅缩进每个定理结构的第一行,还要缩进全部行;由于内部amsthm
使用\trivlist
来创建结构,因此实现所需结果的最快方法是使用,例如,etoolbox
修补一些内部命令以更改为\trivlist
,\list
从而允许定义所需的\leftmargin
值:
\documentclass{article}
\usepackage{etoolbox}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{enumitem}
\newlength\thmsep
\setlength\thmsep{5.5em}% change to suit your needs
\newtheoremstyle{fixedwidthindented}
{\topsep}
{\topsep}
{\itshape}
{0pt}
{\bfseries\sffamily}
{}
{0em}
{\llap{\makebox[\thmsep][l]{%
\thmname{#1}~\thmnumber{#2}\if\relax\detokenize{#3}\relax.\fi}}%
\thmnote{~{\normalfont(#3).}}}
\makeatletter
\patchcmd{\@thm}{\trivlist}{\list{}{\leftmargin=\thmsep}}{}{}
\patchcmd{\@endtheorem}{\endtrivlist}{\endlist}{}{}
\makeatother
\theoremstyle{fixedwidthindented}
\newtheorem{thm}{Thm}[section]
\newtheorem{defi}[thm]{Def}
\newlist{thmenumerate}{enumerate}{4}
\setlist[thmenumerate,1]{
label=(\roman*),
font=\normalfont\sffamily,
labelindent=\parindent,
leftmargin=*,
align=left,
}
\begin{document}
\section{Test Section}
\begin{thm}
A test theorem.
\end{thm}
\begin{defi}
A test definition with some filler text just to show how the text wraps when it spans more than one line with some filler text just to show how the text wraps when it spans more than one line.
\end{defi}
\begin{thm}
The following relations hold:
\begin{thmenumerate}
\item $T_{t} f(x) = f(x-t)$
\item $M_{\xi} f(x) = e^{ix\xi}f(x)$
\item $D_{a} f(x) = a^{-1/2} f(x/a)$
\end{thmenumerate}
\end{thm}
\begin{thm}
A test theorem with some filler text just to show how the text wraps when it spans more than one line
\[
M_{\xi} f(x) = e^{ix\xi}f(x)
\]
with some filler text just to show how the text wraps when it spans more than one line.
\end{thm}
\end{document}
结果:
您可以定义一种新样式,使用\makebox
所需宽度来排版结构的名称和编号;在下面的示例中,最终注释将排版在此框之外(如果需要,也可以更改,但问题不包含有关最终注释的信息):
\documentclass{article}
\usepackage{amsmath}
\usepackage{amsthm}
\newlength\thmsep
\setlength\thmsep{5.5em}% change to suit your needs
\newtheoremstyle{fixedwidth}
{\topsep}
{\topsep}
{\itshape}
{0pt}
{\bfseries\sffamily}
{}
{0em}
{\makebox[\thmsep][l]{%
\thmname{#1}~\thmnumber{#2}\if\relax\detokenize{#3}\relax.\fi}%
\thmnote{~{\normalfont(#3).}}}
\theoremstyle{fixedwidth}
\newtheorem{thm}{Thm}[section]
\newtheorem{defi}[thm]{Def}
\begin{document}
\section{Test Section}
\begin{thm}
A test theorem
\end{thm}
\begin{defi}
A test definition
\end{defi}
\begin{thm}
A test theorem
\end{thm}
\end{document}
根据您的需要5.5em
进行更改。\thmsep
更新
如果列表以定理的第一个项开头,则解决方案会更复杂一些;第一项必须接受“特殊处理”;这里有一个小例子:
\documentclass{article}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{enumitem}
\newlength\thmsep
\setlength\thmsep{5.5em}% change to suit your needs
\newtheoremstyle{fixedwidth}
{\topsep}
{\topsep}
{\itshape}
{0pt}
{\bfseries\sffamily}
{}
{0em}
{\makebox[\thmsep][l]{%
\thmname{#1}~\thmnumber{#2}\if\relax\detokenize{#3}\relax.\fi}%
\thmnote{~{\normalfont(#3).}}}
\theoremstyle{fixedwidth}
\newtheorem{thm}{Thm}[section]
\newtheorem{defi}[thm]{Def}
\newlist{thmenumerate}{enumerate}{4}
\setlist[thmenumerate,1]{
label=(\roman*),
font=\normalfont\sffamily,
labelindent=\parindent,
leftmargin=\dimexpr\thmsep+\labelsep\relax,
align=left,
start=2
}
\newcommand\FirstItem{%
\hangindent\leftmargini{\normalfont\sffamily(i)}\hskip\labelsep}
\begin{document}
\section{Test Section}
\begin{thm}
A test theorem
\end{thm}
\begin{defi}
A test definition
\end{defi}
\begin{thm}
\FirstItem $T_{t} f(x) = f(x-t)$
\begin{thmenumerate}
\item $M_{\xi} f(x) = e^{ix\xi}f(x)$
\item $D_{a} f(x) = a^{-1/2} f(x/a)$
\end{thmenumerate}
\end{thm}
\begin{thm}
A test theorem with some filler text just to show how the text wraps when it spans more than one line
\end{thm}
\end{document}
当然,这里最好的解决方案是在列表前添加一些文本,无论如何这都是一个很好的做法(调整列表左边距以满足您的需要):
\documentclass{article}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{enumitem}
\newlength\thmsep
\setlength\thmsep{5.5em}% change to suit your needs
\newtheoremstyle{fixedwidth}
{\topsep}
{\topsep}
{\itshape}
{0pt}
{\bfseries\sffamily}
{}
{0em}
{\makebox[\thmsep][l]{%
\thmname{#1}~\thmnumber{#2}\if\relax\detokenize{#3}\relax.\fi}%
\thmnote{~{\normalfont(#3).}}}
\theoremstyle{fixedwidth}
\newtheorem{thm}{Thm}[section]
\newtheorem{defi}[thm]{Def}
\newlist{thmenumerate}{enumerate}{4}
\setlist[thmenumerate,1]{
label=(\roman*),
font=\normalfont\sffamily,
labelindent=\parindent,
leftmargin=\dimexpr\thmsep+\labelsep\relax,
align=left,
}
\begin{document}
\section{Test Section}
\begin{thm}
A test theorem
\end{thm}
\begin{defi}
A test definition
\end{defi}
\begin{thm}
The following relations hold:
\begin{thmenumerate}
\item $T_{t} f(x) = f(x-t)$
\item $M_{\xi} f(x) = e^{ix\xi}f(x)$
\item $D_{a} f(x) = a^{-1/2} f(x/a)$
\end{thmenumerate}
\end{thm}
\begin{thm}
A test theorem with some filler text just to show how the text wraps when it spans more than one line
\end{thm}
\end{document}