2

I am attempting to align all of my text, with the exclusion of the section numbering and enumerate numbering, aligned at the same indent/vertical rule. Basically, the section/list numbering would be all in one column and the text that accompanies it would be in another (though I don't believe the multicol environment would be ideal for this for many reasons).

This alignment follows the standard formatting for the document type I'm working on, hence the somewhat weird format.

\documentclass{report}
\usepackage{lipsum}
\usepackage[margin=1in,bottom=1.5in,top=1.25in,head=1in]{geometry}

%----Change default LaTeX section styles---------------------------
\usepackage{titlesec} % Lets user adjust section header formatting

\renewcommand\thesection{25.\arabic{section}}   %Add "25." before section numbering
\setcounter{section}{-1}   %Set first section number to "0"

\titleformat{\section}{\normalfont\bfseries}{\thesection}{1em}{}
\titleformat{\subsection}{\normalfont\bfseries}{\thesubsection}{1em}{}
%-----------------------------------------------------------------

\setlength\parindent{0pt}   %no indent for all paragraphs

\begin{document}

\section[Introduction]{INTRODUCTION}

\subsection{Scope}

\lipsum[1]

\begin{enumerate}
    \item This is Item 1.
    \item Oh look, another item!
    \item This is getting out of hand.
\end{enumerate}

\lipsum[2]

\end{document}

My MWE generates something like this:

enter image description here

But what I'm looking for is more like this:

correct

  • What happens for nested lists? Are there any? – Werner Mar 31 '17 at 21:18
  • @Werner, nested lists would have the same behavior (ex. Item 1, Subitem a would also have the "a" in the left margin space) – grfrazee Mar 31 '17 at 21:24
3

An easy solution with titlesec and enumitem:

\documentclass{report}

\usepackage{lipsum}
\usepackage[margin=1in,bottom=1.5in,top=1.25in,head=1in, showframe]{geometry}

\setlength\parindent{0pt} %no indent for all paragraphs
\usepackage{titlesec}
%Set first section number to "0"
\titleformat{\section}{\normalfont\bfseries}{\llap{\makebox[0.6in][l]{\thesection}}}{0em}{\MakeUppercase}
\titleformat{\subsection}{\normalfont\bfseries}{\llap{\parbox{0.6in}{\thesubsection}}}{0em}{}
\usepackage{enumitem}
\setlist[enumerate]{labelwidth = \dimexpr0.6in-\labelsep, align = left, leftmargin = 0pt}
\setlist[enumerate, 2]{label=\alph*.}
\renewcommand{\rmdefault}{\sfdefault}

\begin{document}

\setcounter{chapter}{24}
\setcounter{section}{-1}
\section[Introduction]{Introduction}
\subsection{Scope}

\lipsum[1]

\begin{enumerate}
    \item This is Item 1.
    \item Oh look,other items!
\begin{enumerate}%[label =\alph. ]
  \item A first subitem
\item Another subitem
\end{enumerate}
    \item This is getting out of hand.
\end{enumerate}
Lalala

\section{Another section}

\lipsum[2]

\end{document} 

enter image description here

  • please see the revised MWE. I have a couple updates. – grfrazee Apr 4 '17 at 14:32
  • Please see the modified answer. – Bernard Apr 4 '17 at 14:58
  • Thanks. Is it still possible to alter the format of the section and subsection headers? See my \titleformat changes in the MWE. – grfrazee Apr 4 '17 at 15:02
  • Do you obtaining the same result with the advanced interface of titlesec? – Bernard Apr 4 '17 at 15:10
  • Changing the header format using \titleformat requires an argument for <sep> between the number and the header, which negates the coding you added with \titlelabel. I'm not particularly well-versed in titlesec to make any additional changes using the Advanced Interface. – grfrazee Apr 4 '17 at 15:19
4

enter image description here

\documentclass{report}
\usepackage{lipsum}
\usepackage[left=2in,right=1in,bottom=1.5in,top=1.25in,head=1in]{geometry}

\setlength\parindent{0pt}   %no indent for all paragraphs
\makeatletter
\def\@seccntformat#1{\noindent\llap{\csname the#1\endcsname \quad}}
\leftmargini0pt

\begin{document}

\section[Introduction]{INTRODUCTION}

\subsection{Scope}

\lipsum[1]

\begin{enumerate}
    \item This is Item 1.
    \item Oh look, another item!
    \item This is getting out of hand.
\end{enumerate}

\lipsum[2]

\end{document}

For left aligned section numbers:

\def\@seccntformat#1{\noindent\llap{\makebox[1in][l]{\csname the#1\endcsname}}}

or with a bit of help from enumitem left aligned list labels as well

enter image description here

\documentclass{report}
\usepackage{lipsum}
\usepackage[left=2in,right=1in,bottom=1.5in,top=1.25in,head=1in]{geometry}
\usepackage{enumitem}
\setlength\parindent{0pt}   %no indent for all paragraphs
\makeatletter
%\def\@seccntformat#1{\noindent\llap{\csname the#1\endcsname \quad}}
\def\@seccntformat#1{\noindent\llap{\makebox[1in][l]{\csname the#1\endcsname}}}

\setlist{leftmargin=0pt,align=left,labelwidth=1in,labelsep=0pt}
\begin{document}

\section[Introduction]{INTRODUCTION}

\subsection{Scope}

\lipsum[1]

\begin{enumerate}
    \item This is Item 1.
    \item Oh look, another item!
    \item This is getting out of hand.
\end{enumerate}

\lipsum[2]

\end{document}
  • Is it possible to align the numbers all of the left side? – grfrazee Mar 31 '17 at 22:09
  • er yes if you say how wide the widest one will be if you have sub sub section 100 of section 1000 do you need space for 1000.100.100.1 ? – David Carlisle Mar 31 '17 at 22:10
  • your example had enumeration numbers flush right though (it seems) so just headings flush left? – David Carlisle Mar 31 '17 at 22:10
  • The deepest it would go is probably 99.99.99.99, I think. – grfrazee Mar 31 '17 at 22:11
  • Enumeration also left-aligned. Sorry, on mobile now and can't update the image. – grfrazee Mar 31 '17 at 22:12

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.