4

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.

  • 1
    I think the manual approach, using leftmargin and \leftskip are likely to be the optimal solution. – Steven B. Segletes Apr 5 '16 at 16:25
  • Try it as a longtable, using the longtable package, perhaps. – Benjamin McKay Apr 5 '16 at 16:26
  • I tried longtable, but I don't it works very well. An individual table entry can't break over a page. – Benjamin McKay Apr 5 '16 at 16:32
2

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

  • If the leftmargin section title is immediatly followed by a subsection tilte (e.g. \section{a title}\subsection{a title})rather than followed by common text, they are not horizontally aligned. How to deal with this problem? – lyl Feb 27 at 2:51
  • @lyl I am not even sure how one would want \subsection to behave in such circumstances. – Steven B. Segletes Feb 27 at 3:18
  • In some conditions, \subsection is useful. I think the problem of align with section title comes from the default vertical spacing, but modifing these spacing of \subsection by \titlespacing does not succeed. So I'm looking if there is an approach to solve it. – lyl Feb 27 at 3:27
  • @lyl Still not clear what you want. If I do \titleformat{\subsection}[leftmargin] {\normalfont \sffamily\bfseries\filleft} {}{0pt}{} \titlespacing{\subsection} {4pc}{1.5ex plus .1ex minus .2ex}{1pc} and employ \subsection{subEd} \noindent B.S. in Management, Rensselaer Polytechnic Institute,... it looks like \section behavior. So what do you seek? – Steven B. Segletes Feb 27 at 3:38
  • Sorry, I'd like to clearify my seek. section title in left margin like this post. subsection title in nomal position(in main body). if \subsection{...} is the first element after \section{...}, then I want the title of subsection is top aligned with section title(that in left margin). Or would you please have a look at this post "tex.stackexchange.com/questions/476713/…" – lyl Feb 27 at 4:05
2

You do want to shift the left margin and to typeset the section title in the margin.

\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}

enter image description here

  • Thanks, this is a nice solution, but not exactly what I was looking for. E.g., the page number is off-center, and one cannot move back and forth between sections in the normal style and sections in the custom style. – Simon C Apr 9 '16 at 14:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.