[Tex/LaTex] Section headings in a separate column

formattingsectioningtitlesec

I'm interested in achieving a two-column layout like the following, where the columns are flush with the left and right margins of the page:

| 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 | 
|                 |                       ...                       |

The basic shape is of course easy to achieve with a (long)table, but the compiler doesn't know what to do with a \section{...} command inside a table.

Another possibility is to use titlesec with the leftmargin option, as described here, but this places the section heading in the left margin, rather than making its left edge flush with the left margin. The desired effect could be achieved by manually tweaking the margins, but I am wondering if a cleaner solution is possible.

Best Answer

Here I start with the code given in the question cited by the OP.

I don't know the actual numbers are precise, but a \leftskip can be used to compensate for the leftmargin value. I show in this MWE a transition back to the original sectioning system, which must be accompanied by a cancellation of the \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}

enter image description here