我感兴趣的是实现如下所示的双列布局,其中列与页面的左边距和右边距齐平:
| section heading | lorem ipsum lorem ipsum lorem ipsum lorem ipsum |
| | lorem ipsum lorem ipsum lorem ipsum lorem ipsum |
| | lorem ipsum lorem ipsum lorem ipsum lorem ipsum |
| | ... |
当然,使用(长)表很容易实现基本形状,但编译器不知道如何处理\section{...}
表内的命令。
另一种可能性是使用 titlesec 和 leftmargin 选项,如下所述这里,但这会将节标题在左边距而不是让其左边缘与左边距齐平。可以通过手动调整边距来实现所需的效果,但我想知道是否有更清晰的解决方案。
答案1
这里我首先从 OP 引用的问题中给出的代码开始。
我不知道实际数字是否准确,但\leftskip
可以使用 来补偿该leftmargin
值。我在此 MWE 中展示了返回原始分区系统的过渡,这必须伴随着 的取消\leftskip
。
\documentclass{article}
\usepackage[showframe]{geometry}
%to lyn preamble from here
\let\svsection\section
\usepackage{titlesec}
\titleformat{\section}[leftmargin]
{\normalfont
\sffamily\bfseries\filleft}
{}{0pt}{}
\titlespacing{\section}
{4pc}{1.5ex plus .1ex minus .2ex}{1pc}
%to here
\begin{document}
\leftskip 1in
\section{Objective}
\noindent
Auditing/Analysis of Operations
\section{Education}
\noindent
B.S. in Management, Rensselaer Polytechnic Institute, Troy, NY, May 1986
Concentrations in Accounting and Management Systems
QPA 3.9 in major, 3.7 overall
\section{A very long section title}
\noindent
B.S. in Management, Rensselaer Polytechnic Institute, Troy, NY, May 1986
Concentrations in Accounting and Management Systems
QPA 3.9 in major, 3.7 overall
B.S. in Management, Rensselaer Polytechnic Institute, Troy, NY, May 1986
Concentrations in Accounting and Management Systems
QPA 3.9 in major, 3.7 overall
B.S. in Management, Rensselaer Polytechnic Institute, Troy, NY, May 1986
Concentrations in Accounting and Management Systems
QPA 3.9 in major, 3.7 overall
\leftskip 0in
\let\section\svsection
\section{A very long section title}
\noindent
B.S. in Management, Rensselaer Polytechnic Institute, Troy, NY, May 1986
Concentrations in Accounting and Management Systems
QPA 3.9 in major, 3.7 overall
B.S. in Management, Rensselaer Polytechnic Institute, Troy, NY, May 1986
Concentrations in Accounting and Management Systems
QPA 3.9 in major, 3.7 overall
B.S. in Management, Rensselaer Polytechnic Institute, Troy, NY, May 1986
Concentrations in Accounting and Management Systems
QPA 3.9 in major, 3.7 overall
\end{document}
答案2
你做想要移动左边距并排版章节标题在边距。
\documentclass[a4paper]{article}
\usepackage[showframe]{geometry}
\usepackage{titlesec}
\usepackage{lipsum}
\geometry{left=6cm,right=3cm} % 3cm for the sections
\titleformat{\section}[leftmargin]
{\normalfont\bfseries\filright}
{\thesection}
{1em}
{}
\titlespacing*{\section}
{3cm}
{2ex plus .2ex minus .2ex}
{1sp}% should be 0, but it must be positive
\begin{document}
\lipsum[2]
\section{A title}
\lipsum[3]
\section{A very very very very very long title}
\lipsum[3]
\end{document}