我怎样才能将书籍格式化为这种布局?

我怎样才能将书籍格式化为这种布局?

我想要将文档格式化为图片的布局。在此处输入图片描述

我该如何格式化?

答案1

引入一个新的分段命令lesson和一些“黑客攻击”应该可以解决这个问题:

\documentclass{book}

\makeatletter
\newcounter{lesson}
\@addtoreset{section}{lesson}
\def\thechapter{\@arabic\c@chapter.}
\def\thelesson{\@arabic\c@lesson.}
\def\thesection{\MakeUppercase{\@roman\c@section}.}
\def\thesubsection{\@arabic\c@subsection.}
\def\@makechapterhead#1{%
  \vspace*{50\p@}%
  {\parindent \z@ \raggedright \normalfont
    \ifnum \c@secnumdepth >\m@ne
      \if@mainmatter
        \huge\bfseries \@chapapp\space \thechapter
        \par\nobreak
        \vskip 20\p@
      \fi
    \fi
  }}
\newcommand\lesson{\@startsection{lesson}{1}{\z@}%
                                 {-3.5ex plus -1ex minus -.2ex}%
                                 {2.3ex plus .2ex}%
                                 {\normalfont\Large\bfseries}}
\renewcommand*{\@seccntformat}[1]{\csname additional@#1\endcsname \csname the#1\endcsname\quad}
\def\additional@lesson{\S\space}
\newcommand*\l@lesson{\@dottedtocline{1}{1.5em}{2.3em}}
\def\lessonmark#1{}
\makeatother

\begin{document}
\chapter{Test chapter}
\lesson{The title of the lesson 1}
\section{Section one}
\subsection{Here is a subsection}
\subsection{Subsection}
\section{Section two}
\lesson{The title of the lesson 2}
\section{Section one}
\subsection{Here is a subsection}
\subsection{Subsection}
\section{Section two}
\end{document}

相关内容