如何使章节标题与实际文本内容顶部对齐?

如何使章节标题与实际文本内容顶部对齐?

我正在尝试编写一个课程大纲,它应该是这样的

在此处输入图片描述

上面的例子是使用NiceTabularX环境完成的。我的问题如下

  1. 该文件实际上将跨越多页,这意味着上面的设计应该使用\section*每个标题(课程标题、目标和目录描述)的命令来完成,右边的列应该是各节之后可供排版的实际文本
  2. 章节标题应为(2in本例中为固定宽度),并与包括枚举在内的内容顶部对齐
  3. 章节标题前后的间距应该是可调整的(至少在\section*命令的主要重新定义中)

我的MWE

\documentclass[11pt]{book}

\usepackage{nicematrix,tikz}

\usepackage{geometry}
\geometry{margin=0.5in,showframe=true}

\usepackage{enumitem}
\setlist[enumerate,1]{leftmargin=*, label=\arabic*., ref=\arabic*}

\usepackage{blindtext}

\begin{document}

{\bfseries \huge \hspace*{\fill} Control Theory I\space Course Syllabus \hspace*{\fill}}

\noindent
\begin{NiceTabularX}{\textwidth}{@{}>{\bfseries\Large}p[l]{2in} X[1, t, l]@{}}[cell-space-limits=1.1961pt]
    
    Course Title & Control Theory I
    \\
    
    Objectives & \vspace{-2.1mm} \begin{enumerate}[nosep]
        
                \item Understand the fundamentals of control systems
                
                \item Understand Laplace transform theorems
                
                \item Understand block diagram reduction (including Mason's rule)
                
                \item Understand the specifications of first-order and second order systems
                
                \item Understand state-space modeling of systems dynamics
        
    \end{enumerate}
    \\
    
    Catalogue description & \blindtext
    \\
    
\end{NiceTabularX}

\end{document}

答案1

那么以下内容如何:

  • center使用(和适当的格式)设置标题
  • 将文档的其余部分设置为向右推的较窄的单列。
  • 标题(或\newsections)设置在边距中(具有适当的格式)。

在此处输入图片描述

\documentclass{article}

\usepackage{geometry,changepage}
\geometry{margin=0.5in,showframe=true}

\usepackage{enumitem}
\setlist[enumerate,1]{leftmargin=*, label=\arabic*., ref=\arabic*}

\usepackage{lipsum}

\setlength{\parindent}{0pt}% Remove paragraph indent

\makeatletter
\newcommand{\newsection}[1]{%
  \par\addvspace{\medskipamount}% Space between sections
  \makebox[0pt][r]{% Set the section in the margin
    \makebox[\lmarginwidth][l]{\bfseries \large \strut #1}%
  }\ignorespaces
}
\makeatother

\newlength{\lmarginwidth}
\newenvironment{coursedetails}[1][.3\linewidth]{%
  % coursedetails sets a right-hand column to hold the main body, with sections in the left margin
  \setlength{\lmarginwidth}{#1}%
  \begin{adjustwidth}{\lmarginwidth}{0pt}
}{%
  \end{adjustwidth}
}

\begin{document}

\begin{center}
  \bfseries \huge
  Control Theory I -- Course Syllabus
\end{center}

\begin{coursedetails}

  \newsection{Course title}
  Control Theory I
  
  \newsection{Objectives}
  The following objectives will be targeted:
  \begin{enumerate}[nosep]
    \item Understand the fundamentals of control systems
    \item Understand Laplace transform theorems
    \item Understand block diagram reduction (including Mason's rule)
    \item Understand the specifications of first-order and second order systems
    \item Understand state-space modeling of systems dynamics
  \end{enumerate}
  
  \newsection{Catalogue description}
  \lipsum[1-10]
  
\end{coursedetails}

\end{document}

相关内容