![如何使章节标题与实际文本内容顶部对齐?](https://linux22.com/image/440371/%E5%A6%82%E4%BD%95%E4%BD%BF%E7%AB%A0%E8%8A%82%E6%A0%87%E9%A2%98%E4%B8%8E%E5%AE%9E%E9%99%85%E6%96%87%E6%9C%AC%E5%86%85%E5%AE%B9%E9%A1%B6%E9%83%A8%E5%AF%B9%E9%BD%90%EF%BC%9F.png)
我正在尝试编写一个课程大纲,它应该是这样的
上面的例子是使用NiceTabularX
环境完成的。我的问题如下
- 该文件实际上将跨越多页,这意味着上面的设计应该使用
\section*
每个标题(课程标题、目标和目录描述)的命令来完成,右边的列应该是各节之后可供排版的实际文本 - 章节标题应为(
2in
本例中为固定宽度),并与包括枚举在内的内容顶部对齐 - 章节标题前后的间距应该是可调整的(至少在
\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
使用(和适当的格式)设置标题- 将文档的其余部分设置为向右推的较窄的单列。
- 标题(或
\newsection
s)设置在边距中(具有适当的格式)。
\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}