sub)%20%E9%83%A8%E5%88%86%E5%9D%87%E8%87%AA%E5%8A%A8%E6%8C%89%E5%90%88%E6%B3%95%E6%A0%B7%E5%BC%8F%E7%BC%A9%E8%BF%9B.png)
我想自动化描述的缩进过程这里-- 在这种情况下,在每个 ((sub)sub)section 之后,您必须用 \begin{adjustwidth}{left indent}{right indent} \end{adjust width} 将所有文本括起来,这似乎是多余的。一定有一种更巧妙的方法来重新定义 ((sub)sub)section 以自动合并它,但我是一个 TeX 新手。非常感谢任何建议!
答案1
\documentclass{article}
\usepackage{changepage,lipsum,titlesec}% http://ctan.org/pkg/{changepage,lipsum,titlesec}
\titleformat{\section}[block]{\bfseries}{\thesection.}{1em}{}
\titleformat{\subsection}[block]{}{\thesubsection}{1em}{}
\titleformat{\subsubsection}[block]{}{\thesubsubsection}{1em}{}
\titlespacing*{\subsection} {\leftmargin}{3.25ex plus 1ex minus .2ex}{1.5ex plus .2ex}
\titlespacing*{\subsubsection} {\leftmargin}{3.25ex plus 1ex minus .2ex}{1.5ex plus .2ex}
\makeatletter
\let\xsection\section
\def\section{\par
\leftmargin0\p@
\leftskip\leftmargin
\@totalleftmargin\leftmargin\linewidth\textwidth
\xsection}
\let\xsubsection\subsection
\def\subsection{\par
\leftmargin20\p@
\leftskip\leftmargin
\@totalleftmargin\leftmargin\linewidth\dimexpr\textwidth-\leftmargin\relax
\xsubsection}
\let\xsubsubsection\subsubsection
\def\subsubsection{\par
\leftmargin40\p@
\leftskip\leftmargin
\@totalleftmargin\leftmargin\linewidth\dimexpr\textwidth-\leftmargin\relax
\xsubsubsection}
\begin{document}
\section{A section}
\lipsum[1]
\subsection{A subsection}
\lipsum[2]
\subsubsection{A subsubsection}
\lipsum[3]
\section{A section}
\lipsum[1]
\subsection{A subsection}
\lipsum[2]
\subsubsection{A subsubsection}
\lipsum[3]
\end{document}